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

EA-190 Improve API for retrieving inpatient visits #235

Merged
merged 4 commits into from
Jul 23, 2024
Merged

EA-190 Improve API for retrieving inpatient visits #235

merged 4 commits into from
Jul 23, 2024

Conversation

mseaton
Copy link
Member

@mseaton mseaton commented Jul 22, 2024

See https://openmrs.atlassian.net/browse/EA-190

This adds a new service method and Java components to facilitate finding and retrieving information about inpatient admissions, and exposes this RESTfully.

@Override
@Transactional(readOnly = true)
public List<InpatientAdmission> getInpatientAdmissions(InpatientAdmissionSearchCriteria criteria) {

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 basically gets all ADT encounters associated with any active visit, and then groups these by visit into an InpatientAdmission object.

* Represents a hospital Admission
*/
@Data
public class InpatientAdmission {
Copy link
Member Author

Choose a reason for hiding this comment

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

Provides a mechanism to retrieve InpatientAdmission data and to expose various properties and utility getter methods via standard REST representations.

public DelegatingResourceDescription getResourceDescription(InpatientAdmission req, Representation representation) {
DelegatingResourceDescription ret = super.getResourceDescription(req, representation);
if (representation instanceof DefaultRepresentation) {
DelegatingResourceDescription rep = new DelegatingResourceDescription();
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 is a bit unconventional, but I went with this to focus on the data that is most relevant to the current use cases. Specifically, this will enable getting timeSinceAdmissionInMinutesdynamically via firstAdmissionOrTransferEncounter.encounterDatetime and will enable getting timeAtInpatientLocationInMinutes dynamically via encounterAssigningToCurrentInpatientLocation.encounterDatetime

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Are we excluding the patient because a decent rep of the patient is included in the default rep of the visit?

@@ -18,6 +18,7 @@

@Controller
@RequestMapping(value = "/rest/**/emrapi/inpatient")
@Deprecated
Copy link
Member Author

Choose a reason for hiding this comment

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

I have deprecated this for now, but would like to remove this controller altogether once we can get the ward app converted to the new endpoint.

Copy link
Member

Choose a reason for hiding this comment

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

Fine with me

Copy link
Member

@mogoodrich mogoodrich left a comment

Choose a reason for hiding this comment

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

thanks @mseaton ! added a couple comments but looks great to me, thanks for getting this out so quickly.

public DelegatingResourceDescription getResourceDescription(InpatientAdmission req, Representation representation) {
DelegatingResourceDescription ret = super.getResourceDescription(req, representation);
if (representation instanceof DefaultRepresentation) {
DelegatingResourceDescription rep = new DelegatingResourceDescription();
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Are we excluding the patient because a decent rep of the patient is included in the default rep of the visit?

@@ -18,6 +18,7 @@

@Controller
@RequestMapping(value = "/rest/**/emrapi/inpatient")
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

Fine with me

@mseaton mseaton merged commit 238b854 into master Jul 23, 2024
1 check passed
@mseaton mseaton deleted the EA-190 branch July 23, 2024 17:49
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.

2 participants