FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
824 stars 342 forks source link

Snapshot generator does not expand complex extensions defined in a an extension. #2799

Closed Rob5045 closed 1 week ago

Rob5045 commented 3 months ago

The bug was originally submitted to Forge: https://firely.atlassian.net/browse/FOR-872

The project to reproduce the issue is attached. The issue is for file: NLLArticleInfoCorrect.xml.

The snapshot generator method Generate returns 2 of the same errors:

https://electronichealth.se/fhir/StructureDefinition/NLLArticleInfo2 (Element Extension.extension.extension has neither a type nor a nameReference.)

They correspond to the extension element definitions for currentProductName and history. These two element definitions are not expanded.

swedishnationalmedicationlist(5).zip

mmsmits commented 2 months ago

Don't spend more than 2 days researching what's going on here

mmsmits commented 1 month ago

@MatthijsvdWielen You've had a call about this with @alexzautke , what was the conclusion ?

MatthijsvdWielen commented 1 month ago

@mmsmits that call did not solve the issue unfortunately.

The customer provided some additional information. In version 23 everything was still working and from version 24 the issue started. https://simplifier.net/SwedishNationalMedicationList/NLLMedication/~history

mmsmits commented 1 week ago

I found out the problem. It's not the snapshot generator. But the order of the ElementDefinitions in the differential.

I attached the correct file here: NLLArticleInfoCorrect.txt

Please note that the order of the elements in a Differential matter a lot. And Extension.extension comes before Extension.url and Extension.value[x].

I don't if Forge created this (I think not), but the user should be informed.

mmsmits commented 1 week ago

See unit test for this here as well: https://github.com/FirelyTeam/firely-net-sdk/pull/2877/files