Stream: implementers
Topic: C# code for validating resources against StructureDefinition
Jon-Vidar Schneider (Sep 15 2016 at 10:27):
We are implementing several FHIR services and need to validate "incoming" messages against the structure definitions that our services follows. We've looked for source code implementations for this but haven't found any C# prosjects that we can use. Do you know about any open source projects that implement this functionality?
We have tried using the suggested java-app for this, but that comes up with some exception:
C:\Temp\java>java -Djava.net.useSystemProxies=true -jar org.hl7.fhir.validator.jar commrequest.xml -defn validation.zip -profile structinfo.xml test.xml
.. load definitions from validation.zip
.. connect to terminology server http://fhir2.healthintersections.com.au/open
.. load profile structinfo.xml
.. load commrequest.xml
.. validate (xml)
Exception in thread "main" java.lang.NullPointerException
at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:106)
at org.hl7.fhir.utilities.Utilities.saxonTransform(Utilities.java:292)
at org.hl7.fhir.dstu2.validation.ValidationEngine.processXml(ValidationEngine.java:176)
at org.hl7.fhir.dstu2.validation.ValidationEngine.process(ValidationEngine.java:127)
at org.hl7.fhir.dstu2.validation.Validator.process(Validator.java:198)
at org.hl7.fhir.dstu2.validation.Validator.main(Validator.java:120)
Grahame Grieve (Sep 15 2016 at 10:51):
can you send me the xml so I can check why it's giving an npe?
Gaute Brakstad (Sep 15 2016 at 11:00):
Think https://www.nuget.org/packages/Hl7.Fhir.Specification.DSTU2/0.90.5 got some buildtin validation of resources.
Jon-Vidar Schneider (Sep 15 2016 at 11:06):
I tried using DotNetAttributeValidation.TryValidate(patient, somereturnlist,false), it only verifies that attributes are valid. Couldn't find anything related to validating against profiles.
Jon-Vidar Schneider (Sep 15 2016 at 11:22):
commrequest.xml structinfo.xml
Ewout Kramer (Sep 15 2016 at 11:22):
Hi all, we are currently expanding the Hl7.Fhir.Specification assembly to have full profile validation functionality. If you look in the ft-validator branche in Github you can see the work progressing. I expect to have it ready around oct 1st.
Jon-Vidar Schneider (Sep 15 2016 at 11:25):
Thankyou, @Ewout Kramer :) We can wait with the implementation until then.
Richard Kavanagh (Sep 15 2016 at 12:33):
That's useful @Ewout Kramer looking forwards to that :-)
Grahame Grieve (Sep 15 2016 at 13:18):
With regard to the java validator , it worked fine for me. I ran it with these parameters:
java -jar [jar] c:\temp\validation\commrequest.xml -defn C:\work\org.hl7.fhir.dstu2\build\publish\validation.xml.zip -folder C:\temp\validation -profile http://hl7.no/StructureDefinition/hnCommunicationRequest
Ewout Kramer (Sep 15 2016 at 13:20):
And thanks to you too, @Richard Kavanagh ;-)
Jon-Vidar Schneider (Sep 15 2016 at 23:10):
We probably used some wrong validation-files. Will try again tomorrow. (Was not sure where to download them from)
Jon-Vidar Schneider (Sep 16 2016 at 07:39):
Got it working when I finally found the correct validation.xml.zip.
Brian Postlethwaite (Sep 16 2016 at 22:10):
The current alpha 7 does have validation that checks the invariant constraints, but still has further to go for the other profile stuff (which @Ewout Kramer is working on)
Last updated: Apr 12 2022 at 19:14 UTC