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

O3-4487 Save Vitals Data in Visit Patient scenario #71

Merged
merged 9 commits into from
Mar 4, 2025

Conversation

Bawanthathilan
Copy link
Collaborator

@Bawanthathilan Bawanthathilan commented Feb 28, 2025

This pull request introduces the following changes to Save vitals data in Visit Patient scenario:

  • saveVitalsData service is implemented in the HttpService.java file.
  • Add constants in the Constants.java file

Ticket URL: https://openmrs.atlassian.net/browse/O3-4487

Copy link
Member

@jayasanka-sack jayasanka-sack left a 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);
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

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

This should be changed

Comment on lines 141 to 145
Map<String, Object> obs = new HashMap<>();
obs.put("concept", Map.of("uuid", VITALS_CONCEPT));
obs.put("value", value);

saveVitals.put("obs", List.of(obs));
Copy link
Member

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:

https://github.com/openmrs/openmrs-esm-patient-chart/blob/1bb5ccbc827def608924545747d55d0fe2c67b66/packages/esm-patient-vitals-app/src/config-schema.ts#L3

Copy link
Collaborator Author

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

Comment on lines 366 to 384
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);
Copy link
Member

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.

Copy link
Member

@jayasanka-sack jayasanka-sack left a 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!

@jayasanka-sack jayasanka-sack merged commit 7ddc8ab into openmrs:main Mar 4, 2025
2 checks passed
@Muppasanipraneeth
Copy link

@Bawanthathilan this ticket number O3-4484 in the pr title is wrong this related to this ticket https://openmrs.atlassian.net/browse/O3-4484

@Bawanthathilan
Copy link
Collaborator Author

https://openmrs.atlassian.net/browse/O3-4484

sorry. ill update ticket id in the description

@Bawanthathilan Bawanthathilan changed the title O3-4484: Save Vitals Data in Visit Patient scenario O3-4487 Save Vitals Data in Visit Patient scenario Mar 7, 2025
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.

3 participants