hapifhir / org.hl7.fhir.core

Apache License 2.0
156 stars 162 forks source link

CLI Validator | Resolving of external profile urls not working #1559

Closed sebastianhelbig closed 9 months ago

sebastianhelbig commented 10 months ago

The resolving of external (not supplied by an IG) profiles is not working for me.

Simple example: I download the following ressource example: https://simplifier.net/bfarm/example-diga-healthapp

java -jar validator_cli.jar Example-DiGA-HealthApp.xml -version 4.0.1 -debug -locale en-US -language en

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/Users/sh/Developer/Validierungspaket-MIO-DiGA-Toolkit/validator_cli.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
FHIR Validation tool Version 6.2.15 (Git# 0bb2010409ad). Built 2024-01-30T11:13:28.136Z (18 hours old)
  Java:   11.0.21 from /usr/local/Cellar/openjdk@11/11.0.21/libexec/openjdk.jdk/Contents/Home on x86_64 (64bit). 8192MB available
  Paths:  Current = /Users/sh/Developer/Validierungspaket-MIO-DiGA-Toolkit, Package Cache = /Users/sh/.fhir/packages
  Params: Example-DiGA-HealthApp.xml -version 4.0.1 -debug -locale en-US -language en
  Locale: Deutschland/DE
  Jurisdiction: Germany
Loading
  Load FHIR v4.0 from hl7.fhir.r4.core#4.0.1 - 4576 resources (00:05.538)
  Load hl7.fhir.uv.extensions.r4#1.0.0 - 1328 resources (00:01.694)
  Load hl7.terminology#5.4.0 - 4202 resources (00:01.831)
  Load hl7.terminology.r5#5.0.0 - 4174 resources (00:01.209)
  Load hl7.fhir.uv.extensions#1.0.0 - 1328 resources (00:01.211)
  Terminology server http://tx.fhir.org - Version Connected to Terminology Server at http://tx.fhir.org (00:01.021)
  Package Summary: [hl7.fhir.r4.core#4.0.1, hl7.fhir.xver-extensions#0.1.0, hl7.fhir.uv.extensions.r4#1.0.0, hl7.terminology#5.4.0, hl7.terminology.r5#5.0.0, hl7.fhir.uv.extensions#1.0.0]
  Get set... Generating snapshot for http://hl7.org/fhir/StructureDefinition/string|4.0.1
 go (00:00.264)
Validating
  Validate Example-DiGA-HealthApp.xml
Validate DeviceDefinition against http://hl7.org/fhir/StructureDefinition/DeviceDefinition|4.0.1..........20..........40..........60..........80.........|
Validate DeviceDefinition against https://fhir.bfarm.de/StructureDefinition/HealthApp|
 00:01.805
Done. Times: Loading: 00:12.929, validation: 00:01.806. Memory = 757Mb

*FAILURE*: 4 errors, 1 warnings, 1 notes
  Error @ DeviceDefinition (line 1, col47): StructureDefinition hat keinen Snapshot - die Validierung erfolgt gegen den Snapshot, daher muss dieser bereitgestellt werden
  Error @ DeviceDefinition.extension[0] (line 9, col77): Die extension https://fhir.bfarm.de/StructureDefinition/HealthAppMedia ist nicht bekannt, and hier nicht erlaubt
  Error @ DeviceDefinition.extension[1] (line 16, col87): Die extension https://fhir.bfarm.de/StructureDefinition/HealthAppNutzungshinweis ist nicht bekannt, and hier nicht erlaubt
  Error @ DeviceDefinition.extension[2] (line 24, col81): Die extension https://fhir.bfarm.de/StructureDefinition/HealthAppSummaries ist nicht bekannt, and hier nicht erlaubt
  Information @ DeviceDefinition.meta.profile[0] (line 7, col76): Canonical URL 'https://fhir.bfarm.de/StructureDefinition/HealthApp' kann nicht aufgelöst werden
  Warning @ DeviceDefinition (line 1, col47): Constraint failed: dom-6: 'A resource should have narrative for robust management' (defined in http://hl7.org/fhir/StructureDefinition/DomainResource) (Best Practice Recommendation)
Done. Times: Loading: 00:12.929, validation: 00:01.806. Max Memory = 8Gb

I can see on the webserver that https://fhir.bfarm.de/StructureDefinition/HealthApp is fetched by the validator. I tested with returning the profile as fhir+json and fhir+xml. Right now it will serve based on the given accept header and redirect to simplifier for text/html with supplying fhir+xml as the default.

grahamegrieve commented 9 months ago

I don't believe that there's any documentation to say that it should work like this. I don't believe that this is true either:

I can see on the webserver that https://fhir.bfarm.de/StructureDefinition/HealthApp is fetched by the validator.

it it's true, I can't see why. The intent is that you nominate the profiles to fetch using the -ig parameter e.g. -ig https://fhir.bfarm.de/StructureDefinition/HealthAppMedia. There's a bug that means that won't work, but will start working from the next release

sebastianhelbig commented 9 months ago

Nevermind. It is working, I just didn't notice that the error message had changed. The profile urls should point to snapshots of the profiles and validation works fine. (of course without the need to supply the -ig param).