FHIR Chat · How to validate a profile against SD's in a directory? · conformance

Stream: conformance

Topic: How to validate a profile against SD's in a directory?


view this post on Zulip Vadim Peretokin (May 30 2019 at 10:36):

I don't have an IG, but I have a profile and a directory full of StructureDefinitions. Is validating without an IG is still supported? Wiki mentions this should work:

java -jar /home/vadi/Downloads/org.hl7.fhir.validator.jar '/home/vadi/Desktop/swedishnationalmedicationlist/MedicationRequest-example-bad.json' -ig '/home/vadi/Desktop/swedishnationalmedicationlist/' -version 3.0

But the validator goes haywire and starts scanning markdown files, before crashing on a directory:

FHIR Validation tool Version 3.7.40-SNAPSHOT - Built 2019-05-30T13:33:06.82+10:00 - Git 75500dae8687
Arguments: /home/vadi/Desktop/swedishnationalmedicationlist/MedicationRequest-example-bad.json -ig /home/vadi/Desktop/swedishnationalmedicationlist/ -version 3.0
  .. connect to tx server @ http://tx.fhir.org
  .. definitions from hl7.fhir.core#3.0.1
    (v3.0.1)
+  .. load IG from /home/vadi/Desktop/swedishnationalmedicationlist/
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/Dosedispensedrequests.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/Dosedispensedrequests.md
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/Changepresecription.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/Changepresecription.md
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/Createconsentfordosedispensing.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/Createconsentfordosedispensing.md
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/MedicationDispense.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/MedicationDispense.md
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/nll.jpg
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/nll.jpg
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/Practitioner.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/Practitioner.md
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/Cancelconsentfordosedispensing.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/Cancelconsentfordosedispensing.md
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/change_prescri_ext.png
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/change_prescri_ext.png
   ..Detect format for /home/vadi/Desktop/swedishnationalmedicationlist/Fetchconsent.md
[Fatal Error] :1:1: Content is not allowed in prolog.
     .. not a resource: /home/vadi/Desktop/swedishnationalmedicationlist/Fetchconsent.md
Exception in thread "main" java.io.FileNotFoundException: /home/vadi/Desktop/swedishnationalmedicationlist/NLL (Is a directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at org.hl7.fhir.r5.validation.ValidationEngine.checkIsResource(ValidationEngine.java:635)
    at org.hl7.fhir.r5.validation.ValidationEngine.scanDirectory(ValidationEngine.java:494)
    at org.hl7.fhir.r5.validation.ValidationEngine.loadIgSource(ValidationEngine.java:430)
    at org.hl7.fhir.r5.validation.ValidationEngine.loadIg(ValidationEngine.java:660)
    at org.hl7.fhir.r5.validation.Validator.main(Validator.java:373)

view this post on Zulip Lloyd McKenzie (May 30 2019 at 11:14):

Why are you specifying an IG if you don't have an IG?

view this post on Zulip Eric Haas (May 30 2019 at 14:45):

I have never been able to get this to work. I just stripped down us core to act as a validation tool with pretty links to the validation results.

view this post on Zulip Grahame Grieve (May 30 2019 at 21:01):

@Eric Haas you should ask. There should be no reason to need to strip down an IG. in your case, you should be using the package

view this post on Zulip Grahame Grieve (May 30 2019 at 21:08):

@Vadim Peretokin blowing up on a directory is a bug that will be fixed in the next release. The .md files are being loaded as xml in case they are, and the xml library is producing that output directly. I'll add .md to the list of files to ignore

view this post on Zulip Eric Haas (May 30 2019 at 21:10):

The IG does the validation on the current profiles so it seemed like the natural choice and its pretty easy to load the examples folders with test files and do a bulk validation.

view this post on Zulip Grahame Grieve (May 30 2019 at 21:12):

I don't understand that. The IG publisher does validation on the examples already. what are you trying to do that's different?

view this post on Zulip Eric Haas (May 30 2019 at 21:17):

Nothing is different, I just focus on the examples and QA output.

view this post on Zulip Vadim Peretokin (May 31 2019 at 08:08):

Mm so what's the right way to simply validate an instance against a profile without the overhead of a package?

view this post on Zulip Vadim Peretokin (May 31 2019 at 09:23):

@Lloyd McKenzie the -ig parameter states: "... or a local folder that contains a set of conformance resources."

view this post on Zulip Grahame Grieve (May 31 2019 at 10:15):

yes that way. should work now

view this post on Zulip Vadim Peretokin (May 31 2019 at 10:37):

It's not with the latest release 3.7.41 :(

view this post on Zulip Vadim Peretokin (Jun 02 2019 at 05:26):

I've fixed the markdown (and other file) scanning with: https://github.com/hapifhir/org.hl7.fhir.core/pull/36


Last updated: Apr 12 2022 at 19:14 UTC