Skip to content

Commit

Permalink
#180: Implemented sample features for IDSR. Added suspected disease f…
Browse files Browse the repository at this point in the history
…ield
  • Loading branch information
Flava177 committed Oct 14, 2024
1 parent 8c2d769 commit f60880c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3462,9 +3462,12 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(Person.class).executeRaw("ALTER TABLE person ADD COLUMN applicable varchar(255);");
case 369:
currentVersion = 369;
getDao(Hospitalization.class).executeRaw("ALTER TABLE hospitalizations ADD COLUMN dateFormSentToDistrict Date;");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN recentTravelOutbreak varchar(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN contactSimilarOutbreak varchar(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN contactSickAnimals varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN suspectedDisease 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 @@ -36,6 +36,7 @@
import javax.persistence.Enumerated;
import javax.persistence.Transient;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.sample.AdditionalTestType;
import de.symeda.sormas.api.sample.IpSampleTestType;
import de.symeda.sormas.api.sample.FilterChangingFrequency;
Expand Down Expand Up @@ -161,7 +162,8 @@ public class Sample extends PseudonymizableAdo {

@Enumerated(EnumType.STRING)
private PathogenTestResultType pathogenTestResult;

@Enumerated(EnumType.STRING)
private Disease suspectedDisease;
@DatabaseField
private Boolean pathogenTestingRequested;

Expand Down Expand Up @@ -478,6 +480,14 @@ public PathogenTestResultType getPathogenTestResult() {
return pathogenTestResult;
}

public Disease getSuspectedDisease() {
return suspectedDisease;
}

public void setSuspectedDisease(Disease suspectedDisease) {
this.suspectedDisease = suspectedDisease;
}

public void setPathogenTestResult(PathogenTestResultType pathogenTestResult) {
this.pathogenTestResult = pathogenTestResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public void fillInnerFromDto(Sample target, SampleDto source) {
target.setShipped(source.isShipped());
target.setReceived(source.isReceived());
target.setPathogenTestResult(source.getPathogenTestResult());
target.setSuspectedDisease(source.getSuspectedDisease());
target.setPathogenTestingRequested(source.getPathogenTestingRequested());
target.setAdditionalTestingRequested(source.getAdditionalTestingRequested());
target.setRequestedPathogenTests(source.getRequestedPathogenTests());
Expand Down Expand Up @@ -195,6 +196,7 @@ public void fillInnerFromAdo(SampleDto target, Sample source) {
target.setShipped(source.isShipped());
target.setReceived(source.isReceived());
target.setPathogenTestResult(source.getPathogenTestResult());
target.setSuspectedDisease(source.getSuspectedDisease());
target.setPathogenTestingRequested(source.getPathogenTestingRequested());
target.setAdditionalTestingRequested(source.getAdditionalTestingRequested());
target.setRequestedPathogenTests(source.getRequestedPathogenTests());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ public class SampleEditFragment extends BaseEditFragment<FragmentSampleEditLayou

private List<Item> sampleMaterialList;
private List<Item> sampleSourceList;
private List<Item> suspectedDiseaseList;
private List<Facility> labList;
private List<Item> samplePurposeList;
private List<Item> samplingReasonList;
private List<String> requestedPathogenTests = new ArrayList<>();
private List<String> requestedSampleMaterials = new ArrayList<>();
private List<String> requestedAdditionalTests = new ArrayList<>();
private List<Item> finalTestResults;
private List<Item> suspectedList;
private List<String> ipSampleTestResults = new ArrayList<>();
private List<Item> posNegList;
private List<Item> posNegEqList;
Expand Down Expand Up @@ -188,6 +190,7 @@ record = getActivityRootData();
labList = DatabaseHelper.getFacilityDao().getActiveLaboratories(true);
samplePurposeList = DataUtils.getEnumItems(SamplePurpose.class, true);
samplingReasonList = DataUtils.getEnumItems(SamplingReason.class, true, getFieldVisibilityCheckers());
suspectedList = DataUtils.getEnumItems(Disease.class, true);
posNegList = DataUtils.getEnumItems(PosNegEq.class, true);
posNegEqList = DataUtils.getEnumItems(PosNegEq.class, true);
posNegList.remove(new Item<>(PosNegEq.EQU.toString(), PosNegEq.EQU));
Expand Down Expand Up @@ -299,6 +302,7 @@ public void onAfterLayoutBinding(final FragmentSampleEditLayoutBinding contentBi
}
}*/
contentBinding.samplePathogenTestResult.initializeSpinner(finalTestResults);

contentBinding.samplePurpose.initializeSpinner(samplePurposeList, field -> {
SamplePurpose samplePurpose = (SamplePurpose) field.getValue();
if (SamplePurpose.EXTERNAL == samplePurpose) {
Expand All @@ -317,6 +321,7 @@ public void onAfterLayoutBinding(final FragmentSampleEditLayoutBinding contentBi
}
});

contentBinding.sampleSuspectedDisease.initializeSpinner(suspectedList);
contentBinding.sampleSamplingReason.initializeSpinner(samplingReasonList);


Expand Down Expand Up @@ -433,6 +438,8 @@ public void onAfterLayoutBinding(final FragmentSampleEditLayoutBinding contentBi
switch (record.getAssociatedCase().getDisease()){
case YELLOW_FEVER:
handleYellowFever();
case IMMEDIATE_CASE_BASED_FORM_OTHER_CONDITIONS:
handleIDSR();
}


Expand Down Expand Up @@ -488,4 +495,22 @@ private void handleYellowFever() {
getContentBinding().samplePurpose.setVisibility(GONE);
getContentBinding().samplePathogenTestingRequested.setVisibility(GONE);
}

private void handleIDSR() {
List<Disease> idsrSuspectedList = Arrays.asList(
Disease.AHF,
Disease.AFP,
Disease.CORONAVIRUS,
Disease.CHIKUNGUNYA,
Disease.CHOLERA,
Disease.CONGENITAL_RUBELLA,
Disease.DENGUE,
Disease.EVD,
Disease.FOODBORNE_ILLNESS
);
getContentBinding().sampleSuspectedDisease.initializeSpinner(DataUtils.toItems(idsrSuspectedList));
getContentBinding().samplePurpose.setValue(SamplePurpose.EXTERNAL);
getContentBinding().samplePurpose.setVisibility(GONE);
getContentBinding().samplePathogenTestingRequested.setVisibility(GONE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@
app:value="@={data.pathogenTestResult}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/sample_suspectedDisease"
app:required="true"
app:value="@={data.suspectedDisease}"
style="@style/ControlSingleColumnStyle" />

<LinearLayout
android:id="@+id/external_sample_fields_layout"
android:orientation="vertical"
Expand Down

0 comments on commit f60880c

Please sign in to comment.