FHIR Chat · Profiling:- Specify format for valid values · implementers

Stream: implementers

Topic: Profiling:- Specify format for valid values


view this post on Zulip Mritunjay Dubey (Jan 20 2017 at 04:13):

Hi,
I wanted to know, using profile if it is possible to specify a format(Regular Expression) of value for a field.
I will take an example, Suppose we have a Identifier for national-id, it will be good if I can specify a regex for what is a valid value for identifier. This will be helpfull because we can't couple our validation code with fields.

Thanks in advance.

view this post on Zulip Lloyd McKenzie (Jan 20 2017 at 04:38):

There's an extension that supports this - http://build.fhir.org/extension-regex.html

view this post on Zulip Lloyd McKenzie (Jan 20 2017 at 04:38):

However, it's not currently supported by the validator or authoring tools

view this post on Zulip Grahame Grieve (Jan 20 2017 at 09:05):

we better start supporting it in the validator

view this post on Zulip Lloyd McKenzie (Jan 20 2017 at 13:21):

@Mritunjay Dubey If you like, you can submit a change request for inclusion of this in the validator.

view this post on Zulip Mritunjay Dubey (Jan 20 2017 at 14:47):

@Lloyd McKenzie @Grahame Grieve I have submitted GF#12665 for the same. Thank you

view this post on Zulip Mritunjay Dubey (Jan 21 2017 at 09:09):

Had a question, if I want to browse the code and implement it (if possible), how should I start. is there a document/steps on it? I thought of checking-out from svn, but it is a huge repo. So I just wanted to confirm if I am going in right direction. It will be great if I can get steps for how do we start contributing to fhir.

I thought of creating a pull-request in github FHIR-svn, but I was not sure since it’s just a mirror, and actual development is in SVN.

view this post on Zulip Mritunjay Dubey (Jan 21 2017 at 13:06):

@Lloyd McKenzie @Grahame Grieve I just wanted to try out this "extension-regex" in my profile, but I am not sure how exactly I should apply it. I am using furore's forge tool to create profiles. I just wanted to say patient.name.family should follow a pattern.

Might be a dumb question but I didn't get any example for this.

view this post on Zulip Lloyd McKenzie (Jan 21 2017 at 15:22):

@Mritunjay Dubey At the moment, I don't think you can do this in Forge - Forge only supports capturing "core" elements in StructureDefinition, not extensions, though I believe adding support for StructureDefinition and ElementDefinition extensions is on their list of "things to do" (there's lots of "things to do" when it comes to profiling . . . :>) So if you want to experiment with this, you'd need to create your profile in Forge and then hand-edit it to contain the extension (recognizing that Forge will remove the extension if you subsequently edit the profile with Forge again).

In terms of implementing, what exactly do you mean? You want to update the Java validator to include this? If that's the case, the class you're going to need to play with is InstanceValidator.java. Some parts of it are evil, but this piece shouldn't be. You will however need to check out the whole "publish" folder to make and test your change though.

view this post on Zulip Lloyd McKenzie (Jan 21 2017 at 15:24):

Generally we don't give committer access to people who aren't doing work on behalf of a work group, but if you get heavily involved with maintenance, we can make exceptions. For this time around, just send me the updated file once you've got it working - if you still want to take it on once you've looked at the code :)

view this post on Zulip Mritunjay Dubey (Jan 22 2017 at 05:41):

@Lloyd McKenzie Thanks for your response. I will look into it. Right now I am not sure how exactly to extend the element-definition. Suppose if we want to give the Patient=>name=>family, how exactly to hand-edit it in the patient profile(or human-name profile if needed). I tried searching on the web for examples, but I couldn't find one to start with. It will be great if you can give some inputs on this part.
Thaks

view this post on Zulip Lloyd McKenzie (Jan 22 2017 at 15:41):

I'd start by using Forge to create your profile and constrain something on Patient.name.family so it'll show up in the generated profile. Then you'd need to find the element with that path and add this:

  <extension url="http://hl7.org/fhir/StructureDefinition/regex">
    <valueString value="[your expression here]"/>
  </extension>

view this post on Zulip Brian Postlethwaite (Jan 23 2017 at 03:18):

Alternately you could use the regex in a fhirpath invariant expression on the property

view this post on Zulip Martijn Harthoorn (Jan 23 2017 at 10:32):

It of course depends on whether you want to instruct the client (the form) or just make sure invalid data doesn't get into the server.

view this post on Zulip Brian Postlethwaite (Jan 23 2017 at 20:25):

True


Last updated: Apr 12 2022 at 19:14 UTC