Fhir Path Regex for valueDate

442 views Asked by At

We recently started to use fhir path to validate a QuestionnaireResponse. The QuestionnaireResponse is the following

<QuestionnaireResponse xmlns="http://hl7.org/fhir"> 
 <questionnaire>
  <reference value="..." />
 </questionnaire>
 <status value="completed" />
 <authored value="2016-02-19T05:13:42.600Z" />
 <group>
  <question>
   <linkId value="8d0db198-f341-43f8-9dd3-9151ace66375" />
   <text value="date" />
   <answer>
    <valueDate value="2016-02-12" />
   </answer>
  </question>
 </group>
</QuestionnaireResponse>

I have tried the following:

QuestionnaireResponse.group.question.answer.valueDate

and the answer was:

2016-02-12

However trying the following to validate the date with a regex throws exception

QuestionnaireResponse.group.question.answer.valueDate.matches("^\d{4}-((0\d)|(1[012]))-(([012]\d)|3[01])$")

it would be great if you may give me some idea of what is the best way to evaluate a date in fhir path

1

There are 1 answers

0
Brian Postlethwaite On BEST ANSWER

This turned out to be a bug in the .NET FluentPath evaluator that is in development still (regex section).

The FHIR server should also have rejected the value as not conforming without the fhirpath expression also.