Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location differs for choice elements between ITypedElement adapters on POCO and SourceNode #2642

Closed
ewoutkramer opened this issue Dec 20, 2023 · 5 comments
Assignees

Comments

@ewoutkramer
Copy link
Member

We discovered that TypedElementOnSourceNode and PocoElementNode produce different locations for children that are choice types:

            var p = new Patient
            {
                BirthDate = "1972-11-30",
                Photo = new List<Attachment>() { new Attachment() { ContentType = "text/plain" } },
                Deceased = new FhirDateTime(1972)
            };
            var pocoTypedNode = p.ToTypedElement();

            var json = p.ToJson();
            var sourceNode = FhirJsonNode.Parse(json, settings: new FhirJsonParsingSettings { AllowJsonComments = true, PermissiveParsing = true });
            var sourceTypedNode = sourceNode.ToTypedElement(ModelInfo.ModelInspector);

            var l = pocoTypedNode.Children("deceased").Single().Location; // Patient.deceased[0]
            var l2 = sourceTypedNode.Children("deceased").Single().Location; // Patient.deceasedDateTime[0]

Since the MaskingNode is depending on the Location to do its work, generating a summary using the MaskingNode only works well on POCO-based models but not on SourceNode-based models.

@mmsmits
Copy link
Member

mmsmits commented Feb 29, 2024

This turns out to be by design. Location can differ between implementations.
This also means the masking node will have limited functionality, but we'll leave it at that for now.

@mmsmits mmsmits closed this as completed Feb 29, 2024
@alexzautke
Copy link
Member

@mmsmits Do you propose that we implement some sort of workaround in FS for the original issue?

@mmsmits
Copy link
Member

mmsmits commented Feb 29, 2024

@alexzautke, I did not know this was originally an issue for FS.
Do you have problems now with masking node? Or rely on location in some other way?

@alexzautke
Copy link
Member

@mmsmits The context was lost between Slack and creating the issue. In FS we rely on MaskingNode for the implementation of _elements. In FS the location always comes from a SourceNode. That’s why it currently fails on choice types. See https://firelyteam.slack.com/archives/C011XD1TKL0/p1703004394364199

@mmsmits mmsmits reopened this Mar 25, 2024
@mmsmits
Copy link
Member

mmsmits commented Mar 25, 2024

Reopened by request of the Firely Server team, but not urgent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants