Skip to Navigation | Skip to Content

Ref_impl_Java mailing list archives

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: DvDuration: Mixed Pattern and Interval not supported by ADL Parser


Hi Sebastian,

I can confirm the changes. I just re-arranged the code to make it clearer.

Cheers,
Rong

On 12 July 2010 13:38, Sebastian Garde <sebastian.garde@oceaninformatics.com> wrote:
Hi Rong and all,

The ADLParser does not appear to support a mixed pattern and Interval for a DV_DURATION.

>From the ADL Specs
Mixed Pattern and Interval
In some cases there is a need to be able to limit the allowed units as well as state a duration interval.
This is common in obstetrics, where physicians want to be able to set an interval from say 0-50 weeks
and limit the units to only weeks and days. This can be done as follows:
PWD/|P0W..P50W| -- 0-50 weeks, expressed only using weeks and days
The general form is a pattern followed by a slash ('/') followed by an interval, as follows:
duration_pattern '/' duration_interval



I have implemented the following change in the Parser (in red).

CDuration c_duration() :
{
  DvDuration value = null;
  Interval interval = null;
  DvDuration assumed = null;
  Token t = null;
  String pattern = null;
}
{
 (
    t = <V_ISO8601_DURATION_CONSTRAINT_PATTERN>
    { pattern = t.image; } 
  |
    value = duration_value()
  |
    interval = duration_interval_value()
  )
  [
     "/" interval = duration_interval_value()
  ]
   
 
  [
    ";" assumed = duration_value()
  ]
  {
    return new CDuration(value, interval, assumed, pattern);
  }
}

It works as far as I can tell, but maybe someone has a more elegant solution without having to repeat the interval part.
If not, I will commit this change soon.

Regards
Sebastian



--
 
Ocean Informatics
Dr Sebastian Garde
Senior Developer
Ocean Informatics
Dr. sc. hum., Dipl.-Inform. Med, FACHI

Skype: gardeseb


_______________________________________________
Ref_impl_java mailing list
Ref_impl_java@openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/ref_impl_java


_______________________________________________
Ref_impl_java mailing list
Ref_impl_java@openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/ref_impl_java