FHIR Chat · FHIR Validation · implementers

Stream: implementers

Topic: FHIR Validation


view this post on Zulip Rob Walker (Oct 24 2016 at 20:18):

Hello, I can't seem to get the validation tools to work with a custom profile / structure definition. When I try;

java -jar org.hl7.fhir.validator.jar patient.xml -defn validation-min.xml.zip -profile SitekitPatient.structuredefinition.xml

I get a "java.lang.IndexOutOfBoundsException". My patient resource and profile definition are very simple.

view this post on Zulip Rob Walker (Oct 24 2016 at 20:23):

Patient resource example;

<Patient xmlns="http://hl7.org/fhir">
<id value="example"/>
<gender value="male"/>
</Patient>

view this post on Zulip Rob Walker (Oct 24 2016 at 20:24):

Profile example;
<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<meta>
<lastUpdated value="2016-10-24T20:24:09.779+01:00" />
</meta>
<url value="http://sitekit.net/fhir/patient" />
<name value="SK-Patient" />
<status value="draft" />
<fhirVersion value="1.0.2" />
<kind value="resource" />
<constrainedType value="Patient" />
<abstract value="false" />
<base value="http://hl7.org/fhir/StructureDefinition/Patient" />
<differential>
<element>
<path value="Patient" />
<type>
<code value="Patient" />
</type>
</element>
<element>
<path value="Patient.gender" />
<min value="1" />
<fixedCode value="male" />
</element>
</differential>
</StructureDefinition>

view this post on Zulip Rob Walker (Oct 24 2016 at 20:27):

I've also tried to validate via http://fhir2.healthintersections.com.au/open/Patient/$validate?profile=http://hl7.org/fhir/StructureDefinition/SitekitPatient (having managed to successfully post the structure definition in an earlier request). I get back a http 500 Access violation at address 0000000000A8EE60 in module 'FHIRServer.exe'. Read of address 0000000000000060

view this post on Zulip Rob Walker (Oct 24 2016 at 20:30):

I tried something similar with the Hapi server (http://fhirtest.uhn.ca/baseDstu2), but couldn't manage to POST my StructureDefinition profile - the server returned HTTP 500 : Failed to call access method.

view this post on Zulip Grahame Grieve (Oct 25 2016 at 09:19):

I ill try and get to this in about 24 hours time

view this post on Zulip Rob Walker (Oct 25 2016 at 19:13):

Nice one, thanks Grahame.

view this post on Zulip Simone Heckmann (Oct 26 2016 at 16:22):

I just noticed today (or rather, someone in my tutorial did) that the server updates a resouce, when the $validate-Operation is called and passes. I don't think thats what the operation is supposed to do...?

view this post on Zulip Lloyd McKenzie (Oct 26 2016 at 17:17):

Which server?

view this post on Zulip Simone Heckmann (Oct 27 2016 at 11:40):

Grahame's DSTU2 endpoint

view this post on Zulip Grahame Grieve (Oct 27 2016 at 12:18):

hmm. can you create a bug report on https://github.com/grahamegrieve/fhirserver please

view this post on Zulip Simone Heckmann (Oct 28 2016 at 15:59):

um. no.
Could not reproduce.

view this post on Zulip Tim Coates (Nov 08 2016 at 11:26):

Is there a definitive list anywhere which describes all of the things that a validation routine should check?

view this post on Zulip Grahame Grieve (Nov 08 2016 at 11:29):

no. There isn't. Partly because there can be no definitive list, and also because it would be (a) lots of work and (b) quite duplicative.

view this post on Zulip Grahame Grieve (Nov 08 2016 at 11:29):

the reference validation routines are in the java build tool that are made available as the validator. This is the most complete documentation there is

view this post on Zulip Tim Coates (Nov 08 2016 at 11:44):

But (AFAIK) the source code for the validator isn't released, so the only validation possible is to use the compiled validator? Agree that recreating one it could be a duplication of effort, but I'm surprised it's not even possible.

view this post on Zulip Grahame Grieve (Nov 08 2016 at 11:55):

I didn't say it wasn't possible. Just that we hadn't done it.

view this post on Zulip Grahame Grieve (Nov 08 2016 at 11:55):

and of course the validator source is released.

view this post on Zulip Grahame Grieve (Nov 08 2016 at 11:56):

http://gforge.hl7.org/svn/fhir/trunk/build/implementations/java/org.hl7.fhir.dstu3/src/org/hl7/fhir/dstu3/validation/InstanceValidator.java

view this post on Zulip Tim Coates (Nov 08 2016 at 13:24):

I'm sorry, that was clearly my misunderstanding.

view this post on Zulip Mitul Adhia (Jun 19 2017 at 11:30):

social > FHIR validation Today

Mitul Adhia: Hello ,

Currently i am trying validator.zip to validate against the profile which i have publish on my web server(tomcat local server). Also in resource i have changed the meta profile to the web server url but it is not validating the resouce against the said profile ..

java -jar validator/org.hl7.fhir.validator.jar patient.xml -profile http://localhost:8888/WebApplication1/patient_profile.xml

It returns error
FAILURE validating patient.xml: error:1 warn:1 info:0
Error @ Patient (line 1, col76) : StructureDefinition reference "http://localhost:8888/WebApplication1/patient_profile.xml" could not be resolved
Warning @ Patient.meta.profile[0] (line 1, col76) : StructureDefinition reference "http://localhost:8888/WebApplication1/patient_profile.xml" could not be resolved

view this post on Zulip Grahame Grieve (Jun 19 2017 at 12:09):

hm. I don't think I've got around to actually fetching structure definitions yet. can you make a task for me to do that? I'll try and get to it this week

view this post on Zulip Mitul Adhia (Jun 19 2017 at 13:56):

Sure ...

Consider the example given in the link https://www.hl7.org/fhir/validation.html

Is it possible to validate the resource against a profile saved locally on my system ?
In the above mention link the profile definitions are packed in zip file . If i do not change anything inside the profile definition validation of resource goes fine .But in case I do change in the cardinality inside heartrate profile (defined inside profiles-others.xml within definitions.xml.zip) and run the validation still the result is success . Instead I would expect that the validation should report error saying required elements were not found , etc ..in case i change the cardinality in profile and do not pass it in resource .

java -jar validator/org.hl7.fhir.validator.jar observation-example-heart-rate.xml -defn definitions.xml.zip

So my question ares
1) whether local validation of resource against the profiles saved locally are supported or not ?
2) In case if i keep my profile on any test server (locally in tomcat) then whether it is possible to test against that profile .What changes I have to adapt it ?

