Stream: implementers
Topic: Validating a FHIR profile using JSON schema
Pranitha Sruthi (Jun 27 2017 at 04:18):
Hi all, I tried to validate a FHIR profile using JSON schema.json-validation.PNG
I had downloaded JSON schema and pasted in the schema block and also pasted the json data of the profile in the data block. Please correct me if I made any mistake. Also, which is the most reliable method to validate a FHIR profile? Thank you
Igor Sirkovich (Jun 28 2017 at 20:32):
@Pranitha Sruthi , have a look at http://hl7.org/fhir/validation.html
Pranitha Sruthi (Jun 29 2017 at 04:28):
@Igor Sirkovich Is it the right way to validate a profile using JSON schema? I had already gone through the content in the link http://hl7.org/fhir/validation.html.
Igor Sirkovich (Jun 29 2017 at 19:58):
Do you use "https://json-schema-validator.herokuapp.com"? This looks fine to me and it works for the schema & examples downloaded from hl7.org.
Pranitha Sruthi (Jun 30 2017 at 05:10):
@Igor Sirkovich I have used the same to validate and got an exception. Please check the screenshots below.json-validation.PNG . Please suggest me a solution. Thank you
Igor Sirkovich (Jun 30 2017 at 15:22):
Hi Pranitha, I would suggest to try this on a different browser and/or different machine.
Pranitha Sruthi (Jul 03 2017 at 06:32):
Hi @Igor Sirkovich , I will try on another browser. Thank you
Pranitha Sruthi (Aug 28 2017 at 10:41):
Hi, I tried to validate a profile using json schemajsonschema-validation.PNG Is it a valid profile? Thank you
Haseeb (Aug 28 2017 at 10:57):
Hi @Pranitha Sruthi , I have recently gone through learning Profile Validation. What Profile are you using to post the json to?
Haseeb (Aug 28 2017 at 11:02):
@Pranitha Sruthi I have used the java validator, it works for me. Once you unzip the validator folder go to the directory validator directory using command prompt and run >java -jar org.hl7.fhir.validator.jar <XML FILE>
Where <XML FILE> is the location of the structuredefinition of your profile
Pranitha Sruthi (Aug 28 2017 at 12:49):
Hi @Haseeb Thank you so much. I shall work on it.
Pranitha Sruthi (Aug 28 2017 at 12:59):
commandprompt.PNG I got an exception. Can you help me fix it?
Haseeb (Aug 28 2017 at 13:07):
Hi @Pranitha its an IO exception and the validator is not able to locate the file. Can you double check the path of the file.
Pranitha Sruthi (Aug 28 2017 at 13:10):
@Haseeb Yes but it is of no use
Mounika (Aug 30 2017 at 06:57):
Hi all, when I am validating a profile using the FHIR Validator. I got an Exception as shown in the below screenshot. Can anyone Please fix it.
Mounika (Aug 30 2017 at 07:02):
Lloyd McKenzie (Aug 30 2017 at 18:41):
It looks like the validator jar isn't in the folder you're invoking Java from
Mounika (Aug 31 2017 at 04:56):
Thank you @Lloyd McKenzie
Mounika (Aug 31 2017 at 09:37):
I got exeption in commandprompt
Capture1.PNG
Lloyd McKenzie (Aug 31 2017 at 14:12):
@Grahame Grieve ?
Grahame Grieve (Aug 31 2017 at 21:46):
just checked in a fix for this
Tian Lai (Sep 21 2017 at 18:27):
Hi, I'm using both the hapi parser and the validator here http://hl7.org/fhir/validator.zip on page https://www.hl7.org/fhir/validation.html#jar, when validating JSON file of a patient resource that has only one element in the identifier, I guess I ran into a discrepancy. Should this be valid if I put "identifier": {"value": "XXX"} instead of "identifier": ["value": "XXX"]. one element VS. a list with one element.
Tian Lai (Sep 21 2017 at 18:28):
sorry, "identifier":[{"value": "XXX"}]
Tian Lai (Sep 21 2017 at 18:31):
HAPI raise a flag when using "identifier": {"value": "XXX"}, but the official jar passes
Lloyd McKenzie (Sep 21 2017 at 22:01):
Both should raise an issue if both are validating against the same version of the spec and that version says that identifier can repeat.
Tian Lai (Sep 21 2017 at 22:53):
@Lloyd McKenzie According to my understanding of the STU3 spec and the template the official page provided, only "identifier":[{"value": "XXX"}] is correct
Lloyd McKenzie (Sep 21 2017 at 23:09):
What resource?
Tian Lai (Sep 21 2017 at 23:17):
@Lloyd McKenzie identifer is the element that could be in Patient, Practitioner, Location, Organization etc. doesn't really matter which resource it is
Tian Lai (Sep 21 2017 at 23:17):
so, it seems a historical issue
Tian Lai (Sep 21 2017 at 23:17):
https://tapadoo.com/2011/regular-problem-with-xml-to-json-converters/
Lloyd McKenzie (Sep 21 2017 at 23:51):
Oh, you definitely can't use off-the-shelf XML<->JSON converters with FHIR. You'll need to use the reference implementations or write your own.
Lloyd McKenzie (Sep 21 2017 at 23:52):
The cardinality for identifier can be different for different resources. Often it's an array, but not always
Tian Lai (Sep 22 2017 at 00:03):
@Lloyd McKenzie thanks. to be clear, I didn't to any conversion of xml -> json. for the where the cardinality specifies array, I will propose use "identifier":[{"value": "XXX"}] to my team, cuz it seems to match better with spec
Last updated: Apr 12 2022 at 19:14 UTC