FirelyTeam / firely-validator-api

Firely's official FHIR validator API for validating HL7 FHIR resources against profiles.
Other
8 stars 2 forks source link

Performance issue caused by references when validating a big bundle #334

Closed darena-antonw closed 1 month ago

darena-antonw commented 3 months ago

Hello, wanted to report a performance issue

the containing bundle contains ~8000 observation resources that we'd like to insert as part of a batch operation

validating this bundle takes over a minute.

I've done some investigation and basically the gist is:

all of this happens for each entry for each reference, so by the end this logic runs more than x10 million times...

Anything you can suggest as a short term solution or a way to disable this?

Also (I didn't dig far enough) why is the validator trying to find the referenced resource? what will it do with it when it finds it?

sample.json

var fileStream = File.OpenRead("sample.json");
var bundle = await JsonSerializer.DeserializeAsync<Bundle>(fileStream, new JsonSerializerOptions().ForFhir());
var result = validator.Validate(bundle);
mmsmits commented 1 month ago

MIght have to be improved in ScopedNode

mmsmits commented 1 month ago

Timeboxed for 4 hours for research

Kasdejong commented 1 month ago

Findings:

Proposed actions:

Kasdejong commented 1 month ago

Closed in favour of https://github.com/FirelyTeam/firely-net-sdk/issues/2846. We will address this properly in SDK 6