Stream: Death on FHIR
Topic: VRDR Java Lib
Doug Wheeler (Aug 03 2021 at 20:37):
Time of Injury in the VRDR-Injury-Incident is in Zulu time in VRDR.
I am using the .toHumanDisplay method in the VRDR Java Lib (see below) to process the date. This seems to be working assuming the date is converted to AM/PM vs 24 hour format.
But the business would like data be in 24 hour format.
Are there helper methods for working with dates in 24 format?
if (injuryIncidentList.get(0).getEffectiveDateTimeType() != null && !injuryIncidentList.get(0).getEffectiveDateTimeType().isEmpty()) {
log.debug(String.format("Date/Time of Injury[%s]", injuryIncidentList.get(0).getEffectiveDateTimeType()));
log.debug(String.format("Date/Time of Injury[%s] (toHumanDisplay)", injuryIncidentList.get(0).getEffectiveDateTimeType().toHumanDisplay()));
SimpleDateFormat dateTimeFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a");
Date parsedTimeDate = dateTimeFormat.parse(injuryIncidentList.get(0).getEffectiveDateTimeType().toHumanDisplay());
SimpleDateFormat yyyyMMddFormat = new SimpleDateFormat("yyyy-MM-dd");
log.debug(String.format("Date of Injury[%s]", yyyyMMddFormat.format(parsedTimeDate)));
deathRecord.setInjuryDt(new Timestamp(parsedTimeDate.getTime()));
SimpleDateFormat hhMMFormat = new SimpleDateFormat("HHmm");
log.debug(String.format("Time of Injury[%s]", hhMMFormat.format(parsedTimeDate)));
deathRecord.setInjuryTm(hhMMFormat.format(parsedTimeDate));
if (injuryIncidentList.get(0).getEffectiveDateTimeType().toHumanDisplay().endsWith("AM")) {
deathRecord.setInjuryTmInd("A");
} else if (injuryIncidentList.get(0).getEffectiveDateTimeType().toHumanDisplay().endsWith("PM")) {
deathRecord.setInjuryTmInd("P");
} else {
log.error("InjuryTmInd should never be anything other than AM or PM.");
}
} else {
log.debug("No date of injury provided...");
deathRecord.setInjuryDt(null);
deathRecord.setInjuryTm(null);
deathRecord.setInjuryTmInd(null);
}
"fullUrl": "Observation/edc22fab-bddc-4998-8c14-32bcb5670b8f",
"resource": {
"id": "edc22fab-bddc-4998-8c14-32bcb5670b8f",
"meta": {
"profile": [
"http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Injury-Incident"
]
},
"extension": [
{
"url": "http://www.hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Injury-Location",
"valueReference": {
"reference": "Location/15d0a832-d9fe-493e-b83c-b1411c43643a"
}
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "11374-6",
"display": "Injury incident description"
}
]
},
"subject": {
"reference": "Patient/c3ffe013-be0e-447f-86b6-ff108ffd26d9"
},
"effectiveDateTime": "2020-11-17T00:00:00-05:00",
"valueString": "Fell off building",
"component": [
{
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "69450-5",
"display": "Place of injury"
}
]
},
"valueString": "Office Building"
},
{
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "69448-9",
"display": "Injury leading to death associated with transportation event"
}
]
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0136",
"code": "N",
"display": "No"
}
]
}
},
{
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "69444-8",
"display": "Did death result from injury at work"
}
]
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0136",
"code": "Y",
"display": "Yes"
}
]
}
}
],
"resourceType": "Observation"
}
},
@Michael Riley
Michael Riley (Aug 09 2021 at 13:57):
@Doug Wheeler Hey Doug, just getting back from my vacation in over 2 years that's why the response is so late :)
Hapi Fhir uses the apache lang3 utils, and uses the FastDateFormat MEDIUM version. https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/FastDateFormat.html
If you need the right format, unfortunately I think you have to do it yourself.
- Initialize a Format instance with the AM/PM formatting you need
- Retreive the Instant class from the DateTimeDT
- Format the instance
Last updated: Apr 12 2022 at 19:14 UTC