Stream: implementers
Topic: FHIR Validator
Larry Shields (Jun 17 2019 at 14:04):
Is the FHIR Validator found here: http://wiki.hl7.org/index.php?title=Using_the_FHIR_Validator open source? If so, can someone point me to the Repo? I checked the HL7 Repo on Github and nothing was jumping out at me. I'm interested in checking out the pieces being used for FHIR Mapping language to do some mapping of different data into FHIR. Thanks
Vadim Peretokin (Jun 17 2019 at 14:16):
Yep, see https://github.com/hapifhir/org.hl7.fhir.core
Larry Shields (Jun 17 2019 at 14:19):
Thanks!
Chidamber Kumar (Feb 21 2020 at 15:31):
A question on FHIR validator :
Does this store any kind of demographic or clinical information at the server end ?
Lloyd McKenzie (Feb 21 2020 at 17:44):
The validator itself points to data that is either passed in or already persisted elsewhere. It doesn't persist any information itself.
Chidamber Kumar (Feb 24 2020 at 13:03):
Thanks @Lloyd McKenzie for confirming that. So do suggest to use validator with real time patient data. I hope there should't be any security concerns ?
Patrick Werner (Feb 24 2020 at 13:13):
The java FHIR validator forwards terminology validations to tx.fhir.org. So this could be a potential security implication. But it is possible to specify its own Terminology Server or to disable the TermServer support.
Ward Weistra (Feb 24 2020 at 13:20):
Just to check: @Chidamber Kumar, you are talking about the command line Java validator, right? Not, for example, a $validate endpoint on a server.
Ward Weistra (Feb 24 2020 at 13:21):
Ah, just answered here: https://chat.fhir.org/#narrow/stream/179160-social/topic/FHIR.20validator
Chidamber Kumar (Feb 24 2020 at 13:36):
Hi @Ward Weistra I am referring to this one http://hl7.org/fhir/validator/.
Chidamber Kumar (Feb 24 2020 at 13:46):
Hi @Patrick Werner , yep got the command to disable it. Thanks for bringing that out :slight_smile:
Lloyd McKenzie (Feb 24 2020 at 15:04):
The validator can also try to retrieve referenced profiles if it can't find them available locally. @Grahame Grieve, is there a flag that disables that?
Grahame Grieve (Feb 24 2020 at 19:02):
not at the moment
Wan Chen (Jun 09 2020 at 19:17):
Hi, I need some help understanding the validation spec http://hl7.org/fhir/resource-operation-validate.html. When mode is unavailable in the URL [base]/[Resource]/[id]/$validate, do we validate against the request body? or should we validate what's in [base]/[Resource]/[id] since id is provided?
Grahame Grieve (Jun 09 2020 at 19:55):
[mode not provided]: The server checks the content of the resource against any schema, constraint rules, and other general terminology rules
Wan Chen (Jun 09 2020 at 20:44):
Thank you Grahame, for your response. What is the purpose of the instance [id] in the $validate POST url? HAPI checks to see if the instance ids match but otherwise does not use the FHIR resource stored on the server. Vonk I believe ignores the id completely, and Grahame, your server is currently down so I can't compare.
Grahame Grieve (Jun 10 2020 at 06:59):
there really is no purpose to the id if there isn't a mode
Grahame Grieve (Jun 10 2020 at 06:59):
I restarted my server
Steven Wang (Jun 17 2020 at 02:32):
Hi All , I try to do validation on my custom definition in HAPI FHIR, I was looking at this page https://hapifhir.io/hapi-fhir/docs/validation/validation_support_modules.html at 10.3.11Recipe: Supplying Custom Definitions, but this example is not clear how to create my own StructureDefinition and ValueSet in HAPI, can someone help me or pointing me an code example?
Steven Wang (Jun 17 2020 at 11:46):
Does anyone knew this error: StructureDefinition.snapshot.element[1].type[0].code - The value provided ("http://hl7.org/fhirpath/System.String") is not in the value set http://hl7.org/fhir/ValueSet/defined-types (http://hl7.org/fhir/ValueSet/defined-types), and a code should come from this value set unless it has no suitable code) (error message = Unknown code 'http://hl7.org/fhirpath/System.String'), I try to validate a patient resource based on structure definition, but got this error.
Lloyd McKenzie (Jun 17 2020 at 15:21):
It sounds like there's a problem with your structure definition. Did you create it yourself or did you get it somewhere? Are you able to attach it?
Grahame Grieve (Jun 17 2020 at 18:03):
also - what version of FHIR is this?
Steven Wang (Jun 17 2020 at 20:16):
@Grahame Grieve I am using HAPI FHIR version 5.0.2, and the FHIR version is r4.
Steven Wang (Jun 17 2020 at 20:17):
@Lloyd McKenzie the structure definition is created by my colleague.
Lloyd McKenzie (Jun 17 2020 at 20:37):
The system "http://hl7.org/fhirpath/System" isn't valid - so if that's appearing in the StructureDefinition, that's the source of your problem
Steven Wang (Jun 17 2020 at 20:47):
Thanks @Lloyd McKenzie , I saw this system value - "http://hl7.org/fhirpath/System.String" also in here: https://www.hl7.org/fhir/us/core/StructureDefinition-us-core-patient.json.html, does that means this system value is outdated? Do you know the correct value?
Grahame Grieve (Jun 17 2020 at 20:48):
it's probably correct. it's a bit hard to say - it depends on context, and you haven't shared that
Steven Wang (Jun 17 2020 at 22:15):
Thanks Grahame, I will double check the structure definition. Cheers.
Andrew Mallon (Jun 27 2020 at 16:57):
Hello, I am trying to use the FHIR validator to validate the FHIR and cannot get the profile to validate, and I am not sure if it is the structure definition that is wrong or I am missing something when running the validator:
Lloyd McKenzie (Jun 27 2020 at 16:59):
@Andrew Mallon can you provide more information about exactly what you're doing? What's the command line when you launch the validator? What unexpected results are you seeing?
Andrew Mallon (Jun 27 2020 at 17:00):
Apologies, hit send by accident
Andrew Mallon (Jun 27 2020 at 17:00):
I downloaded the Validator
I downloaded the Carin-BB validator pack
I downloaded the example JSON file and I am running the validator with these arguments:
java -jar org.hl7.fhir.validator.jar Coverage_Coverage1.json -ig validator
FHIR Validation tool Version 5.0.7-SNAPSHOT (Git# 6bc790d98b04). Built 2020-06-07T08:35:37.25+10:00 (20 days old)
Detected Java version: 11.0.7 from /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home on x86_64 (64bit). 8192MB available
Arguments: Coverage-Coverage1.json -ig validator
Directories: Current = /Users/andrewmallon/Downloads, Package Cache = /Users/andrewmallon/.fhir/packages
.. FHIR Version current, definitions from hl7.fhir.r5.core#current
.. connect to tx server @ http://tx.fhir.org
(vcurrent)
- .. load IG from validator
..Detect format for /Users/andrewmallon/Downloads/validator/version.info
[Fatal Error] :1:1: Content is not allowed in prolog.
..Detect format for /Users/andrewmallon/Downloads/validator/spec.internals
[Fatal Error] :1:1: Content is not allowed in prolog.
.. validate [Coverage-Coverage1.json]
FAILURE validating Coverage-Coverage1.json: error:2 warn:1 info:0
Error @ Coverage.subscriberId (line 31, col31) : This property must be an Object, not a primitive property
Error @ Coverage (line 1, col2) : Profile http://hl7.org/fhir/us/carin/StructureDefinition/carin-bb-coverage, Element 'Coverage.subscriberId': minimum required = 1, but only found 0
Warning @ Coverage.status (line 21, col22) : ValueSet http://hl7.org/fhir/ValueSet/fm-status|4.0.1 not found by validator
According to the Carin standard, ‘subscriberId’ is a string in that profile
Andrew Mallon (Jun 27 2020 at 17:02):
I am not sure why the validator is validating the subscriberId element against the base FHIR profile and can’t find the field in the Carin BB profile
Lloyd McKenzie (Jun 27 2020 at 17:12):
What is the filename of the Carin-BB validator pack? I suspect it's not "validator". (You have to specify the file extension)
Andrew Mallon (Jun 27 2020 at 17:17):
'validator' is the unzipped folder of the validation profile. . I also tried it with the argument -ig validator/StructureDefinition-CARIN-BB-Coverage.json with the same results. I''m going to apologize in advance if it turns out I'm passing in the wrong argument to the validator :)
Andrew Mallon (Jun 27 2020 at 17:19):
The validator pack itself downloaded as "validator.pack"
Lloyd McKenzie (Jun 27 2020 at 17:20):
You want to pass "-ig validator.pack"
Andrew Mallon (Jun 27 2020 at 17:21):
First, thank you for your help on a Saturday. I Just tried that and got the error, Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: Unable to resolve package id validator.pack
at org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager.fetchVersionTheOldWay(FilesystemPackageCacheManager.java:691)
Andrew Mallon (Jun 27 2020 at 17:24):
Ok, downloaded a fresh copy of the file from the Carin-BB web site. Running it with these arguments:
java -jar org.hl7.fhir.validator.jar Coverage-Coverage1.json -ig validator.pack
FHIR Validation tool Version 5.0.7-SNAPSHOT (Git# 6bc790d98b04). Built 2020-06-07T08:35:37.25+10:00 (20 days old)
Detected Java version: 11.0.7 from /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home on x86_64 (64bit). 8192MB available
Arguments: Coverage-Coverage1.json -ig validator.pack
Andrew Mallon (Jun 27 2020 at 17:24):
returned the same error
- .. load IG from validator.pack
.. validate [Coverage-Coverage1.json]
FAILURE validating Coverage-Coverage1.json: error:2 warn:1 info:0
Error @ Coverage.subscriberId (line 31, col31) : This property must be an Object, not a primitive property
Error @ Coverage (line 1, col2) : Profile http://hl7.org/fhir/us/carin/StructureDefinition/carin-bb-coverage, Element 'Coverage.subscriberId': minimum required = 1, but only found 0
Warning @ Coverage.status (line 21, col22) : ValueSet http://hl7.org/fhir/ValueSet/fm-status|4.0.1 not found by validator
Lloyd McKenzie (Jun 27 2020 at 18:29):
Are you specifying "-version 4.0"?
Andrew Mallon (Jun 27 2020 at 19:00):
That corrected the problem. Thank you very much.
Lloyd McKenzie (Jun 27 2020 at 19:21):
np :)
Grahame Grieve (Jun 28 2020 at 01:44):
what in the documentation points you to downloading validator.pack? I'm trying to deprecate that. you should just reference the IG by it's package:
java -jar org.hl7.fhir.validator.jar Coverage_Coverage1.json -ig hl7.fhir.us.carin-bb#0.1.0
Grahame Grieve (Jun 28 2020 at 01:45):
ah. http://hl7.org/fhir/us/carin-bb/2020Feb/downloads.html.
Andrew Mallon (Jun 29 2020 at 13:37):
Grahame Grieve said:
Yep, that's the link. Basically, I downloaded the validator pack from there and then basically tried to infer what arguments I needed to run the validator. Thank you for the help regarding using the package name. I am still a little unsure of how I would determine the package name for a given profile. It doesn't seem to be in theCarin documentation, at least from skimming the web site you linked to.
Lloyd McKenzie (Jun 29 2020 at 14:09):
The package name is for the IG, not a profile - it'll be the same for all profiles coming from the IG (or inherited by the IG)
Josh Lamb (Sep 08 2020 at 13:18):
Hello,
I am getting errors while trying to validate an ExplanationOfBenefit resource using the latest FHIR Validator. I receive this error with using both the base version of the IG and the CARIN BB IG.
When I populate ExplanationOfBenefit.Item.locationcodeableconcept the validator throws errors and does not generate any validation messages.
Here is an XML snip of the location[x] value that is causing issues:
<item>
<sequence value="1" />
<productOrService>
<coding>
<system value="http://www.ama-assn.org/go/cpt" />
<code value="somecode" />
</coding>
</productOrService>
<servicedDate value="2019-11-22" />
<locationCodeableConcept>
<coding>
<system value="http://hl7.org/fhir/us/carin-bb/ValueSet/CMSPlaceOfService" />
<code value="20" />
</coding>
<text value="URGENT CARE FACILITY" />
</locationCodeableConcept>
Here is the error i get when i run the Validator:
Validating
Validate ...Bundle1.xmlValidation Infrastructure fail validating ...Bundle1.xml: null
Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: java.lang.NullPointerException
at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:1294)
at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:66)
at org.hl7.fhir.validation.Validator.main(Validator.java:212)
Caused by: java.lang.NullPointerException
at org.hl7.fhir.utilities.cache.PackageClient.exists(PackageClient.java:89)
at org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager.packageExists(FilesystemPackageCacheManager.java:870)
at org.hl7.fhir.validation.ValidationEngine.packageExists(ValidationEngine.java:2394) .......
Lloyd McKenzie (Sep 08 2020 at 13:33):
@Grahame Grieve
Grahame Grieve (Sep 08 2020 at 13:34):
can you provide the full instance you are validating (can send it to me directly) and what your validator commands are please
Josh Lamb (Sep 08 2020 at 13:48):
Thanks for taking a look. I sent you a private message @Grahame Grieve
Nathan Hall (Nov 03 2020 at 16:05):
shout out to @John Ravan for publishing this Swagger UI on top of HAPI FHIR validator https://github.com/jtravan3/hapi-fhir-validator-api
easy to set up (docker or maven) and saves countless hours with teams trying to validate their fhir resources.
Ravishankar P (Jan 17 2022 at 11:54):
How to implement FHIR Resource validator using Spring boot ? can i get some reference ?
Kuldeep S (Jan 17 2022 at 15:18):
have a look at https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator, you can wrap the validator jar. Also look at https://github.com/inferno-framework/fhir-validator-wrapper
Last updated: Apr 12 2022 at 19:14 UTC