Issue Details (XML | Word | Printable)

Key: SPEC-251
Type: Change Request Change Request
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Reporter: Thomas Beale
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Specification

Allow both pattern and interval constraint on Duration in Archetypes

Created: 18/Feb/08 06:42 AM   Updated: 20/Nov/08 10:59 PM  Due: 04/Aug/08
Component/s: ADL
Affects Version/s: None
Fix Version/s: Release 1.0.2

Time Tracking:
Not Specified

 Raise CR   Analysis   Resolution   
Raised By: Sam Heard
Change Description:
A new piece of syntax is needed in cADL to support this constraint. It takes the form of the following example:
some_duration matches {PWD/|P0W..P50W|}

The production rule added to an ADL parser is as follows:

c_duration_constraint:
          duration_pattern
        | duration_pattern '/' duration_interval_value -- new rule
        | duration_value
        | duration_interval_value
;

where duration_pattern is a rule like the following (this one is from the Eiffel reference ADL parser):

duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
                {
                       if valid_iso8601_duration_constraint_pattern ($1) then -- this function performs further validation on the pattern to ensure it is iso8601 compliant
                               create c_duration.make_from_pattern ($1)
                       else
                                raise_error
                                report_error ("invalid duration constraint pattern; legal pattern: P[Y|y][M|m][W|w][D|d][T[H|h][M|m][S|s]] or P[W|w]")
                                abort
                       end
                }
        ;

And the token V_ISO8601_DURATION_CONSTRAINT_PATTERN has a lexer rule like the following:

-- the following includes the openEHR deviation from ISO8601, to allow 'W' to be mixed in with
-- other designators
P[yY]?[mM]?[Ww]?[dD]?T[hH]?[mM]?[sS]? |
P[yY]?[mM]?[Ww]?[dD]? {
                                last_token := V_ISO8601_DURATION_CONSTRAINT_PATTERN
                                last_string_value := text
                   }


In the AOM, the invariant of C_DURATION is relaxed to allow both range and pattern to be set at the same time.
Impact Analysis: This work has already been done in tooling, and is in use in archetypes for about 6 months. The only work required in the specifications is to add examples and the production rule to the documenation.
Analyst: Peter Gummer, Sam Heard and Thomas Beale
Approved By: ARB


 Description  « Hide
Currently there is no way to specify a constraint on Duration such that both of the following can be specified at once:
- the allowed units are specified, e.g. the current PWD constraint allows only weeks and days
- the time limit, e.g. the current |P0W..P50W| allows this

This constraint is needed at least for the common duration constraint for pregnancy.

The existing syntax strings must continue to parse as they do now:
|PWD|
|P0W..P50W|

Example can be found online in this test archetype: http://www.openehr.org/wsvn/knowledge/archetypes/dev/adl/test/basics/adl-test-ENTRY.basic_types.v1.adl?op=file&rev=0&sc=0 (see duration_attribute_101 - 207)

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Thomas Beale added a comment - 18/Jul/08 10:59 PM
Accepted by ARB: TB, RC, SH, TC, EB, DK

Thomas Beale added a comment - 24/Jul/08 02:33 PM
Small adjustment to solution - used the one from the working ADL workbench grammar.

Thomas Beale added a comment - 28/Jul/08 04:11 PM
Updated the change description to include current working rules.

Thomas Beale added a comment - 11/Aug/08 11:19 PM
Passed by EB, RC, TB, JA, DK