Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Snapshot generation results in incomplete snapshots if differential not based on FHIR base profile #45

Closed
hhund opened this issue Sep 24, 2019 · 3 comments · Fixed by #87 or #109
Assignees
Labels
bug Something isn't working priority high This issue has high priority ready for release Issue is fixed and merged into develop, ready for next release
Milestone

Comments

@hhund
Copy link
Member

hhund commented Sep 24, 2019

Generating snapshots for profiles based on other non FHIR root profiles results in incomplete snapshots. The generateSnapshot method of the org.hl7.fhir.r4.conformance.ProfileUtilities class expects a snapshot StructureDefinition as a base and a differential StructureDefinition as the one to apply to the base.

Side note: This precondition defines an inherent order in which snapshots need to be generated.

Our org.highmed.dsf.fhir.service.SnapshotGeneratorImpl class selects the base profile within the generateSnapshot method (Line 48) by looking up the type property of the differential StructureDefinition, this is wrong and only works if the profile is based on a root FHIR profile.

To fix this, we need to use the baseDefinition property url and lookup the corresponding StructureDefinition snapshot. If we only find a differential StructureDefinition we might want to generate the necessary snapshot for it first (and so on). If we can't find either a differential or a snapshot for the given baseDefinition property url, we can't generate the requested snapshot.

@hhund hhund added the bug Something isn't working label Sep 24, 2019
@wetret wetret added the priority high This issue has high priority label Sep 26, 2019
@hhund hhund self-assigned this Sep 27, 2019
@hhund
Copy link
Member Author

hhund commented Sep 27, 2019

Startet working this issue in branch profile-snapshot-generator-fix. Currently it seams that the HAPI snapshot generator can't work with profile http://highmed.org/fhir/StructureDefinition/highmed-task-request-simple-feasibility) based on profile (http://highmed.org/fhir/StructureDefinition/highmed-task-base) based on the fhir Task profile (http://hl7.org/fhir/StructureDefinition/Task).

@hhund
Copy link
Member Author

hhund commented Sep 27, 2019

Current failing test see 8c65f4e

@hhund
Copy link
Member Author

hhund commented Oct 1, 2019

In the profile-snapshot-generator-fix branch, I reworked the org.highmed.dsf.fhir.service.SnapshotGeneratorImpl
to use the Profile defined in the baseDefinition property as a base while generating the snapshot. A simplified BaseTask / ExtendedTask set of profiles currently fails to generate a snapshot for the ExtendedTask.

Currently it looks like there is a bug (or a missing feature) in org.hl7.fhir.r4.conformance.ProfileUtilities that fails to include differential elements when re-slicing a base profile.

The ExtendedTaskProfilesTest tries to generate a Snapshot for the ExtendedTask profile and fails with:

Error in snapshot generation: Differential for http://highmed.org/fhir/StructureDefinition/ExtendedTask with id: Task.input:extendedInputSlice.type.coding.system has an element that is not marked with a snapshot match
Error in snapshot generation: Differential for http://highmed.org/fhir/StructureDefinition/ExtendedTask with id: Task.input:extendedInputSlice.type.coding.code has an element that is not marked with a snapshot match

@hhund hhund added this to the v0.2.0 milestone Jun 8, 2020
@hhund hhund added ready for release Issue is fixed and merged into develop, ready for next release and removed ready for release Issue is fixed and merged into develop, ready for next release labels Jun 8, 2020
@hhund hhund linked a pull request Jun 24, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working priority high This issue has high priority ready for release Issue is fixed and merged into develop, ready for next release
Projects
None yet
2 participants