Skip to content

Commit

Permalink
#170: implemented riskfactor features for Mpox.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flava177 committed Dec 13, 2024
1 parent ff22e55 commit 8597dbd
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// public static final int DATABASE_VERSION = 307;
//public static final int DATABASE_VERSION = 343;
// public static final int DATABASE_VERSION = 410;
public static final int DATABASE_VERSION = 420;
public static final int DATABASE_VERSION = 421;

private static DatabaseHelper instance = null;

Expand Down Expand Up @@ -4314,6 +4314,19 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN dateOfDeath Date;");
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN placeOfDeath varchar(255);");

case 420:
currentVersion = 420;
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientSpoxVaccinationScarPresent varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientTravelledAnywhere3WeeksPrior varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientTravelled3WeeksIfYesIndicate varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientTravelledPeriodOfIllness varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientTravelledIllnessIfYesIndicate varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN otherPlaces varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN during3WeeksPatientContactWithSimilarSymptoms varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN dateOfContactWithIllPerson Date;");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientTouchDomesticWildAnimal varchar(255);");
getDao(RiskFactor.class).executeRaw("ALTER TABLE riskfactor ADD COLUMN patientTouchDomesticWildAnimalIfYes varchar(255);");

// ATTENTION: break should only be done after last version
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

