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

Add correlation id as option for grouping measurements #47

Merged
merged 13 commits into from
Jun 18, 2020

Conversation

dustinburson
Copy link
Member

Add an optional correlation id for grouping measurements to create observations in FHIR.
When a template is set to the new ObservationPeriodInterval = CorrelationId all measurements for a given device, type, and correlation id will share the same observation in FHIR. This overrides the traditional time based grouping like hourly or daily.

In order to use the feature the device messages need to supply a correlation id that is then extracted with the via the CorrelationIdExpression property added to the Json & Iot templates.

… query property of ARM templates

* Add ability to extract correlation id to JsonPathContentTemplate
* Add tests for extraction logic
…ationIdNotDefinedException with id not set

* Add CorrelationIdNotDefinedException to telemetry processor as a known non-recoverable error.
* Add unit tests for new observation groups and observation group factories.
Copy link

@ms-puneet-nagpal ms-puneet-nagpal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the Configuration document with information on correlationId.

…at includes data to be created and information about the existing observation.
* Add ability to update the period of observation if the merged values our outside the current period.
* Add unit tests for observation period update scenario.
…d period when merging data. Old period will now be used and tests updated.

* Updated SampledDataFhirValueProcessor to use values from existing observation when merging sample data.  Tests updated.

public TimePeriodMeasurementObservationGroup((DateTime Start, DateTime End) boundary)
{
_bondary = boundary;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a null check here?

Copy link
Member Author

@dustinburson dustinburson Jun 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is a value type, can never be null. The implicit tuple syntax i.e. ( , ) is compiled as a struct.

correlationId = GetCorrelationId(token);
EnsureArg.IsNotNull(correlationId, nameof(correlationId));
}

var measurement = new Measurement
{
DeviceId = deviceId,
OccurrenceTimeUtc = timestamp.Value,
Type = TypeName,
PatientId = GetPatientId(token),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we treat PatientId and EncounterId the same as CorrelationId? Where if there is an expression defined we require the value in the message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was something I considered but it would change existing behavior. Right now the values will be normalized and then generate specific errors in the FHIR conversion side that will be logged in App Insights.

…ead of data period during create to future proof. Right now they would always be the same.

* Fix issue in SampledDataProcessor were the last value was omitted from the stream if it was on the end boundary.  Never hit before because the hourly and daily time periods would end on the time boundary - 1 ms.
@dustinburson
Copy link
Member Author

Please update the Configuration document with information on correlationId.

Added documentation.

@dustinburson dustinburson reopened this Jun 18, 2020
@dustinburson dustinburson merged commit 4e29aa7 into master Jun 18, 2020
@dustinburson dustinburson deleted the personal/duburson/add-correlation-id branch January 6, 2021 01:25
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

Successfully merging this pull request may close these issues.

5 participants