Stream: implementers
Topic: FHIR Resources Validation
Radharani Sonnathi (May 26 2020 at 14:36):
Hi I am relatively new to FHIR and and now working on a project to do FHIR resources validation. This is for DSTU3 and using HAPI FHIR Validator 4.2.0 . I have couple of questions
1) How to validate snomed ,rxnorm codes and any other external codes to see that codes in our fhir response json are valid?
2) Secondly I am testing patient resource and it has extensions for Race and Ethnicity. I did add structuredefinitions, valuesets to the validator and ran the program. It is throwing NullPointerException
Exception in thread "main" java.lang.NullPointerException
at org.hl7.fhir.r5.model.Element.getExtensionString(Element.java:419)
at org.hl7.fhir.r5.model.ElementDefinition$TypeRefComponent.getWorkingCode(ElementDefinition.java:2285)
at org.hl7.fhir.r5.validation.InstanceValidator.checkChild(InstanceValidator.java:4390)
at org.hl7.fhir.r5.validation.InstanceValidator.validateElement(InstanceValidator.java:4376)
at org.hl7.fhir.r5.validation.InstanceValidator.checkExtension(InstanceValidator.java:1627)
at org.hl7.fhir.r5.validation.InstanceValidator.checkChild(InstanceValidator.java:4495)
at org.hl7.fhir.r5.validation.InstanceValidator.validateElement(InstanceValidator.java:4376)
at org.hl7.fhir.r5.validation.InstanceValidator.start(InstanceValidator.java:3287)
at org.hl7.fhir.r5.validation.InstanceValidator.validateResource(InstanceValidator.java:5047)
at org.hl7.fhir.r5.validation.InstanceValidator.validate(InstanceValidator.java:851)
at org.hl7.fhir.r5.validation.InstanceValidator.validate(InstanceValidator.java:684)
at org.hl7.fhir.common.hapi.validation.ValidatorWrapper.validate(ValidatorWrapper.java:141)
at org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator.validate(FhirInstanceValidator.java:288)
at org.hl7.fhir.dstu3.hapi.validation.BaseValidatorBridge.doValidate(BaseValidatorBridge.java:20)
at org.hl7.fhir.dstu3.hapi.validation.BaseValidatorBridge.validateResource(BaseValidatorBridge.java:43)
at org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator.validateResource(FhirInstanceValidator.java:59)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:245)
at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:200)
at com.ecw.fhir.validator.ValidatorTest.main(ValidatorTest.java:171)
I am using R3 but it is using object from R5. My sample json for extension is
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
}
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
}
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
"valueCoding": {
"code": "M"
}
}
]
While debugging my observation is org.hl7.fhir.r5.model.Element.getExtensionString(..) gets called with "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type" and it returns null. Seems like this is happening while validating "urn:oid:2.16.840.1.113883.6.238".
Thanks in advance and any guidance is appreciated. Thanks.
Lloyd McKenzie (May 26 2020 at 15:32):
- You'll need to ensure that when you launch the validator, it points to a terminology server that has access to the terminologies you need. (The default HL7 one should have most SNOMED CT partitions as well as RxNorm
- You should not be defining extensions for US-Core extensions - just point to the U.S. Core IG as a dependency. (The validator uses R5 internally, regardless of what version of the spec is being used, so the references to R5 are expected.)
Radharani Sonnathi (May 26 2020 at 15:44):
@Lloyd McKenzie thanks a lot for your quick response.
1) Terminology server is that something do I need to configure in my code?
2) Should not be defining extensions for US-Core extensions, you meant in my json response? I am using all US Core profiles.
Lloyd McKenzie (May 26 2020 at 15:46):
- The validator takes a parameter indicating what terminology server to use. I generally use it from commandline, but you should be able to set the configuration in code too
- The validator should be pointing to the US Core profiles and extensions as they're defined in the official IG - you shouldn't be defining them yourself.
Radharani Sonnathi (May 26 2020 at 15:52):
@Lloyd McKenzie
1)That is what I don't know what terminology server to use.
2) is it possible for you to provide a sample Patient Json please? Thanks.
Lloyd McKenzie (May 26 2020 at 16:09):
- tx.fhir.org should support both SNOMED and RxNorm
- There are lots of example Patient json files in the core spec, and there are some in the US Core IG as well. Do you need something other than those?
Last updated: Apr 12 2022 at 19:14 UTC