import static de.symeda.sormas.api.utils.FieldConstraints.CHARACTER_LIMIT_DEFAULT;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -125,6 +127,26 @@ public class RiskFactor extends PseudonymizableAdo {
private YesNo threeDaysPriorToDiseaseAttendAnySocialEvent;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String otherSocialEventDetails;
@Enumerated(EnumType.STRING)
private YesNo patientSpoxVaccinationScarPresent;
@Enumerated(EnumType.STRING)
private YesNo patientTravelledAnywhere3WeeksPrior;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String patientTravelled3WeeksIfYesIndicate;
@Enumerated(EnumType.STRING)
private YesNo patientTravelledPeriodOfIllness;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String patientTravelledIllnessIfYesIndicate;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String otherPlaces;
@Enumerated(EnumType.STRING)
private YesNo during3WeeksPatientContactWithSimilarSymptoms;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dateOfContactWithIllPerson;
@Enumerated(EnumType.STRING)
private YesNo patientTouchDomesticWildAnimal;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String patientTouchDomesticWildAnimalIfYes;

public String getDrinkingWaterSourceOne() {
return drinkingWaterSourceOne;
Expand Down Expand Up @@ -390,6 +412,87 @@ public void setOtherSocialEventDetails(String otherSocialEventDetails) {
this.otherSocialEventDetails = otherSocialEventDetails;
}

public YesNo getPatientSpoxVaccinationScarPresent() {
return patientSpoxVaccinationScarPresent;
}

public void setPatientSpoxVaccinationScarPresent(YesNo patientSpoxVaccinationScarPresent) {
this.patientSpoxVaccinationScarPresent = patientSpoxVaccinationScarPresent;
}

public YesNo getPatientTravelledAnywhere3WeeksPrior() {
return patientTravelledAnywhere3WeeksPrior;
}

public void setPatientTravelledAnywhere3WeeksPrior(YesNo patientTravelledAnywhere3WeeksPrior) {
this.patientTravelledAnywhere3WeeksPrior = patientTravelledAnywhere3WeeksPrior;
}

public String getPatientTravelled3WeeksIfYesIndicate() {
return patientTravelled3WeeksIfYesIndicate;
}

public void setPatientTravelled3WeeksIfYesIndicate(String patientTravelled3WeeksIfYesIndicate) {
this.patientTravelled3WeeksIfYesIndicate = patientTravelled3WeeksIfYesIndicate;
}

public YesNo getPatientTravelledPeriodOfIllness() {
return patientTravelledPeriodOfIllness;
}

public void setPatientTravelledPeriodOfIllness(YesNo patientTravelledPeriodOfIllness) {
this.patientTravelledPeriodOfIllness = patientTravelledPeriodOfIllness;
}

public String getPatientTravelledIllnessIfYesIndicate() {
return patientTravelledIllnessIfYesIndicate;
}

public void setPatientTravelledIllnessIfYesIndicate(String patientTravelledIllnessIfYesIndicate) {
this.patientTravelledIllnessIfYesIndicate = patientTravelledIllnessIfYesIndicate;
}

public String getOtherPlaces() {
return otherPlaces;
}

public void setOtherPlaces(String otherPlaces) {
this.otherPlaces = otherPlaces;
}

public YesNo getDuring3WeeksPatientContactWithSimilarSymptoms() {
return during3WeeksPatientContactWithSimilarSymptoms;
}

public void setDuring3WeeksPatientContactWithSimilarSymptoms(YesNo during3WeeksPatientContactWithSimilarSymptoms) {
this.during3WeeksPatientContactWithSimilarSymptoms = during3WeeksPatientContactWithSimilarSymptoms;
}

public Date getDateOfContactWithIllPerson() {
return dateOfContactWithIllPerson;
}

public void setDateOfContactWithIllPerson(Date dateOfContactWithIllPerson) {
this.dateOfContactWithIllPerson = dateOfContactWithIllPerson;
}

public YesNo getPatientTouchDomesticWildAnimal() {
return patientTouchDomesticWildAnimal;
}

public void setPatientTouchDomesticWildAnimal(YesNo patientTouchDomesticWildAnimal) {
this.patientTouchDomesticWildAnimal = patientTouchDomesticWildAnimal;
}

public String getPatientTouchDomesticWildAnimalIfYes() {
return patientTouchDomesticWildAnimalIfYes;
}

public void setPatientTouchDomesticWildAnimalIfYes(String patientTouchDomesticWildAnimalIfYes) {
this.patientTouchDomesticWildAnimalIfYes = patientTouchDomesticWildAnimalIfYes;
}


@Override
public String getI18nPrefix() {
return I18N_PREFIX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public void onLayoutBinding(final FragmentCaseEditRiskfactorLayoutBinding conten
contentBinding.setData(record);
contentBinding.setCaze(caze);
contentBinding.setYesNoClass(YesNo.class);
contentBinding.riskFactorDateOfContactWithIllPerson.initializeDateField(getFragmentManager());

if (caze.getDisease() != null) {
super.hideFieldsForDisease(caze.getDisease(), contentBinding.mainContent, FormType.RISK_FACTOR_EDIT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<import type="de.symeda.sormas.app.component.controls.ControlButtonType" />
<import type="de.symeda.sormas.api.utils.YesNo" />
<import type="de.symeda.sormas.api.riskfactor.DrinkingWaterSource" />
<import type="de.symeda.sormas.api.i18n.I18nProperties" />
<import type="de.symeda.sormas.api.i18n.Strings" />

<variable name="data" type="de.symeda.sormas.app.backend.riskfactor.RiskFactor" />
<variable name="caze" type="de.symeda.sormas.app.backend.caze.Case" />
Expand Down Expand Up @@ -444,6 +446,93 @@
app:value="@={data.otherSocialEventDetails}"
style="@style/ControlSingleColumnStyle" />

<TextView
android:id="@+id/riskFactor_headingRiskFactor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{I18nProperties.getString(Strings.headingRiskFactor)}"
style="@style/SubHeadingStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/riskFactor_patientSpoxVaccinationScarPresent"
app:value="@={data.patientSpoxVaccinationScarPresent}"
app:enumClass="@{YesNoClass}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/riskFactor_patientTravelledAnywhere3WeeksPrior"
app:value="@={data.patientTravelledAnywhere3WeeksPrior}"
app:enumClass="@{YesNoClass}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/riskFactor_patientTravelled3WeeksIfYesIndicate"
app:inputType="textMultiLine"
app:textAlignment="gravity"
app:gravity="top|start"
app:textArea="true"
app:singleLine="false"
app:maxLines="3"
app:value="@={data.patientTravelled3WeeksIfYesIndicate}"
app:dependencyParentField="@{riskFactorPatientTravelledAnywhere3WeeksPrior}"
app:dependencyParentValue="@{YesNo.YES}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/riskFactor_patientTravelledPeriodOfIllness"
app:value="@={data.patientTravelledPeriodOfIllness}"
app:enumClass="@{YesNoClass}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/riskFactor_patientTravelledIllnessIfYesIndicate"
app:inputType="textMultiLine"
app:textAlignment="gravity"
app:gravity="top|start"
app:textArea="true"
app:singleLine="false"
app:maxLines="3"
app:value="@{data.patientTravelledIllnessIfYesIndicate}"
app:dependencyParentField="@{riskFactorPatientTravelledPeriodOfIllness}"
app:dependencyParentValue="@{YesNo.YES}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/riskFactor_otherPlaces"
app:value="@{data.otherPlaces}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/riskFactor_during3WeeksPatientContactWithSimilarSymptoms"
app:value="@={data.during3WeeksPatientContactWithSimilarSymptoms}"
app:enumClass="@{YesNoClass}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlDateField
android:id="@+id/riskFactor_dateOfContactWithIllPerson"
app:value="@{data.dateOfContactWithIllPerson}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/riskFactor_patientTouchDomesticWildAnimal"
app:value="@{data.patientTouchDomesticWildAnimal}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/riskFactor_patientTouchDomesticWildAnimalIfYes"
app:inputType="textMultiLine"
app:textAlignment="gravity"
app:gravity="top|start"
app:textArea="true"
app:singleLine="false"
app:maxLines="3"
app:value="@{data.patientTouchDomesticWildAnimalIfYes}"
app:dependencyParentField="@{riskFactorPatientTouchDomesticWildAnimal}"
app:dependencyParentValue="@{YesNo.YES}"
style="@style/ControlSingleColumnStyle" />



</LinearLayout>


Expand Down

0 comments on commit 8597dbd

Please sign in to comment.