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

LIB-182: Registration: Add Homeless Checkbox #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.openmrs.module.pihcore.config.Components;
import org.openmrs.module.pihcore.config.Config;
import org.openmrs.module.pihcore.metadata.Metadata;
import org.openmrs.module.registrationapp.model.CheckboxWidget;
import org.openmrs.module.registrationapp.model.DropdownWidget;
import org.openmrs.module.registrationapp.model.Field;
import org.openmrs.module.registrationapp.model.Question;
Expand Down Expand Up @@ -34,6 +36,33 @@ public void addSections(RegistrationAppConfig c) {
}
}

@Override
public Section getContactInfoSection() {
// build the default contact info section and retrieve the address question
Section contactInfoSection = super.getContactInfoSection();

Question homelessQuestion = new Question();
homelessQuestion.setHeader("pihcore.homeless");
homelessQuestion.setLegend("pihcore.homeless");

// add the homeless section to it.
Field field = new Field();
field.setFormFieldName("homeless");
field.setType("personAttribute");
field.setLabel("pihcore.homeless");
field.setUuid(Metadata.getHomelessAttributeType().getUuid());

CheckboxWidget w = new CheckboxWidget();
w.getConfig().setValue("true");
field.setWidget(toObjectNode(w));
homelessQuestion.addField(field);

// insert after the "address" question (assumption: address is first question)
contactInfoSection.getQuestions().add(1, homelessQuestion);

return contactInfoSection;
}

Copy link
Member

Choose a reason for hiding this comment

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

This all looks fine, I guess, but FWIW, I do not think modeling this as a Person Attribute is a good idea. Person Attributes are best used for things that are (ideally unchanging) attributes of a Person. "Is Test Patient". "Eye Color". "Birthplace". These things are set once, just like known attributes like Birthdate, and never (or rarely) changed.

Homeless is (hopefully) a temporary state that a person is in. If they are homeless at the time of registration, we should record that as an Obs on their registration encounter. If we want to see if this has changed over time, we can collect additional answers to this question in subsequent encounters. This would seem a more appropriate way to model this.

@mogoodrich / @lnball ?

@Override
public Section getSocialSection() {
Section s = new Section();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public static PersonAttributeType getUnknownPatientAttributeType() {
return Context.getPersonService().getPersonAttributeTypeByUuid(PihEmrConfigConstants.PERSONATTRIBUTETYPE_UNKNOWN_PATIENT_UUID);
}

public static PersonAttributeType getHomelessAttributeType() {
return Context.getPersonService().getPersonAttributeTypeByUuid(PihEmrConfigConstants.PERSONATTRIBUTETYPE_HOMELESS_UUID);
}

public static PatientIdentifierType getNifIdentifierType() {
return Context.getPatientService().getPatientIdentifierTypeByUuid(ZlConfigConstants.PATIENTIDENTIFIERTYPE_NIF_UUID);
}
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@
<printerVersion>1.5.0-SNAPSHOT</printerVersion>
<providermanagementVersion>2.14.0</providermanagementVersion>
<radiologyappVersion>1.6.0-SNAPSHOT</radiologyappVersion>
<registrationappVersion>1.25.0</registrationappVersion>
<registrationappVersion>1.26.0-SNAPSHOT</registrationappVersion>
<registrationcoreVersion>1.12.0</registrationcoreVersion>
<reportingVersion>1.26.0-SNAPSHOT</reportingVersion>
<reportingrestVersion>1.14.0</reportingrestVersion>
<reportinguiVersion>1.11.0</reportinguiVersion>
<serializationxstreamVersion>0.2.16</serializationxstreamVersion>
<spaVersion>1.0.9</spaVersion>
<testutilsVersion>1.7.0</testutilsVersion>
<uicommonsVersion>2.23.0</uicommonsVersion>
<uicommonsVersion>2.24.0-SNAPSHOT</uicommonsVersion>
<uiframeworkVersion>3.24.0-SNAPSHOT</uiframeworkVersion>
<uilibraryVersion>2.0.7</uilibraryVersion>
<webservicesRestVersion>2.37.0-SNAPSHOT</webservicesRestVersion>
Expand Down