java -jar validator/org.hl7.fhir.validator.jar patient.xml -profile http://localhost:8888/WebApplication1/patient_profile.xml

Best Regards,
Mitul

view this post on Zulip Grahame Grieve (Jun 21 2017 at 03:13):

should be fixed now in the latest validator from build.fhir.org

view this post on Zulip Mitul Adhia (Jun 21 2017 at 06:27):

Ok will download the validator.zip and re run the scenario ..

So in case if I have profile saved locally will it be possible to test a resource against that ?

view this post on Zulip Grahame Grieve (Jun 21 2017 at 06:27):

yes

view this post on Zulip Grahame Grieve (Jun 21 2017 at 06:28):

-profile {your profile url]

view this post on Zulip Grahame Grieve (Jun 21 2017 at 06:28):

if the profile isn't actually available at it's canonical URL:

view this post on Zulip Grahame Grieve (Jun 21 2017 at 06:28):

-profile [your profile url] @ [the actual location]

view this post on Zulip Grahame Grieve (Jun 21 2017 at 06:28):

actual location can be a file name or a url

view this post on Zulip Mitul Adhia (Jun 21 2017 at 06:29):

If it is file system then C:\test\myprofile.xml ?

view this post on Zulip Grahame Grieve (Jun 21 2017 at 06:29):

yes

view this post on Zulip Mitul Adhia (Jun 21 2017 at 06:31):

Can i test this in json format ?

view this post on Zulip Mitul Adhia (Jun 21 2017 at 07:20):

I tested that but facing issue shown below ..
java -jar validator/org.hl7.fhir.validator.jar observation-example-heart-rate.xml -profile C:/ebooks/FHIR/examples/heart_rate_profile.xml

Exception in thread "main" java.lang.Error: org.hl7.fhir.exceptions.FHIRException: fetching org.hl7.fhir.dstu3.model.StructureDefinition not done yet for URI 'C:/ebooks/FHIR/examples/heart_rate_profile.xml'
at org.hl7.fhir.dstu3.context.SimpleWorkerContext.fetchResource(SimpleWorkerContext.java:378)
at org.hl7.fhir.dstu3.validation.InstanceValidator$ResourceProfiles.addProfile(InstanceValidator.java:238)
at org.hl7.fhir.dstu3.validation.InstanceValidator$ResourceProfiles.addProfiles(InstanceValidator.java:228)
at org.hl7.fhir.dstu3.validation.InstanceValidator.validateResource(InstanceValidator.java:3398)
at org.hl7.fhir.dstu3.validation.InstanceValidator.validate(InstanceValidator.java:532)
at org.hl7.fhir.dstu3.validation.InstanceValidator.validate(InstanceValidator.java:382)
at org.hl7.fhir.dstu3.validation.ValidationEngine.validate(ValidationEngine.java:473)
at org.hl7.fhir.dstu3.validation.ValidationEngine.validate(ValidationEngine.java:401)
at org.hl7.fhir.dstu3.validation.Validator.main(Validator.java:248)
Caused by: org.hl7.fhir.exceptions.FHIRException: fetching org.hl7.fhir.dstu3.model.StructureDefinition not done yet for URI 'C:/ebooks/FHIR/examples/heart_rate_profile.xml'
at org.hl7.fhir.dstu3.context.SimpleWorkerContext.fetchResourceWithException(SimpleWorkerContext.java:448)
at org.hl7.fhir.dstu3.context.SimpleWorkerContext.fetchResource(SimpleWorkerContext.java:376)
... 8 more

view this post on Zulip Grahame Grieve (Jun 21 2017 at 07:21):

what was your command line?

