-
Notifications
You must be signed in to change notification settings - Fork 36
Managing Patient Attributes
Patient attributes represent demographic and logistic information about a patient (age, race, gender, location, etc.). To make a change (add, edit, delete) to a patient attribute, it needs to be changed in OpenMRS, the Buendia server module, and the Buendia client. This document describes the necessary steps to make these changes.
For up-to-date instructions on managing attribute definitions in OpenMRS, see: https://wiki.openmrs.org/display/docs/Managing+Person+Attribute+Types
Patients in the Buendia server module are managed by openmrs.projectbuendia.webservices.rest.PatientResource
. Instructions below all refer to code within this class.
-
Remove/edit the code that manages the attribute from
jsonToPatient(SimpleObject)
-
Remove/edit the code that manages the attribute from
applyEdits(Patient, SimpleObject)
-
Remove/edit the code that manages the attribute from
patientToJson(Patient)
-
Remove/edit the attribute from
JSON property names
at the top of the class
-
Add an entry for the new attribute in
JSON property names
at the top of the class -
In
jsonToPatient(SimpleObject)
, look for the new JSON property, and operate on the Patient object, if necessary. For custom attributes, change the attribute value by callingDbUtil.setPersonAttributeValue(Patient, PersonAttributeType, String)
. For an example, look insetLocation(Patient, String)
. -
In
patientToJson(Patient)
, add an entry for the new attribute. To retrieve the attribute value, callDbUtil.getPersonAttributeValue(Person, PersonAttributeType)
. -
In
applyEdits(Patient, SimpleObject)
, add a case for the new attribute and update the patient the same way as in step (2).
-
Remove or edit all references to the attribute in
data/app/AppPatient
(the client's Patient model), as well as any code that depends on it -
Remove or edit all references to the attribute in
data/app/AppPatientDelta
(the client's Patient model for patient changes), as well as any code that depends on it -
Remove or edit all references to the attribute in
sync/SyncAdapter
-
Remove or edit all references to the attribute in
net/model/Patient
(the server's Patient model) -
Find the corresponding attribute in
sync/providers/Contracts#PatientColumns
, and remove or edit all references to it and all code that depends on it -
Remove or edit all references to the attribute in
sync/PatientDatabase
-
Update the version number of the database in
sync/PatientDatabase
, so that the database will be flushed and recreated after the application is updated -
Update test cases for any modified classes
-
In
sync/providers/Contracts#PatientColumns
, add a column for the new attribute -
In
sync/PatientDatabase
, add a column for the new attribute in SQL_CREATE_ENTRIES -
Update the version number of the database in
sync/PatientDatabase
, so that the database will be flushed and recreated after the application is updated -
In
net/model/Patient
(the server's Patient model), add:
a. A field for the new attribute
b. An entry for the attribute in toString()
c. An entry for the attribute in writeFrom(Patient)
-
In
sync/SyncAdapter
, handle the new patient attribute wherever attributes are processed inupdatePatientData(SyncResult)
-
In
data/app/AppPatient
(the client's Patient model), add:
a. A field for the new attribute
b. A field and setter for the new attribute in Builder
c. An entry for the attribute in fromNet(Patient)
d. An entry for the attribute in toContentValues()
- In
data/app/AppPatientDelta
(the client's Patient model for patient changes), add:
a. A field for the new attribute
b. An entry for the attribute in toJson(JSONObject)
c. An entry for the attribute in toContentValues()
- In
data/app/converters/AppPatientConverter
, call the setter for the new attribute inAppPatient.Builder
a. Update relevant UI components as necessary
b. To display the attribute in the patient list, make changes in ui/PatientListTypedCursorAdapter
c. To display the attribute in the patient chart, make changes in ui/PatientChartActivity
d. To make the attribute settable during patient creation, make changes in both ui/PatientCreationController
and ui/PatientCreationActivity
e. Update test cases for any modified classes
About the software
System Overview
Client Application
Server Application
Server Platform
Development practices
GitHub Usage
Java Style
Testing
Releases
For field users and testers
Software Install and Configuration
Upon Receiving Your Gear
Setting Up a Tablet
Setting Up a Server
Setting Up an Access Point
Reference Configuration