FHIR Chat · FHIR Profiles - Pattern · conformance

Stream: conformance

Topic: FHIR Profiles - Pattern


view this post on Zulip Odd A. S. Dahl (Feb 24 2017 at 09:37):

Hi, we are using the Validate function in the DSTU2 library to validate all data against our custom profiles, and one of the profile settings for a given element is the "Pattern" property. We (wrongly?) assume this is a regex pattern, but I cannot find any documentation on the usage of this property, and the validator fails when using a regex as the value (the code seems to do string compare).
What is the inteted usage of "Pattern"?

view this post on Zulip Michel Rutten (Feb 24 2017 at 09:55):

http://build.fhir.org/elementdefinition-definitions.html#ElementDefinition.pattern_x_

view this post on Zulip Odd A. S. Dahl (Feb 24 2017 at 10:16):

Thanks. I'm assuming we should use Constraints instead to make sure element values are according to expected format (like min.length).

view this post on Zulip Michel Rutten (Feb 24 2017 at 11:56):

@Odd A. S. Dahl a FHIR validator should verify that actual values conform to constraints such as the maxLength property. You should only have to write an explicit constraint to validate rules that you cannot express using the standard properties of ElementDefinition.

view this post on Zulip Michel Rutten (Feb 24 2017 at 12:01):

As the spec mentions, pattern is "Mostly used for fixing values of CodeableConcept."
Here's an example:

        <patternCodeableConcept>
          <coding>
            <system value="http://loinc.org"/>
            <code value="72166-2"/>
          </coding>
        </patternCodeableConcept>

view this post on Zulip Odd A. S. Dahl (Feb 24 2017 at 12:22):

@Michel Rutten, we're planning to use it for validating min length of elements that are defined as strings. I checked now with a CommunicationRequest payload.contenString (which we have defined as string), <contentString value=""/> does not give error or warning.

view this post on Zulip Michel Rutten (Feb 24 2017 at 12:26):

@Odd A. S. Dahl Note that FHIR defines an official extension for minimum length:
https://hl7.org/fhir/2017Jan/extension-minlength.html
But I'm not sure if/which validators currently support this extension.

view this post on Zulip Brian Postlethwaite (Feb 26 2017 at 00:43):

Actually, <conmtentString value="" /> violates one of the core element constraints, so should be picked up earlier.

view this post on Zulip Odd A. S. Dahl (Feb 27 2017 at 13:03):

@Brian Postlethwaite that is good to hear, I was reluctant to use the regex in the profile. From what I can see the validator only perform a type check on base types (ProfileAssertion.cs:Validate()), but we'll add some custom code into our local build and wait for a future update.


Last updated: Apr 12 2022 at 19:14 UTC