FHIR Chat · Validator : cannot resolve canonical URL · tooling

Stream: tooling

Topic: Validator : cannot resolve canonical URL


view this post on Zulip Frédéric Laurent (Jun 06 2021 at 09:55):

I made a very simple profile (Patient) and I want to validate a ressource against it.
The profile has this URL : https://opikanoba.org/fhir/structuresefinition/opik-test-patient
The URL is OK, and the structure definition available

And the sample json

{
    "resourceType": "Patient",
    "meta": {
    "profile": [
      "https://opikanoba.org/fhir/structuredefinition/opik-test-patient"
      ]
    },
    "name":  [
        {
            "use": "official",
            "family": "MANDELBROT"
        },
    ],
    "telecom":  [
        {
            "system": "phone",
            "value": "(01) 5555 4444",
            "use": "work"
        },
    ],
    "gender": "male",
    "birthDate": "1924-11-20",
    "deceasedBoolean": true
}

With the validator_cli.jar, the validation is not made, and the output displays :

  Information @ Patient.meta.profile[0] (line 6, col8) : Canonical URL 'https://opikanoba.org/fhir/structuredefinition/opik-test-patient'
does not resolve
  Warning @ Patient.meta.profile[0] (line 1, col2) : Profile reference 'https://opikanoba.org/fhir/structuredefinition/opik-test-patient'
has not been checked because it is unknown, and fetching it resulted in the error The URL 'https://opikanoba.org/fhir/structuredefinition/opik-test-patient'
is not known to the FHIR validator, and has not been provided as part of the setup / parameters

So I set the -profile parameter, but:

java -jar validator_cli.jar test_patient.json -profile https://opikanoba.org/fhir/structuredefinition/opik-test-patient
An error occurs
  Validate test_patient.jsonException in thread "main" java.lang.Error: Unable to resolve profile https://opikanoba.org/fhir/structuredefinition/opik-test-patient
    at org.hl7.fhir.validation.ValidationEngine.asSdList(ValidationEngine.java:299)

What am I missing ?

view this post on Zulip Morten Ernebjerg (Jun 06 2021 at 10:25):

Did you use the -ig parameter to point the validator to the directory containing the profile (StructureDefinition file)? Otherwise, the validator cannot find it. Conversely, if you declare the profile in meta.profile in the Patient resource, it should trigger validation against that profile in the validator, even without passing the -profile parameter.

view this post on Zulip Frédéric Laurent (Jun 06 2021 at 21:00):

I didn't make an IG. I wanted to start with the validation against a simple profile. The validator don't get my StructureDefinition even if I declare it in meta.profile because it is unknown (output of the validator-cli). That's why I thought that I could explicitly set it with the -profile parameter.
But both don't work.

view this post on Zulip Grahame Grieve (Jun 07 2021 at 00:37):

you have to tell the validator where to find and load your profile - that's what the -ig parameter is for (it also loads any kind of profile etc you point it at). Once you do that, the validation should work

view this post on Zulip Frédéric Laurent (Jun 07 2021 at 19:58):

OK, I made an IG description file to reference the profile, then by setting -ig and -profile parameters, the validation can be done. Thanks.

view this post on Zulip Grahame Grieve (Jun 07 2021 at 19:59):

you don't need the IG description file

view this post on Zulip Frédéric Laurent (Jun 07 2021 at 20:09):

ok right, only the directory structure with the local profile file, and it works. thanks


Last updated: Apr 12 2022 at 19:14 UTC