FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
830 stars 344 forks source link

[snapshot generator] Diff validates, snapshot does not. Why? #1227

Closed furoreSebastiaan closed 4 years ago

furoreSebastiaan commented 4 years ago

gdPerson.zip

We're encountering an issue with the snapshot generator. The differential is validated, but the snapshot is not.

we're using the 1.4 version of the validator / snapshot generator

Considerations:

  1. When removing the FregMetaData extension, the snapshot validates properly.
  2. When we make a snapshot of that extension (FregMetaData), this validates too.
  3. When adding the extension to another Person StructureDefinition (MyPerson), there are no issues.
  4. giving my MyPerson the same BaseDefinition does not result in an invalid SD.

conclusion: something in de GdPerson SD is causing the extension to build up inproperly. But I have no idea why.. Could you help us out?

MatthijsvdWielen commented 4 years ago

Test profling folder R4 - GitHub issue 1227.zip

The initial path is not reproducible due to version changes and package dependencies. The files in the attached zip provide a reproducible path.

This seems to be similar to issue #1153. The issue occurs only with the profiles in the attached zip, this is due to an error with the extension in the slice for addressConfidentiality.extension:

image

The culprit could be Forge that does something strange in the diff with this extension.

It only happens with this profile, other R4 profiles that we tested did not provide the errors. Could Forge do something strange with putting and extension in the right place when it's in a slice?

Alternatively the snapshot generator on Simplifier could do something strange that causes the errors while validating the snapshot.

marcovisserFurore commented 4 years ago

I investigated this, and it is still a problem. What did I do?

So I can conclude that the error is in the snapshot generator of the fhir-net-api, not in Forge or other tools. I will try to simplify the structuredefinition to pinpoint to problem. Then I create an unittest and then solve to problem. My feeling is that it somewhere has to do with the reslicing of meta.security.

marcovisserFurore commented 4 years ago

After a long resource, I've found out that the element order of the differential is not correct. The differential looks like this:

This is not correct and it should be:

Then the SnapshotGenerator will function correctly.

The differential is made by Forge so I have created an issue for Forge: https://firely.atlassian.net/browse/FOR-468

Because it is not a bug of the fhir-net-api, I will close this issue and we have to wait till the issue has been solved for Forge.