-
Notifications
You must be signed in to change notification settings - Fork 12
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
O3-4487 Save Vitals Data in Visit Patient scenario #71
Conversation
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.
Thanks for the PR @Bawanthathilan! Please check my comments bellow:
String encounterDatetime = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); | ||
|
||
Map<String, Object> saveVitals = new HashMap<>(); | ||
saveVitals.put("form", VISIT_NOTE_FORM_UUID); |
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.
The form here is different: 9f26aad4-244a-46ca-be49-1196df1a8c9a
saveVitals.put("form", VISIT_NOTE_FORM_UUID); | ||
saveVitals.put("patient", patientUuid); | ||
saveVitals.put("location", OUTPATIENT_CLINIC_LOCATION_UUID); | ||
saveVitals.put("encounterType", VISIT_NOTE_ENCOUNTER_TYPE_UUID); |
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 should be changed
Map<String, Object> obs = new HashMap<>(); | ||
obs.put("concept", Map.of("uuid", VITALS_CONCEPT)); | ||
obs.put("value", value); | ||
|
||
saveVitals.put("obs", List.of(obs)); |
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.
A single submission contains all the vitals (and biometrics) in it as a list of obs. ex: temperature is one observation.
ex: 5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
(the value corresponding to the VITALS_CONCEPT
you defined) concept id is systolic Blood Pressure.
Full list of concept ids can be found here:
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.
Thank @jayasanka-sack for reviewing my PR. I will make the necessary changes
Map<String, Object> vitals = new HashMap<>(); | ||
vitals.put("form", VITALS_FORM_UUID); | ||
vitals.put("patient", patientUuid); | ||
vitals.put("location", VITALS_LOCATION_UUID); | ||
vitals.put("encounterType", VITALS_ENCOUNTER_TYPE_UUID); | ||
vitals.put("encounterDatetime", encounterDatetime); | ||
|
||
List<Map<String, Object>> obs = new ArrayList<>(); | ||
obs.add(Map.of("concept", SYSTOLIC_BLOOD_PRESSURE, "value", 34)); | ||
obs.add(Map.of("concept", DIASTOLIC_BLOOD_PRESSURE, "value", 44)); | ||
obs.add(Map.of("concept", RESPIRATORY_RATE, "value", 100)); | ||
obs.add(Map.of("concept", ARTERIAL_BLOOD_OXYGEN_SATURATION, "value", 20)); | ||
obs.add(Map.of("concept", PULSE, "value", 120)); | ||
obs.add(Map.of("concept", TEMPERATURE_C, "value", 28)); | ||
obs.add(Map.of("concept", WEIGHT_KG, "value", 60)); | ||
obs.add(Map.of("concept", HEIGHT_CM, "value", 121)); | ||
obs.add(Map.of("concept", MID_UPPER_ARM_CIRCUMFERENCE, "value", 34)); | ||
|
||
vitals.put("obs", obs); |
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.
Minor naming suggestion: vitals
is a Map, not a collection, so the plural form might be misleading. We can rename it to encounter
or payload
or something similar.
obs
could be renamed to observations
.
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.
Brilliant! 👏 Thanks for getting this done @Bawanthathilan. straight to the main branch it goes!
@Bawanthathilan this ticket number O3-4484 in the pr title is wrong this related to this ticket https://openmrs.atlassian.net/browse/O3-4484 |
sorry. ill update ticket id in the description |
This pull request introduces the following changes to Save vitals data in Visit Patient scenario:
Ticket URL: https://openmrs.atlassian.net/browse/O3-4487