When I do the following...
java -Xmx2g -jar validator_cli.jar Patient-example.json -version 4.0.1 -ig hl7.fhir.us.core
I wouldn't expect any errors, but receive the following:
mark@redacted:~/Downloads$ java -Xmx2g -jar validator_cli.jar Patient-example.json -version 4.0.1 -ig hl7.fhir.us.core
FHIR Validation tool Version 5.6.21 (Git# 0394b96b1431). Built 2021-12-28T17:45:36.935Z (7 days old)
Java: 11.0.11 from /usr/lib/jvm/java-11-openjdk-amd64 on amd64 (64bit). 2048MB available
Paths: Current = /home/mark/Downloads, Package Cache = /home/mark/.fhir/packages
Params: Patient-example.json -version 4.0.1 -ig hl7.fhir.us.core
Loading
Load FHIR v4.0 from hl7.fhir.r4.core#4.0.1 - 4575 resources (00:05.0094)
Load hl7.terminology#3.0.0 - 3795 resources (00:01.0305)
Terminology server http://tx.fhir.org - Version 2.0.10 (00:01.0777)
Load hl7.fhir.uv.bulkdata#2.0.0 - 6 resources (00:00.0188)
Load hl7.fhir.uv.smart-app-launch#2.0.0 - 0 resources (00:00.0007)
Load us.nlm.vsac#0.3.0 - 8916 resources (00:01.0314)
Load hl7.fhir.uv.sdc#2.7.0 - 60 resources (00:00.0014)
Load hl7.fhir.us.core#4.1.0 - 177 resources (00:00.0022)
Get set... go (00:00.0873)
Validating
Validate Patient-example.json ..Detect format for Patient-example.json
00:26.0837
Done. Times: Loading: 00:10.0951, validation: 00:26.0838. Memory = 1Gb
*FAILURE*: 9 errors, 0 warnings, 8 notes
Error @ Patient.extension[0].extension[0].value.ofType(Coding) (line 29, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#2106-3) is not in the value set http://hl7.org/fhir/us/core/ValueSet/omb-race-category, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/omb-race-category)
Error @ Patient.extension[0].extension[1].value.ofType(Coding) (line 37, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#1002-5) is not in the value set http://hl7.org/fhir/us/core/ValueSet/omb-race-category, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/omb-race-category)
Error @ Patient.extension[0].extension[2].value.ofType(Coding) (line 45, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#2028-9) is not in the value set http://hl7.org/fhir/us/core/ValueSet/omb-race-category, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/omb-race-category)
Error @ Patient.extension[0].extension[3].value.ofType(Coding) (line 53, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#1586-7) is not in the value set http://hl7.org/fhir/us/core/ValueSet/detailed-race, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/detailed-race)
Error @ Patient.extension[0].extension[4].value.ofType(Coding) (line 61, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#2036-2) is not in the value set http://hl7.org/fhir/us/core/ValueSet/detailed-race, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/detailed-race)
Error @ Patient.extension[1].extension[0].value.ofType(Coding) (line 78, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#2135-2) is not in the value set http://hl7.org/fhir/us/core/ValueSet/omb-ethnicity-category, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/omb-ethnicity-category)
Error @ Patient.extension[1].extension[1].value.ofType(Coding) (line 86, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#2184-0) is not in the value set http://hl7.org/fhir/us/core/ValueSet/detailed-ethnicity, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/detailed-ethnicity)
Error @ Patient.extension[1].extension[2].value.ofType(Coding) (line 94, col57): The Coding provided (urn:oid:2.16.840.1.113883.6.238#2148-5) is not in the value set http://hl7.org/fhir/us/core/ValueSet/detailed-ethnicity, and a code is required from this value set. (error message = Not in value set http://hl7.org/fhir/us/core/ValueSet/detailed-ethnicity)
Error @ Patient.extension[2].value.ofType(code) (line 109, col6): The value provided ('F') is not in the value set 'Birth Sex' (http://hl7.org/fhir/us/core/ValueSet/birthsex), and a code is required from this value set) (error message = Error from server: Unable to find value set http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1021.103)
Information @ Patient.extension[0].extension[0].value.ofType(Coding) (line 29, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[0].extension[1].value.ofType(Coding) (line 37, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[0].extension[2].value.ofType(Coding) (line 45, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[0].extension[3].value.ofType(Coding) (line 53, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[0].extension[4].value.ofType(Coding) (line 61, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[1].extension[0].value.ofType(Coding) (line 78, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[1].extension[1].value.ofType(Coding) (line 86, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
Information @ Patient.extension[1].extension[2].value.ofType(Coding) (line 94, col57): Code System URI 'urn:oid:2.16.840.1.113883.6.238' is unknown so the code cannot be validated
mark@redacted:~/Downloads$
This doesn't make sense to me, as the specified systems & codes are valid. Is there something else I need to do to in order to properly validate US Core extensions?
One additional detail that may or may not be relevant is that my script containing this command was working until I cleared my ~/.fhir
cache dir, perhaps for the first time in years. The only significant difference I happened to notice in the validator's output is that the terminology version loaded changed from 2.0.0
to 3.0.0
.
The problem is that the validator is picking up a pre-release package (4.1.0) to validate against, not the formal release which is 4.0.0. And there's some problem with the way 4.1.0 defines the race category.
You can fix this by specifying the version of US core to validate against:
java -Xmx2g -jar validator_cli.jar Patient-example.json -version 4.0.1 -ig hl7.fhir.us.core#4.0.0
for further discussion about what's going on under the hood (which is counter-intuitive), see https://chat.fhir.org/#narrow/stream/179177-conformance/topic/Package.20Access.20Issue