Can validate argonaut profile in fhir validator jar?

Hi ,
I am validating my argonaut profile medication JSON using below command and getting below error. Please help me.

java -jar validator_cli.jar medication.json -version 1.0.2 -profile #url/StructureDefinition/argo-medication -tx n/a

Error:
HIR Validation tool Version 5.3.8 (Git# 282188388860). Built 2021-04-01T18:57:27.206Z (264 days old)
Java: 1.8.0_202 from C:\Program Files\Java\jre1.8.0_202 on amd64 (64bit). 2608MB available
Paths: Current = D:\16_04_backup\Documents\postman\fhir validator, Package Cache = C:\Users\MPHRX.fhir\packages
Params: medication.json -version 1.0.2 -profile http://fhir.org/guides/argonaut/StructureDefinition/argo-medication -tx n/a
Loading
No such cached session exists for session id null, re-instantiating validator.
Load FHIR v1.0 from hl7.fhir.r2.core#1.0.2Creating Package manager?

  • 3378 resources (00:06.0696)
    Load hl7.terminology#3.0.0 - 3795 resources (00:02.0440)
    Terminology server null - Version n/a: No Terminology Server (00:00.0000)
    Get set… go (00:01.0044)
    Fetch Profile from StructureDefinition/argo-medication
    Exception in thread “main” org.hl7.fhir.exceptions.FHIRException: Unable to find definitions at URL ‘#url/StructureDefinition/argo-medication’: #url/StructureDefinition/argo-medication?nocache=1640178366619
    at org.hl7.fhir.validation.cli.utils.ProfileLoader.loadProfileFromUrl(ProfileLoader.java:33)
    at org.hl7.fhir.validation.cli.utils.ProfileLoader.loadProfileSource(ProfileLoader.java:18)
    at org.hl7.fhir.validation.ValidationEngine.loadProfile(ValidationEngine.java:279)
    at org.hl7.fhir.validation.ValidatorCli.doValidation(ValidatorCli.java:229)
    at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:158)
    Caused by: java.io.FileNotFoundException: #url/StructureDefinition/argo-medication?nocache=1640178366619
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at org.hl7.fhir.validation.cli.utils.ProfileLoader.loadProfileFromUrl(ProfileLoader.java:31)
    … 4 more

#URL ==http://fhir.org/guides/argonaut

If you want to validate using a profile, you have to pass in the IG (or IGs) relevant using the “-ig” parameter. There’s a full set of instructions on using the validator here: Using the FHIR Validator - FHIR - Confluence

1 Like

Thanks lloyd , but now error is changed.

Query : java -jar validator_cli.jar $file -ig fhir.argonaut.r2#1.0.0 -profile http://fhir.org/guides/argonaut/StructureDefinition/argo-procedure -tx n/a

FHIR Validation tool Version 5.3.8 (Git# 282188388860). Built 2021-04-01T18:57:27.206Z (265 days old)
Java: 1.8.0_202 from C:\Program Files\Java\jre1.8.0_202 on amd64 (64bit). 2608MB available
Paths: Current = D:\16_04_backup\Documents\postman\fhir validator, Package Cache = C:\Users\MPHRX.fhir\packages
Params: response.json -ig fhir.argonaut.r2#1.0.0 -profile http://fhir.org/guides/argonaut/StructureDefinition/argo-procedure -tx n/a
Scanning for versions (no -version parameter):
Package fhir.argonaut.r2#1.0.0: 1.0
→ use version 1.0
Loading
No such cached session exists for session id null, re-instantiating validator.
Load FHIR v1.0 from hl7.fhir.r2.core#1.0.2Creating Package manager?

  • 3378 resources (00:06.0654)
    Load hl7.terminology#3.0.0 - 3795 resources (00:02.0648)
    Terminology server null - Version n/a: No Terminology Server (00:00.0000)
    Load fhir.argonaut.r2#1.0.0Exception in thread “main” java.lang.IllegalStateException: Not a JSON Object: null
    at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:91)
    at org.hl7.fhir.dstu2.formats.JsonParser.parseValueSetValueSetComposeComponent(JsonParser.java:10835)
    at org.hl7.fhir.dstu2.formats.JsonParser.parseValueSet(JsonParser.java:10718)
    at org.hl7.fhir.dstu2.formats.JsonParser.parseResource(JsonParser.java:11276)
    at org.hl7.fhir.dstu2.formats.JsonParserBase.parse(JsonParserBase.java:121)
    at org.hl7.fhir.convertors.loaders.R2ToR5Loader.loadBundle(R2ToR5Loader.java:77)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.loadFromFileJson(SimpleWorkerContext.java:353)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.loadDefinitionItem(SimpleWorkerContext.java:281)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.loadFromPackageInt(SimpleWorkerContext.java:443)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.loadFromPackage(SimpleWorkerContext.java:385)
    at org.hl7.fhir.validation.IgLoader.loadIg(IgLoader.java:83)
    at org.hl7.fhir.validation.cli.services.ValidationService.initializeValidator(ValidationService.java:228)
    at org.hl7.fhir.validation.cli.services.ValidationService.initializeValidator(ValidationService.java:208)
    at org.hl7.fhir.validation.ValidatorCli.doValidation(ValidatorCli.java:202)
    at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:158)

oh. well, no one has tested that for a while :frowning:

It’ll be fixed next release - probably a day or two after christmas

1 Like

Thanks, Now it’s working when I am using canonical instead of Id