Validation with custom profile

Hi Team

Wanted to know how to validate with Custom profiles.We have made some Modifications to and existing profile in forge and published on Simplifier.How do we go about validating the same .

Have you tried using the HL7 validator? http://build.fhir.org/validator.zip

Hi lloyd

We did and observed its not validating against the simplifier url for the new valuesets we have added.Is my understanding correct?
Should we change the valueset.xml inside validator jar to reflect the same.

If you have the valuesets/profiles in local folders you can point to the validator to include these:

java -jar ./validator/org.hl7.fhir.validator.jar tovalidate.xml -defn ./validator/igpack.zip -ig ./resources/StructureDefinition/ -ig ./resources/ValueSet/ -tx n/a

Hi,

I can understand how you get both ./resources/StructureDefinition/ ./resources/ValueSet/ (by eg with forge/clinFHIR or manualy).

But what about the ./validator/igpack.zip file ? Do I need to use the IG publisher to get it ? Do I need to build a control file and all the stuff described here http://wiki.hl7.org/index.php?title=IG_Publisher_Documentation?

Can you point me in the right direction ?

Thanks a lot

Hi,

For my validation I required the igpack.zip from R3 from FHIR Definitions File used by the IG Publisher and then added the additional folders as outlined above for my ValueSets/StructureDefinitions.

During the last HL7WGM Furore presented the new features of simplifier.net, they integrated now directly a validation on simplifier.net. Did you try this out?So maybe using directly the validator is not necessary for you anymore.

Oliver

Hi Oliver,

Thanks for your help.

About the hl7 fhir validator, I am now able to use it, to validate my own profiles locally. But apparently, the only thing it validates is the validity of the URL. It does not warn about wrong profiled cardinality, or presence of bad extension. This does not refleat the table https://www.hl7.org/fhir/validation.html that says validator handle cardinality. Does it mean this is a work in progress ? Or am I missing something ?

About the Simplifier, I just made a test. I am not able to validate resources based on my published profiles. I get an error :

Unable to resolve reference to profile ‘https://simplifier.net/XXX/MyProfile
Maybe I am not aware of the way to publish a profile and reference it within profiled resources ?

Concerning the validator: It handles the cardinality as far as I know. Can you share your sample and profile?

Simplifier: In the Zulip Channel Michel Ruten has mentioned some settings concerning accessing profiles, maybe that helps, but as long as you have everything in one project it should not matter.

Here is the profile:
https://simplifier.net/test243/MimicPatient
Here is the sample:
https://simplifier.net/test243/Patient-example337

So I said in the profile that such patient shall have birthdate and shall have an extension “sepsis” but the validator does not complain about those missing informations:

Success…validating MimicPatient.json: error:0 warn:2 info:0
Warning @ Patient.communication.language : Display Name for en-US must be ‘Engelsk (Amerikansk)’
Warning @ Patient.communication.language.coding (line 112, col18) : Unknown Code System http://hl7.org/fhir/CodeSystem/languages

Hi Natus

Your StructureDefinition for MimicPatient is itself not validating:

FAILURE validating MimicPatient.xml: error:2 warn:0 info:0
Error @ StructureDefinition (line 1, col50) : All element definitions must have an id [snapshot.element.all(id.exists()) and differential.element.all(id.exists())]
Error @ StructureDefinition.differential (line 18, col17) : No slicing on the root element [element.first().slicing.empty()]

I tried to adapt your StructureDefinition to a valid one (but just for the birthDate and extension)

<StructureDefinition xmlns="http://hl7.org/fhir">
  <meta>
    <lastUpdated value="2017-05-31T19:39:49.312+02:00" />
  </meta>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="pa" />
  </extension>
  <url value="http://natus.1s.fr/MimicPatient" />
  <name value="MimicPatient" />
  <status value="draft" />
  <date value="2017-05-29T08:41:48.6183904+02:00" />
  <fhirVersion value="3.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Patient" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient" />
  <derivation value="constraint" />
  <differential>
		<element id="Patient">
			<path value="Patient" />
			<short value="Patient"/>
			<definition value="Patient" />
			<min value="1" />
			<max value="1" />
		</element>
    <element id="Patient.extension">
      <path value="Patient.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Patient.extension:SepsisAPHP">
      <path value="Patient.extension" />
      <sliceName value="SepsisAPHP" />
      <short value="Optional Extensions Element" />
      <definition value="Optional Extension Element - found in all resources." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://natus.1s.fr/extension/SepsisAPHP" />
      </type>
    </element>
    <element id="Patient.birthDate">
      <path value="Patient.birthDate" />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>
```
Now the StructureDefintion validates:

>   .. connect to tx server @ null
>     (v3.0.1-11917)
> +  .. load IG from 
>   .. validate
> Success...validating StructureDefinition/MimicPatientFix.xml:  error:0 warn:0 info:0

and now the output is for validating the patient:
>   Error @ Patient (line 1, col38) : Profile http://natus.1s.fr/MimicPatient, Element 'Patient.birthDate': minimum required = 1, but only found 0
>   Information @ Patient (line 1, col38) : Profile http://natus.1s.fr/MimicPatient, Element 'Patient.extension[SepsisAPHP]': Unable to check minimum required (1) due to lack of slicing validation
>   Warning @ Patient.communication.language (line 79, col15) : Display Name for en-US must be 'Engelsk (Amerikansk)'
>   Warning @ Patient.communication.language.coding (line 80, col15) : Unknown Code System http://hl7.org/fhir/CodeSystem/languages
>   Warning @ Patient.extension (line 6, col71) : Error in profile for Patient.extension: unable to find type for Patient.extension:sepsisaphp

The Paitent.birthDate is now catched, but slicing validation is currently not yet supported with the validator ...

Hi Oliver,

This is very cool.
I didn’t know the need to before validate the profile

java -jar org.hl7.fhir.validator.jar MimicPatient.structuredefinition.xml

Then it appends that my profile was actually not conformant. I made it with forge STU3. I have seen somewhere that “id” where missing somewhere, and this looks like something forge will fixe soon.

Thanks again for your help, I have been able to:
1)produce & fixe locally my profiles with forge
2)test instance resources locally

Hope the validator will improve. Do you know if it handles invariants right now ? (I mean fhirPATH definitions)

The validator handles FHIRPath for invariants.

Hi ,

Could you please send the FHIR resource , profile definition and the steps to run it via locally …?

Best Regards,
Mitul