firely-net-sdk icon indicating copy to clipboard operation
firely-net-sdk copied to clipboard

Unable to parse JSON from Epic App Orchard FHIR server because of 64 character ID limit.

Open jonfleming opened this issue 3 years ago • 13 comments

Is your feature request related to a problem? Please describe. When using Hl7.Fhir with Epic App Orchard we are getting FhirJsonParser errors because some of the FHIR IDs from Epic are longer than 64 characters. it appears to happen for multiple resource types (Patient, Conditions, and Observations).

Describe the solution you'd like We understand that the validation is generated from the FHIR specification and that specification says IDs are limited to 64 characters but we would like a way to override this behavior.

Describe alternatives you've considered We have modified the source code to allow IDs up to 70 characters and the solution is working for our Epic App Orchard clients but we are concerned about maintaining our changes as new versions of the package are released.

jonfleming avatar Nov 24 '21 19:11 jonfleming

I have reached out to Epic to confirm this and ask them what's going on. - they'll run into trouble with other clients too.

ewoutkramer avatar Nov 25 '21 08:11 ewoutkramer

For now, there's nothing you can do - as you've noted it's simply illegal what they are doing, so I never thought about making that variable in the parser. I have a solution in the making for the next major .NET SDK release, but that's still a while off.

ewoutkramer avatar Nov 25 '21 08:11 ewoutkramer

The gentle people at Epic have responded: here's the long running discussion on this: https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Epic.20has.20IDs.20that.20are.20more.20than.2064.20characters

ultimately, yes currently our algorithm that generates FHIR ids that can be mapped to distinct resources/odb concepts can generate ids that are longer than 64 characters. We're actively looking at redesigning how this mapping works, to try to avoid this for many, but not all resources, but the fix is only under design now, so it will be probably 18 months +/- before it's widely deployed.

ewoutkramer avatar Nov 29 '21 15:11 ewoutkramer

It seems then, that there is no other work around for the coming 2 years than disabling this check.

ewoutkramer avatar Nov 29 '21 15:11 ewoutkramer

@marcovisserFurore @mmsmits - what's your opinion?

ewoutkramer avatar Nov 29 '21 15:11 ewoutkramer

Hmmm I agree, that we have to disable this check then. Although we are making this more flexible in the 4.0 release anyway right? But @jonfleming and other might need this asap. So maybe we should consider this to be released with 3.7.

mmsmits avatar Nov 29 '21 15:11 mmsmits

I think it's a bad thing that we deviate from the standard. On the other hand, users must be able to parse data. In version 4.0 we are a little more flexible and we can handle this better. For version 3.x we could disable this check, but I would prefer to make it configurable

marcovisserFurore avatar Nov 30 '21 08:11 marcovisserFurore

+1 for making it configurable, and that the check is enabled by default

kennethmyhra avatar Nov 30 '21 08:11 kennethmyhra

And then we should call it "EpicOrchardCompatibilityMode" I guess, so we are nicely explicit and can also add additional issues with Epic if we would encounter them.

ewoutkramer avatar Nov 30 '21 08:11 ewoutkramer

Will this be 3.6 or 3.7? We're finalizing 3.6, so I guess 3.7?

ewoutkramer avatar Nov 30 '21 09:11 ewoutkramer

Well definitely not 3.6 because it is already released :) We're about to release 3.7, so if it's really easy to implement I could still add it to 3.7

marcovisserFurore avatar Nov 30 '21 09:11 marcovisserFurore

Off-by-one error ;-)

ewoutkramer avatar Nov 30 '21 10:11 ewoutkramer

@jonfleming can you give us an example of a resource where the parsing fails?

I've create the following test and that succeeds in STU3 and R4:

        [Fact]
        public void JsonIds()
        {
            var settings = new ParserSettings
            {
                PermissiveParsing = false
            };
            var parser = new FhirJsonParser(settings);
            var input = $"{{\"resourceType\": \"Patient\",\"id\": \"{new string('x', 300)}\" }}";
            var patient = parser.Parse<Patient>(input);
            patient.Id.Length.Should().Be(300);
        }

In this case the id of the patient has a length of 300.

marcovisserFurore avatar Nov 30 '21 11:11 marcovisserFurore

The new FHIR client can handle all of this neatly now: https://docs.fire.ly/projects/Firely-NET-SDK/en/latest/client/setup.html#selecting-a-serializer

ewoutkramer avatar Dec 04 '23 14:12 ewoutkramer