-
Notifications
You must be signed in to change notification settings - Fork 67
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
Observations not being updated when new data arrives #184
Comments
dustinburson
added a commit
that referenced
this issue
Apr 15, 2022
- Defect was due to using two different references to the same object for the change comparison. - Updated CodeValueFhirTemplateProcessor.MergeObservation to perform a DeepCopy of the passed in Observation parameter. The copy is what is returned now by the function to ensure modifications are made to a new instance. - Moved the logic to set the status of the Observation from the MergeObservation function to the R4FhirImportService.SaveObservationAsync logic. Without the move, the first time a created observation is "updated" will always result in the FHIR resource being saved even if nothing else changed because we were always setting the status to amended. - Updated unit tests to account for new logic. - Added extension methods for some common scenarios * Rename FhirClientValidator to FhirClientValidatorExtensions to match other extension class names * Rename ServiceCollectionExtrensions to FhirClientExtensions to match purpose. * Merge content of HttpClientBuilderRegistraionExtensions into FhirClientExtensions. * Remove registering ITelemetryLogger singleton with FhirClient. ITelemetryLogger is resolved from the service provider now. This was preventing local debugging with the Azure Function. * Update AddAuthenticationHandler to use the registered singletons for the auth service instead of creating new instances.
rogordon01
pushed a commit
that referenced
this issue
Apr 18, 2022
* * Address issue #184, observations not being updated when changed. - Defect was due to using two different references to the same object for the change comparison. - Updated CodeValueFhirTemplateProcessor.MergeObservation to perform a DeepCopy of the passed in Observation parameter. The copy is what is returned now by the function to ensure modifications are made to a new instance. - Moved the logic to set the status of the Observation from the MergeObservation function to the R4FhirImportService.SaveObservationAsync logic. Without the move, the first time a created observation is "updated" will always result in the FHIR resource being saved even if nothing else changed because we were always setting the status to amended. - Updated unit tests to account for new logic. - Added extension methods for some common scenarios * Rename FhirClientValidator to FhirClientValidatorExtensions to match other extension class names * Rename ServiceCollectionExtrensions to FhirClientExtensions to match purpose. * Merge content of HttpClientBuilderRegistraionExtensions into FhirClientExtensions. * Remove registering ITelemetryLogger singleton with FhirClient. ITelemetryLogger is resolved from the service provider now. This was preventing local debugging with the Azure Function. * Update AddAuthenticationHandler to use the registered singletons for the auth service instead of creating new instances. * Prior update that changed the FHIR Client lost the isVersionAware parameter. Update the FHIR Service UpdateResourceAsync to automatically set the ifMatchVersion if one isn't already specified and the resource being updated has a version set (i.e. not new). * Fix comment typo
Issue resolved with #185 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#161 introduced a defect where the updates don't occur when they should. Instead they are mistakenly treated as unchanged and the update is skipped.
The problem is due to mergedObservation and existingObservation being the same object. When existingObservation is passed to MergeObservation internally the same operation reference is modified. The return object is identical, so the subsequent check,
if (mergedObservation.IsExactly(existingObservation))
always evaluates to true and the update is skipped.The text was updated successfully, but these errors were encountered: