-
Notifications
You must be signed in to change notification settings - Fork 54
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 test date to Observation.issued for single-entry and bulk upload #5982
Conversation
* also force time zones to make fhir converter easier to test * also fix rounding of test date to start of day * using system default time zone for now but should look into what time zone to infer for dates in bulk upload
backend/src/main/java/gov/cdc/usds/simplereport/api/converter/FhirConverter.java
Outdated
Show resolved
Hide resolved
.setEffective(new DateTimeType(dateTested)) | ||
.setEffective( | ||
new DateTimeType( | ||
dateTested, TemporalPrecisionEnum.MILLI, TimeZone.getTimeZone("utc"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above comment - this just forces the messages to look the same when run on systems with different default precision/time zone
@@ -309,6 +321,9 @@ private Bundle convertRowToFhirBundle(TestResultRow row, UUID orgId) { | |||
.testkitNameId(testKitNameId) | |||
.equipmentUid(equipmentUid) | |||
.deviceModel(row.getEquipmentModelName().getValue()) | |||
.issued( | |||
Date.from( | |||
testResultDate.atZone(zoneIdGenerator.getSystemZoneId()).toInstant())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this on the other hand uses the system default time zone to infer the time zone for text date time in the CSV (e.g. 06/14/23 12:36
, which has no time zone)
we have to do this any time there's a date time in the CSV since the format doesn't specify time zone. we should figure out a better way to determine what time zone to use
@@ -116,7 +116,7 @@ | |||
"subject": { | |||
"reference": "Patient/1234" | |||
}, | |||
"effectiveDateTime": "2021-12-20T00:00:00Z", | |||
"effectiveDateTime": "2021-12-20T14:00:00.000Z", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reflects the date in the CSV since we don't round to start of day in bulk upload code anymore
} else { | ||
testResultDate = ((LocalDate) temporalAccessor).atStartOfDay(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an awesome way to handle the date parsing! 💯💯💯 I'll update #5985 with this.
Do you think we should move this parsing towards the top of convertRowToFhirBundle
to group it near testEventId
? That value would now be used by at least observation
and diagnosticReport
(I think we might soon be using it for specimen.collected
too)
* also missed a fix for a test
So I've been reading a bit more about using
What do you think of this suggestion? 🤔 If the time is system generated like timestamp when created or last updated and not connected to any specific time zone, we store the time as UTC by using If the time is related to something in a local time zone or extract from the uploaded data that uses a local time like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good! I'll update my time zone branch with these changes too
Kudos, SonarCloud Quality Gate passed! |
That's interesting! Tbh I'm a little puzzled by that HL7 site excerpt. Does this imply that recipient applications are potentially just throwing away the time zone when comparing or filtering by dates? I don't feel a strong preference for how we format our dates in the message as long as we can expect them to be consistent across different systems imo. I guess I have a small preference to just have them all be in UTC so we don't have additional logic around translating them to a certain TZ depending on facility if it's not actually necessary.. 🤔 Maybe this is something we can ask RS in our next sync if there's a preferred time zone to use. I'll also ask CA how they handle time zones in their messages. edit: hmm to me this part "All HL7 systems are required to accept the time zone offset, but its implementation is application specific." implies that it's up the system accepting the message to decide what to do with the time zone, so they could potentially have some data transform that changes the date times to be in the local time of the sender. |
update: RS converts the dates in messages we send into whatever time zone of the recipient, so doesn't seem like it matters much what tz we send it in |
BACKEND PULL REQUEST
Related Issue
CA wants to see test result date (OBX-19) in our flu messages. we already send them in our Covid messages. RS uses what's in Observation.issued for this when transforming to hl7.
Changes Proposed
test_date
we send in the Covid message and for bulk upload it's thetest_result_date
fieldAdditional Information
Testing
Check updated tests make sense and are passing
Will deploy to a lower so we can test that messages have the new field set