Obtain list of dependencies for a given validation resource like a StructureDefinition, ValueSet etc.?

93 Views Asked by At

Profile packages list their dependencies in the form of packages and their versions, but the dependency graph derived from that information is not always sufficient for configuring a validation context. Better analysis could be done if the dependencies were available at the level of individual resources; this would make it possible to identify conflicts/contradictions and missing resources that cannot be uncovered by package-level analysis (but which might wreak havoc under the hood).

Is there a way to obtain a list of dependencies for some particular validation resource like e.g. a StructureDefinition pulled from a package file?

Validators have to do that internally in the normal course of their work in any case, but I cannot see a way of getting that information out. Can it be done with the HAPI or Firely libraries? If not, is there some other way of getting that information?

3

There are 3 best solutions below

1
Lloyd McKenzie On

There's a new IG (http://build.fhir.org/ig/HL7/crmi-ig/) that's proposing an operation that would gather all dependencies. However, it's not fully baked, and to my knowledge, not yet implemented anywhere.

4
Ewout Kramer On

Validators have to do that internally in the normal course of their work in any case

Yes, indeed "during the normal course of their work", so the .NET validator does this at runtime ("go fetch profile X and validate it") - but there is no static analysis done here. It would always be incomplete, by the way, since extensions can introduce references to profiles not known until you hit an instance with that extension.

Maybe Gino's code generator (https://github.com/microsoft/fhir-codegen) has the information, is does a full load of profiles before it starts running its code generators.

4
Grahame Grieve On

Validators have to do that internally in the normal course of their work in any case

That's not quite something that they do. What they do is resolve specific links as they encounter them based on the data that they are validating. That's not the same thing.