view this post on Zulip Mitul Adhia (Jun 21 2017 at 07:21):

java -jar validator/org.hl7.fhir.validator.jar observation-example-heart-rate.xml -profile C:/ebooks/FHIR/examples/heart_rate_profile.xml

view this post on Zulip Grahame Grieve (Jun 21 2017 at 07:38):

so you need to use the 2nd form:

-profile [url] @ C:/ebooks/FHIR/examples/heart_rate_profile.xml

view this post on Zulip Mitul Adhia (Jun 21 2017 at 08:08):

java -jar org.hl7.fhir.validator.jar observation-example-heart-rate.xml -profile [http://hl7.org/fhir/StructureDefinition/heartrate] @ C:/ebooks/FHIR/examples/heart_rate_profile.xml

view this post on Zulip Mitul Adhia (Jun 21 2017 at 08:09):

Exception in thread "main" java.io.IOException: File @ does not exist
at org.hl7.fhir.dstu3.validation.ValidationEngine.handleSource(ValidationEngine.java:443)
at org.hl7.fhir.dstu3.validation.ValidationEngine.handleSources(ValidationEngine.java:418)
at org.hl7.fhir.dstu3.validation.ValidationEngine.validate(ValidationEngine.java:396)
at org.hl7.fhir.dstu3.validation.Validator.main(Validator.java:248)

view this post on Zulip Mitul Adhia (Jun 21 2017 at 08:45):

Same issue if I run : java -jar org.hl7.fhir.validator.jar observation-example-heart-rate.xml -profile [url] @ C:/ebooks/FHIR/examples/heart_rate_profile.xml

view this post on Zulip Mitul Adhia (Jun 21 2017 at 08:46):

Looks like character @ is used as File location

view this post on Zulip Grahame Grieve (Jun 21 2017 at 08:50):

i don't understand that

view this post on Zulip Grahame Grieve (Jun 21 2017 at 08:51):

what happens if you don't use the []

view this post on Zulip Mitul Adhia (Jun 21 2017 at 08:55):

After running command without [] same issue as above ..

ava -jar org.hl7.fhir.validator.jar observation-example-heart-rate.xml -profile url @ C:/ebooks/FHIR/examples/heart_rate_profile.xml

view this post on Zulip Craig Finch (Jun 21 2017 at 15:36):

Is the official Java implementation of the FHIR validator a stand-alone tool? Every time I run it, it connects to a server, even though I've downloaded the definition file locally. Here's the command I'm using:

```

$ java -jar validator/org.hl7.fhir.validator.jar my_patient.json -defn definitions.xml.zip
.. load FHIR from definitions.xml.zip
.. connect to tx server @ http://tx.fhir.org/r3


view this post on Zulip Lloyd McKenzie (Jun 21 2017 at 16:53):

The terminology server is used to expand value sets and be able to validate codes. Value sets based on code systems like SNOMED can't necessarily be enumerated, so you need a service to evaluate them. You can explicitly set the terminology server to "na" as a command-line parameter if you want to run stand-alone. However, if you don't have embedded expansions for all of your value sets, you won't be able to validate codes against the value sets that are missing embedded expansions.

view this post on Zulip Craig Finch (Jun 22 2017 at 16:19):

Does the Java app send any or all of my FHIR document to the server, or does it only request validation of codes? I ask because I'm in the United States and subject to HIPAA, which forbids sending protected health information to outside parties. I need to know if I can run the Java validator on "production" FHIR data that may contain actual patient health information.

view this post on Zulip Lloyd McKenzie (Jun 22 2017 at 18:35):

It only validates codes. The only thing going over the wire would be codes, display names, code system URIs and value set URIs (possibly collected together into batches.) That said, it's possible that there could be a leak of information. If an attacker knew someone was visiting a particular clinic and were to monitor (typically non-encrypted) vocabulary look-up calls, it's possible that by combining the calls with known information, additional insights could be gained. @John Moehrke, any thoughts on this?

view this post on Zulip John Moehrke (Jun 22 2017 at 18:49):

If the system works as Lloyd describes, then one could show that this is a properly de-identified dataset. As Lloyd points out, there are some indirect identifiers, specifically in the traffic analysis (where is the request from, and when) which could be coorelated to patient visit. Especially if the service was used in realtime, vs batched with a bulk of the days work. A trick that could be used, but might also invalidate the use as a FHIR validator is 'differential privacy' where noise is added. As I said, if the system works as Lloyd has described. A proper de-identification analysis would do a system inspection to assure it functions as expected. This is not a de-identification tutorial... so specific PIA should be done. See my article and others on De-Identification https://healthcaresecprivacy.blogspot.com/2013/05/de-identification-data-chemistry.html

view this post on Zulip Craig Finch (Jun 22 2017 at 18:52):

Thank you for the detailed response. At this point, I just foresee developers using it by hand during debugging or troubleshooting, so I'm not as concerned about the sort of sophisticated correlation attack that may be possible if it were used to validate "real time" production data.

view this post on Zulip Craig Finch (Jun 22 2017 at 18:56):

I've been experimenting with the Java validator and using http://tx.fhir.org/r3 to validate FHIR. I've noticed differences between them. There are some cases in which the Java validator crashes, but the reference API validates the JSON. In other cases, the Java app complains when the API doesn't. Any suggestions?

view this post on Zulip Lloyd McKenzie (Jun 22 2017 at 18:59):

The other possibility is to set up your own terminology server that you talk to in-house

view this post on Zulip Craig Finch (Jun 22 2017 at 19:43):

@Lloyd McKenzie I would definitely set up my own in-house terminology server if we were going to validate large quantities of messages. Any thoughts about what to do when the reference API server's validation differs from the Java tool?

view this post on Zulip Grahame Grieve (Jun 22 2017 at 20:01):

ask us here

view this post on Zulip Grahame Grieve (Jun 22 2017 at 20:01):

but the java validation is correct. updating the validation running on the server is on my todo list

view this post on Zulip Craig Finch (Jun 22 2017 at 20:16):

Thank you. Next week, I may have some time to put together some JSON examples that are valid JSON and appear to be valid FHIR, but crash the Java tool.

view this post on Zulip Grahame Grieve (Jun 22 2017 at 20:24):

great

view this post on Zulip Grahame Grieve (Jun 22 2017 at 20:24):

I'll add them to the test cases if you contribute them

view this post on Zulip Pranitha Sruthi (Jun 23 2017 at 12:34):

Hi all,when I am trying to validate a profile java -jar validator/org.hl7.fhir.validator.jar diagnosticreport-example.xml -profile @ C:\Users\User\Documents\Forge\CBC_Panel.structuredefinition.xml ,an exception is getting displayed as in the screenshot below

validation-exception.PNG
Please suggest me any solution. Thank you

view this post on Zulip Grahame Grieve (Jun 23 2017 at 21:26):

java can't find your file... a path/current directory issue.

view this post on Zulip Pranitha Sruthi (Jun 27 2017 at 04:23):

@Grahame Grieve Thanks for your response. How can I fix it?

view this post on Zulip suresh sargar (Jun 27 2017 at 05:22):

Where do i find list of all FHIR resources name for STU-3 release? currently i am checking manually one-by one from https://www.hl7.org/fhir/resourcelist.html.

I have generated Java Classes from FHIR XSD, will any generated class help me to get FHIR resources name?

view this post on Zulip Grahame Grieve (Jun 27 2017 at 06:23):

I don't understand what you mean 'get the name'?

view this post on Zulip suresh sargar (Jun 27 2017 at 06:58):

@Grahame Grieve currently i have lookup list where i have to maintain resource name list manually. so i will fetch each resource one-by-one load that class using Reflection API and get the fields.

i want to know if there is any class where i can get list of resource name so that i can avoid lookup dependency and which will be more correct.

view this post on Zulip Grahame Grieve (Jun 27 2017 at 06:59):

what name? the name in the xsd that you generated from?

view this post on Zulip suresh sargar (Jun 27 2017 at 07:01):

Yes ,XSD generates <ResourceName>.java e.g for Patient it's Patient.java and same for all other resources. now if i get list which will have all the names i can iterate through one by one.

view this post on Zulip Grahame Grieve (Jun 27 2017 at 07:25):

well, you could easily generate that list from the xsd too. Or you could generate it from profiles-resources.xml, which is in the downloads from the spec.

view this post on Zulip Grahame Grieve (Jun 27 2017 at 07:25):

or you should just use HAPI - which I highly recommend, since it sounds like you don't have a lot of experience with generating code?

view this post on Zulip Vikas Mittal (Jun 28 2017 at 01:20):

Hi @Grahame Grieve ,
I downloaded the latest FHIR validator today from http://build.fhir.org/downloads.html

But I am getting the following error from that
.
.
.. load FHIR from definitions.xml.zip
.. connect to tx server @ http://tx.fhir.org/r3
Exception in thread "main" java.lang.Error: Missing version.info?
at org.hl7.fhir.r4.validation.ValidationEngine.getVersionFromPack(ValidationEngine.java:210)
at org.hl7.fhir.r4.validation.ValidationEngine.loadDefinitions(ValidationEngine.java:185)
at org.hl7.fhir.r4.validation.ValidationEngine.<init>(ValidationEngine.java:178)
at org.hl7.fhir.r4.validation.Validator.main(Validator.java:249)

.
.
Is it an issue with the validator or i am not using the right command?

view this post on Zulip Anand Mohan Tumuluri (Jun 28 2017 at 15:24):

Use the igpack.zip corresponding to the FHIR version that you are using.

view this post on Zulip Vikas Mittal (Jun 29 2017 at 04:28):

Thanks heaps Anand. I did try that. There were some other issues with that. logged here https://chat.fhir.org/#narrow/near/83314/stream/implementers/topic/Using.20the.20FHIR.20validator

Then i saw a conversation here so thought of trying that
https://chat.fhir.org/#narrow/near/83726/stream/implementers/topic/FHIR.20validation

Then got this issue! :(
https://chat.fhir.org/#narrow/near/84702/stream/implementers/topic/FHIR.20validation

view this post on Zulip Michael van der Zel (Jul 21 2017 at 08:30):

Can instances have a reference to their StructureDefinition, in other words can an instance claim conformance? I understand that it is very useful to validate instances against some profile, instances can be compliant to multiple profiles. I suspect there is a very good reason not to include a reference back to the profile, but I forgot.

view this post on Zulip Vadim Peretokin (Jul 21 2017 at 09:54):

I think you're looking for http://www.hl7.org/fhir/resource-definitions.html#Meta.profile ?

view this post on Zulip Michael van der Zel (Jul 21 2017 at 10:10):

Yes! Now I remember. Wisdom of the crowd.

view this post on Zulip Grahame Grieve (Jul 21 2017 at 10:47):

note that resources can claim to conform to a profile, but that might be a lie. If a server needs resources that conform to a particular profile, it can simply verify that they do, irrespective of what they claim

view this post on Zulip Grahame Grieve (Jul 21 2017 at 10:48):

where making the claim becomes useful is to save processing time, and to find the relevant resources - so making the claim is a denormalization for preformance reasons. That's a perfectly valid thing to do, but often people seem to think there is more to it than that

view this post on Zulip John Moehrke (Jul 21 2017 at 12:03):

Would it be a use of Provenance? That is a server that has validated the profiles, can make a Provenance statement? This has not been modeled, but wouldn't take much to do... if it is useful

view this post on Zulip Grahame Grieve (Jul 25 2017 at 07:50):

actually, that could be useful. Do you want to knock up an example?

view this post on Zulip John Moehrke (Jul 25 2017 at 14:16):

create a GF task... :-)

view this post on Zulip John Silva (Jul 25 2017 at 14:54):

Hi, I'm new to this FHIR chat so sorry if this question has already been asked.

In another stream I asked about experience with the Newtonsoft's JSchema JSON validator. Is the discussion here about FHIR JSON schema validation or something else? If you have experience with FHIR JSON schema validation can you take a look at the topic I started titled "FHIR JSON Schema Validation"?
Thanks in advance,
John

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:14):

I download the offical FHIR Validator (validator.zip) from http://build.fhir.org/downloads.html

The readme within the zip file references
- Class org.hl7.fhir.tools.validator.Validator
which does not exist within the jar.

Does anyone know if there is updated readme or is there other instructions for use published that I could access?

view this post on Zulip Grahame Grieve (May 22 2018 at 19:20):

I just downloaded it, and it says org.hl7.fhir.r4.validation.ValidationEngine which is correct

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:21):

From: http://build.fhir.org/validator.zip

view this post on Zulip Grahame Grieve (May 22 2018 at 19:22):

yes that's where I got it from

view this post on Zulip Grahame Grieve (May 22 2018 at 19:22):

ah it's the /? command, not the readme

view this post on Zulip Grahame Grieve (May 22 2018 at 19:22):

should say org.hl7.fhir.r4.validation.ValidationEngine

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:23):

Ok thanks

view this post on Zulip Grahame Grieve (May 22 2018 at 19:24):

fixed - will take about 45min to be posted

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:25):

Thanks Again!

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:36):

Will there be a new Jar in the zip you uploaded. I am not finding a validation engine in the jar I downloaded a few minutes ago.

view this post on Zulip Grahame Grieve (May 22 2018 at 19:39):

I'm pretty sure it's there. how are you looking for it?

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:41):

from within intellij - the it did not resolve I opened the zip with 7-zip

view this post on Zulip Grahame Grieve (May 22 2018 at 19:42):

and what did you see in 7-zip?

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:42):

Directory org.hl7.fhir.r4.validation exists but no classes

view this post on Zulip Grahame Grieve (May 22 2018 at 19:43):

I see org.hl7.fhir.validator.jar\org\hl7\fhir\r4\validation\InstanceValidator.class

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:43):

let me delete what I have and get a fresh download

view this post on Zulip Joyce Dunlop (May 22 2018 at 19:48):

I see it in the jar now - thanks

view this post on Zulip Grahame Grieve (May 22 2018 at 19:49):

great

view this post on Zulip Joyce Dunlop (May 23 2018 at 17:21):

Is there an igpack.zip file for us core profiles? I found the validation.pack and format specific definitions, but neither of these work with the validation jar.

view this post on Zulip Eric Haas (May 23 2018 at 17:46):

last time I used the validator I used it as follows:

java -jar {path}/validator/org.hl7.fhir.validator.jar {file to be validated} -defn{path/igpack.zip -ig {path}/output/validator.pack

There is no igpack.zip produced from the IG, that is from the FHIR specification: Download Link

view this post on Zulip Grahame Grieve (May 23 2018 at 18:07):

you should now do this:

java -jar {path}/validator/org.hl7.fhir.validator.jar {file to be validated} -defn -hl7.fhir.core-3.0.1 -ig hl7.fhir.us.core-1.01

view this post on Zulip Grahame Grieve (May 23 2018 at 18:07):

the packages are [url]/package.tgz

view this post on Zulip Grahame Grieve (May 23 2018 at 18:07):

the validation.pack was specifically designed for the validator, so it should work, but we are migrating to package.tgz now

view this post on Zulip Joyce Dunlop (May 23 2018 at 18:24):

Eric's version executed but did not provide the validation I expected. Grahame, I got an exception without the -defn igpack.zip when I added it back I got the following Error.txt .

view this post on Zulip Joyce Dunlop (May 23 2018 at 18:50):

Two more attempts
pasted image

view this post on Zulip Grahame Grieve (May 23 2018 at 23:03):

ok I just started a build - it will complete in about 20min - download and try again then

view this post on Zulip Michael Lawley (May 24 2018 at 02:37):

Is there any change the validator will be made available via Maven?

view this post on Zulip Grahame Grieve (May 24 2018 at 03:00):

yes, there's a non zero chance. What it actually is depends on whether someone wants to volunteer to help out making it happen

view this post on Zulip Michael Lawley (May 24 2018 at 03:24):

Happy to help :-) Just need to know where / how to start

view this post on Zulip Michael Lawley (May 24 2018 at 03:25):

  • I have experience in doing this for other projects, but not building the validator

view this post on Zulip Grahame Grieve (May 24 2018 at 04:55):

well, the validator is already built by a travis project, and posted to build.fhir.org. The question is, is a maven release done everytime, or is that something done manually.

view this post on Zulip Michael Lawley (May 24 2018 at 05:46):

Is Maven Central the target, or is there an HL7 / other maven repository to use?

view this post on Zulip Grahame Grieve (May 24 2018 at 05:59):

I don't think we have any standard

view this post on Zulip Grahame Grieve (May 24 2018 at 05:59):

@Josh Mandel or @Bryn Rhodes may have an opinion

view this post on Zulip Joyce Dunlop (May 24 2018 at 14:20):

Good Morning - I got the new zip - thanks you - Here are two more attempts. I had cut/copied hl7.fhir.us.core-1.01 from earlier then tried it with hl7.fhir.us.core-1.0.1 neither seem to resolve. pasted image

view this post on Zulip Thomas Johansen (May 24 2018 at 17:43):

What is the difference between the Validator you release and discuss here and the one in the frameworks? I.g Hapi FHIR

view this post on Zulip Grahame Grieve (May 24 2018 at 17:58):

it's the same code base. HAPI generally releases a lot later than the validator, which is trunk.

view this post on Zulip Bryn Rhodes (May 24 2018 at 21:48):

@Grahame Grieve , @Michael Lawley we've done this for the UCUM validator, happy to do it for the validator as well. For the UCUM validator, we publish it to Maven Central under org.fhir. Would this be the same target?

view this post on Zulip Grahame Grieve (May 24 2018 at 22:32):

I guess so.

view this post on Zulip Michael Lawley (May 24 2018 at 22:32):

I would have expected org.hl7.fhir since that matches the internal package naming, but I'll defer to FHIR chiefs :)

view this post on Zulip Grahame Grieve (May 24 2018 at 22:32):

trouble for me is, I don't know how to push the ucum stuff, but that's pretty stable. The validator, on the other hand, we turn stuff around on that ASAP

view this post on Zulip Grahame Grieve (May 24 2018 at 22:33):

well, I did rename the ucum package for that, so the ucum package is consistent. I'm not renaming the validator code

view this post on Zulip Michael Lawley (May 24 2018 at 22:33):

I don't think it needs to match

view this post on Zulip Bryn Rhodes (May 24 2018 at 22:45):

There's a target in the mvn build that publishes, but there's also a manual step involving logging into the Sonatype repository. We could automate that step, but there's some research/development there.

view this post on Zulip Bryn Rhodes (May 24 2018 at 22:45):

And just like the UCUM stuff, the validator would need to be broken out into it's own project.

view this post on Zulip Grahame Grieve (May 24 2018 at 22:46):

define 'own project'

view this post on Zulip Grahame Grieve (May 24 2018 at 22:46):

but: I think I want to release the validator manually. probably

view this post on Zulip Grahame Grieve (May 24 2018 at 22:46):

not automatically as part of the build? not sure - no one has commented about that bit

view this post on Zulip Bryn Rhodes (May 24 2018 at 22:47):

That's why it's the default for publishing with sonatype, so there's a manual gate on that final push to publication.

view this post on Zulip Bryn Rhodes (May 24 2018 at 22:48):

By 'own project', I just mean that it needs to have be able to build with it's own (preferably mvn, but could be gradle) project.

view this post on Zulip Grahame Grieve (May 24 2018 at 22:48):

well, it includes all the run time relevant parts of the build. So sure, why not

view this post on Zulip Bryn Rhodes (May 24 2018 at 22:49):

Can you point me to the code?

view this post on Zulip Grahame Grieve (May 24 2018 at 22:51):

in the build, the following folders:
- implementations\java\org.hl7.fhir.convertors
- implementations\java\org.hl7.fhir.dstu2
- implementations\java\org.hl7.fhir.dstu2016may
- implementations\java\org.hl7.fhir.dstu3
- implementations\java\org.hl7.fhir.r4
- implementations\java\org.hl7.fhir.rdf
- implementations\java\org.hl7.fhir.utilities
- implementations\java\org.hl7.fhir.validation

view this post on Zulip Michael Lawley (May 24 2018 at 22:58):

Why wouldn't you want it published automatically?
There are separate repositories for snapshot and stable builds

view this post on Zulip Grahame Grieve (May 24 2018 at 22:59):

I'm not sure what the pros and cons are

view this post on Zulip Michael Lawley (May 24 2018 at 22:59):

FWIW I use the following maven build plugin in one of my projects:

        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.7</version>
          <extensions>true</extensions>
          <configuration>
            <serverId>ossrh</serverId>
            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
            <autoReleaseAfterClose>true</autoReleaseAfterClose>
          </configuration>
        </plugin>

view this post on Zulip Anand Mohan Tumuluri (May 25 2018 at 00:03):

We use the below script to automate cloning of RI from github, reorganize sources into the structure expected by Maven, set versions, etc

#!/usr/bin/env bash
git clone https://github.com/hl7-fhir/fhir-svn
cd fhir-svn/implementations/java
export VERSION=$1-`git rev-parse --short HEAD`
for f in `ls -bd org.*`; do
    pushd $f/src
    rm -r ../../../../../fhirtoolkit/${f//org.hl7.fhir./}/src
    find . -type f -not -name "*.java" -exec ditto "{}" ../../../../../fhirtoolkit/${f//org.hl7.fhir./}/src/main/resources/"{}" \;
    find . -type f -name "*.java" -exec ditto "{}" ../../../../../fhirtoolkit/${f//org.hl7.fhir./}/src/main/java/"{}" \;
    popd
    pushd ../../../fhirtoolkit/${f//org.hl7.fhir./}/src/main/java
    for t in `grep -l -R --include=*.java "org.junit" *`; do
        ditto $t ../../test/java/$t;
        if [[ $t =~ ValidationEngineTests.java$ ]]; then
            echo "Not removing ValidationEngineTests.java from sources"
        else
            rm -f $t
        fi
    done
    popd
done
cd ../../../
rm -rf fhir-svn
cd  fhirtoolkit
mvn versions:set -DnewVersion=${VERSION}

So far, the script served us well and I only have to ignore RoundTripTests to have a successful build after running this script.

view this post on Zulip Anand Mohan Tumuluri (May 25 2018 at 00:04):

But if someone could publish RI's artifacts to Maven Central, that would be seriously awesome.

view this post on Zulip Grahame Grieve (May 25 2018 at 00:04):

well, we usually say that HAPI is the way this is done - you should use the code in HAPI

view this post on Zulip Anand Mohan Tumuluri (May 25 2018 at 00:13):

The last time (early last year) I needed profile validation, HAPI did not have the validation capabilities that were there in RI like validating cardinality rules in extensions, etc. I know that it has improved now but its still considerable effort to move from RI's IWorkerContext to HAPI's ValidationSupport. Till then, we are married to RI.

view this post on Zulip Grahame Grieve (May 25 2018 at 00:14):

umm, they are the same code

view this post on Zulip Anand Mohan Tumuluri (May 25 2018 at 00:15):

it's the same code base. HAPI generally releases a lot later than the validator, which is trunk.

That was exactly my problem

view this post on Zulip Grahame Grieve (May 25 2018 at 00:16):

so is it up to date now?

view this post on Zulip Grahame Grieve (May 25 2018 at 00:28):

@James Agnew do we have any policy about turn around times?

view this post on Zulip James Agnew (May 25 2018 at 00:55):

HAPI FHIR releases on a predictable 2 month cycle. The current stable version (3.3.0) was released in late March and contains the latest RI validator from that time. The next release (3.4.0) will happen within the next few days and will have the latest version as of the day we release. So bottom line we're never more than 2 months behind.

view this post on Zulip Michael Lawley (May 25 2018 at 03:33):

@James Agnew ValidationEngine doesn't seem to be present in 3.3.0? Although it was in 3.2.0 I believe, but was non-functional.

view this post on Zulip James Agnew (May 25 2018 at 12:02):

That was deliberately removed as I didn't see any use case for keeping it in the HAPI FHIR JARs. Do you have one?

view this post on Zulip Michael Lawley (May 28 2018 at 10:36):

Oops, I had forgotten that it had been neutered. Our real need is for mechanism that allows delegation of TX operations to an external service. This is what the reference implementation ValidationEngine offers. Unfortunately this is not what FhirInstanceValidator offers; it only delegates a very small amount of work to the supplied IValidationSupport instance, with a lot of work being captured by HapiWorkerContext and the private inner class WorkerContextWrapper

view this post on Zulip Michael Lawley (May 28 2018 at 22:07):

@James Agnew naturally we think being able to externalise terminology capability is a very useful thing. Are there any key design issues we should be aware of that block this functionality from being brought in from the RI code?

view this post on Zulip James Agnew (May 29 2018 at 10:05):

@Michael Lawley I'm definitely very supportive of expanding IValidationSupport and/or moving logic out of HapiWorkerContext if that's what it takes to allow for externalized terminology services. That kind of use case was exactly the intended design, and I would have thought it would already be possible although I'm sure I'm missing some nuance of what's happenining inside HapiValidationSupport.

view this post on Zulip Michael Lawley (May 30 2018 at 23:14):

@James Agnew great news - I'm now digging further into these APIs after looking at how ValidateCommand is implemented. Will let you know how this goes.

view this post on Zulip Dave Carlson (May 31 2018 at 14:32):

(deleted)

view this post on Zulip Joyce Dunlop (May 31 2018 at 15:41):

@Grahame Grieve The org.hl7.fhir.validator.jar seems to have an old FhirVersionEnum - I can not select R4. Is this something you can update and republish? Is there a source jar for the org.hl7.fhir.validator.jar that I could reference to save time from decompiling the classes.

view this post on Zulip Joyce Dunlop (May 31 2018 at 16:42):

Anyone know what the canonical url is for us core to supply to validator -profile parameter? http://hl7.org/fhir/us/core did not work.
pasted image

view this post on Zulip Eric Haas (May 31 2018 at 18:28):

try this:

1) download the latest validator from the current build.

java -jar ${path1}/validator/org.hl7.fhir.validator.jar ${path2}${file to validated} -defn hl7.fhir.core-3.0.1 -ig hl7.fhir.us.core-1.0.1

where the ${} is a variable that you supply.

view this post on Zulip Eric Haas (May 31 2018 at 18:30):

hl7.fhir.core-3.0.1 and hl7.fhir.us.core-1.0.1 are the package file names that GG was talking about above..

here is a list of some package names

├── hl7.fhir.core-3.0.1
├── hl7.fhir.core-current
├── hl7.fhir.us.core-1.0.1
├── hl7.fhir.us.core-1.1.0
├── hl7.fhir.us.core-current

view this post on Zulip Joyce Dunlop (May 31 2018 at 19:02):

I have the validator working until I tried to add the -profile to validate against. It was my understanding -ig would make the profile resources available to the validator and the -profile would work as an alternative to resource.meta.profile to determine which profile to validate the resource against.

view this post on Zulip Eric Haas (May 31 2018 at 19:36):

Sorry for not answering the question...

java -jar ${path1}/validator/org.hl7.fhir.validator.jar ${path2}${file to validated} -defn hl7.fhir.core-3.0.1 -ig hl7.fhir.us.core-1.0.1 -profile ${canonical url for profile}

does work...

try this for canonical uri :

"http://hl7.org/fhir/us/core/StructureDefinition/{profile id}|{version}" (note: you need the '"'(double quotes) so bash doesn't get confused)

for example:
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient|1.0.1"

view this post on Zulip Grahame Grieve (May 31 2018 at 20:49):

actually, I don't think that the validator supports the |{version} bit yet

view this post on Zulip Joyce Dunlop (May 31 2018 at 21:16):

Thanks @Eric Haas That worked...a bit disappointed that is has to know the specific patient concept url , instead of just the general profile. I was hoping there would be some magic to interrogate the resouceType of the incoming file. I can get this to work though. Thanks!

view this post on Zulip Grahame Grieve (May 31 2018 at 21:18):

An IG might contain multiple profiles for a specific resource type. Unless the IG says that a profile is global, the validator has no other way know that you intend a particular profile when you reference an IG

view this post on Zulip Joyce Dunlop (May 31 2018 at 21:30):

To be valid US core resource, the incoming resource needs to be validated against any/all of the profile/resourceType specific resources of the IG? So to run this locally in Java I need to determine if there needs to be multiple calls per resourceType?

view this post on Zulip Grahame Grieve (May 31 2018 at 22:04):

well, it depends on the Ig - but if the IG defines multiple profiles for a resource - such as Observation - then you'll have to decide which you are validating against.

view this post on Zulip Joyce Dunlop (Jun 01 2018 at 14:58):

Good Morning,
My understanding of Resource.meta.profile would be used for a resource to claim that it is compliant with a profile. Is there a recommendation on how to tag a resource as compliant or not compliant with a variety of profiles? The data I am validating is not owned by my server just ingested so communicating at the first level - yes/no to compliance but eventually having the resource carry the non-compliance messages would be ideal.
Thanks,
Joyce

view this post on Zulip Grahame Grieve (Jun 01 2018 at 19:53):

you an list multiple profiles. we don't have a way to say that the resource doesn't conform to a profile

view this post on Zulip Grahame Grieve (Jun 04 2018 at 06:11):

so I finally got to this, and wrote some documentation: http://wiki.hl7.org/index.php?title=Using_the_FHIR_Validator

view this post on Zulip Joyce Dunlop (Jun 04 2018 at 19:33):

Thanks @Grahame Grieve Is org.hl7.fhir.validator.jar open source? If so, is there a repo that I can access?
Thanks,
Joyce

view this post on Zulip Grahame Grieve (Jun 04 2018 at 21:52):

yes. it currently lives in the FHIR svn. moving to github is planned but we haven't found time to deal with all the dependency issues. see http://gforge.hl7.org/svn/fhir/trunk

view this post on Zulip Grahame Grieve (Jun 04 2018 at 21:52):

build\implementations\java\org.hl7.fhir.validation


Last updated: Apr 12 2022 at 19:14 UTC