microsoft/Tools-for-Health-Data-Anonymization

Update version of firely SDK for R4 standard

christopher-watanabe-snkeos opened this issue · 2 comments

Hi all,

I've just noticed that the version used for the FHIR R4 standard is relatively old, version 3.4.0 released nearly a year ago. I'm wondering if it would be beneficial to look into updating this version? Since release, quite a few issues have been closed, so it might be beneficial to update this.

An initial check I've run is to update the version to the most recent v.4.0.0 and running the R4.Core.UnitTests and R4.Core.FunctionalTests tests. The following tests fail:

  1. Several AttributeValidatorTests in the R4.Core.UnitTests fail due to updated firely error messages.
  2. GivenAStu3OnlyResource_WhenAnonymizing_ExceptionShouldBeThrown(testFile: "Stu3OnlyResource/ProcessResponse.json", ResourceName: "ProcessResponse") fails due to a failure to throw an exception. I assume the Firely SDK now handles the previous situation that caused an exception.
  3. GivenAStu3OnlyResource_WhenAnonymizing_ExceptionShouldBeThrown(testFile: "Stu3OnlyResource/ProcessRequest.json", ResourceName: "ProcessRequest") fails due to a failure to throw an exception. I assume the Firely SDK now handles the previous situation that caused an exception.

The test failure due to changed error messages is a relatively quick fix. The GivenAStu3OnlyResource_WhenAnonymizing_ExceptionShouldBeThrown failures would have to be research to understand how the Stu3OnlyResource is handled in the updated firely SDK.

What do you think? If this is a benefit, I could create a PR for it. Seems like relatively little work to get the latest/greatest.

Just an update: after looking further into it, the trickier of the failing unit tests is 2. and 3. in the list of failing tests in my original post. It seems that no exceptions are thrown on type casting the Stu3 resources ProcessResponse and ProcessRequest when parsing the json to TypedElement within the AnonymizeJson method of the AnonymizerEngine.

I don't know how this can be, as the R4 standard continues to not contain definitions for these resources, as far as I can tell. Interestingly, the test passes for the DeviceComponent.json file, meaning that the library cannot parse this json into an appropriate class object. Perhaps in the newest release, definitions for these resources have somehow landed in the R4 standard, when technically they are not defined. I'll continue to look into this, but any help or suggestions would be appreciated!

Further Update:

I've asked the firely devs in the git repo about this topic. Hopefully there will be an answer sooner than later!

FirelyTeam/firely-net-sdk#2147