Skip to content

Commit

Permalink
#162: Implemented feature updates for CSM at sample fragment.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flava177 committed Nov 19, 2024
1 parent 58eed0c commit 12c68d0
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,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 = 402;
public static final int DATABASE_VERSION = 403;

private static DatabaseHelper instance = null;

Expand Down Expand Up @@ -3917,6 +3917,24 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
currentVersion = 401;
getDao(Hospitalization.class).executeRaw("ALTER TABLE hospitalizations ADD COLUMN diseaseOnsetDate Date;");

case 402:
currentVersion = 402;
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN appearanceOfCsf varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN inoculationTimeTransportMedia Date;");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN sampleSentToLab varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateSampleSentToLab Date;");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN sampleContainerUsed varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN containerOther varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN rdtPerformed varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN rdtResults varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN districtNotificationDate Date;");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN nameOfPerson varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN telNumber varchar(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormSentToRegion Date;");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormReceivedAtRegion Date;");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormSentToNational Date;");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormReceivedAtNational Date;");


// ATTENTION: break should only be done after last version
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import de.symeda.sormas.api.sample.SampleSource;
import de.symeda.sormas.api.sample.SamplingReason;
import de.symeda.sormas.api.sample.SpecimenCondition;
import de.symeda.sormas.api.utils.CsfAppearance;
import de.symeda.sormas.api.utils.SampleContainerUsed;
import de.symeda.sormas.api.utils.YesNo;
import de.symeda.sormas.api.utils.YesNoUnknown;
import de.symeda.sormas.api.utils.pseudonymization.SampleDispatchMode;
Expand Down Expand Up @@ -289,7 +291,36 @@ public class Sample extends PseudonymizableAdo {

@Column(length = CHARACTER_LIMIT_DEFAULT)
private String personCompletingForm;

@Enumerated(EnumType.STRING)
private CsfAppearance appearanceOfCsf;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date inoculationTimeTransportMedia;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dateSampleSentToLab;
@Enumerated(EnumType.STRING)
private YesNo sampleSentToLab;
@Enumerated(EnumType.STRING)
private SampleContainerUsed sampleContainerUsed;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String containerOther;
@Enumerated(EnumType.STRING)
private YesNo rdtPerformed;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String rdtResults;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date districtNotificationDate;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String nameOfPerson;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String telNumber;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dateFormSentToRegion;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dateFormReceivedAtRegion;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dateFormSentToNational;
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dateFormReceivedAtNational;


public Case getAssociatedCase() {
Expand Down Expand Up @@ -1015,4 +1046,115 @@ public YesNo getHasSampleBeenCollected() {
public void setHasSampleBeenCollected(YesNo hasSampleBeenCollected) {
this.hasSampleBeenCollected = hasSampleBeenCollected;
}

public CsfAppearance getAppearanceOfCsf() {return appearanceOfCsf; }
public void setAppearanceOfCsf(CsfAppearance appearanceOfCsf) {
this.appearanceOfCsf = appearanceOfCsf;
}

public Date getInoculationTimeTransportMedia() {
return inoculationTimeTransportMedia;
}

public void setInoculationTimeTransportMedia(Date inoculationTimeTransportMedia) {
this.inoculationTimeTransportMedia = inoculationTimeTransportMedia;
}
public YesNo getSampleSentToLab() {
return sampleSentToLab;
}
public void setSampleSentToLab(YesNo sampleSentToLab) {
this.sampleSentToLab = sampleSentToLab;
}

public Date getDateSampleSentToLab() {
return dateSampleSentToLab;
}

public void setDateSampleSentToLab(Date dateSampleSentToLab) {
this.dateSampleSentToLab = dateSampleSentToLab;
}

public SampleContainerUsed getSampleContainerUsed() {
return sampleContainerUsed;
}
public void setSampleContainerUsed(SampleContainerUsed sampleContainerUsed) {
this.sampleContainerUsed = sampleContainerUsed;
}

public String getContainerOther() {
return containerOther;
}

public void setContainerOther(String containerOther) {
this.containerOther = containerOther;
}

public YesNo getRdtPerformed() {
return rdtPerformed;
}
public void setRdtPerformed(YesNo rdtPerformed) {
this.rdtPerformed = rdtPerformed;
}

public String getRdtResults() {
return rdtResults;
}

public void setRdtResults(String rdtResults) {
this.rdtResults = rdtResults;
}

public Date getDistrictNotificationDate() {
return districtNotificationDate;
}

public void setDistrictNotificationDate(Date districtNotificationDate) {
this.districtNotificationDate = districtNotificationDate;
}
public String getNameOfPerson() {
return nameOfPerson;
}

public void setNameOfPerson(String nameOfPerson) {
this.nameOfPerson = nameOfPerson;
}
public String getTelNumber() {
return telNumber;
}

public void setTelNumber(String telNumber) {
this.telNumber = telNumber;
}

public Date getDateFormSentToRegion() {
return dateFormSentToRegion;
}

public void setDateFormSentToRegion(Date dateFormSentToRegion) {
this.dateFormSentToRegion = dateFormSentToRegion;
}

public Date getDateFormReceivedAtRegion() {
return dateFormReceivedAtRegion;
}

public void setDateFormReceivedAtRegion(Date dateFormReceivedAtRegion) {
this.dateFormReceivedAtRegion = dateFormReceivedAtRegion;
}

public Date getDateFormSentToNational() {
return dateFormSentToNational;
}

public void setDateFormSentToNational(Date dateFormSentToNational) {
this.dateFormSentToNational = dateFormSentToNational;
}

public Date getDateFormReceivedAtNational() {
return dateFormReceivedAtNational;
}

public void setDateFormReceivedAtNational(Date dateFormReceivedAtNational) {
this.dateFormReceivedAtNational = dateFormReceivedAtNational;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,21 @@ public void fillInnerFromAdo(SampleDto target, Sample source) {
target.setPseudonymized(source.isPseudonymized());
target.setRequestedSampleMaterials(source.getRequestedSampleMaterials());
target.setHasSampleBeenCollected(source.getHasSampleBeenCollected());
target.setAppearanceOfCsf(source.getAppearanceOfCsf());
target.setInoculationTimeTransportMedia(source.getInoculationTimeTransportMedia());
target.setSampleSentToLab(source.getSampleSentToLab());
target.setDateSampleSentToLab(source.getDateSampleSentToLab());
target.setSampleContainerUsed(source.getSampleContainerUsed());
target.setContainerOther(source.getContainerOther());
target.setRdtPerformed(source.getRdtPerformed());
target.setRdtResults(source.getRdtResults());
target.setDistrictNotificationDate(source.getDistrictNotificationDate());
target.setNameOfPerson(source.getNameOfPerson());
target.setTelNumber(source.getTelNumber());
target.setDateFormSentToRegion(source.getDateFormSentToRegion());
target.setDateFormReceivedAtRegion(source.getDateFormReceivedAtRegion());
target.setDateFormSentToNational(source.getDateFormSentToNational());
target.setDateFormReceivedAtNational(source.getDateFormReceivedAtNational());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
import de.symeda.sormas.api.sample.SamplingReason;
import de.symeda.sormas.api.sample.SpecimenCondition;
import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.api.utils.CsfAppearance;
import de.symeda.sormas.api.utils.SampleContainerUsed;
import de.symeda.sormas.api.utils.YesNo;
import de.symeda.sormas.api.utils.fieldaccess.UiFieldAccessCheckers;
import de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers;
Expand Down Expand Up @@ -249,6 +251,8 @@ public void onLayoutBinding(FragmentSampleEditLayoutBinding contentBinding) {
contentBinding.setYesNoClass(YesNo.class);
contentBinding.setIpSampleTestTypeClass(IpSampleTestType.class);
contentBinding.setSampleMaterialClass(SampleMaterial.class);
contentBinding.setCsfAppearanceClass(CsfAppearance.class);
contentBinding.setSampleContainerUsedClass(SampleContainerUsed.class);

contentBinding.sampleSelectedResultIGM.initializeSpinner(posNegEqList);
contentBinding.sampleSelectedResultPcr.initializeSpinner(posNegList);
Expand All @@ -269,6 +273,13 @@ public void onLayoutBinding(FragmentSampleEditLayoutBinding contentBinding) {
contentBinding.sampleDateFormReceivedAtDistrict.initializeDateField(getFragmentManager());
contentBinding.sampleDateFormSentToDistrict.initializeDateField(getFragmentManager());
contentBinding.sampleDateFormSentToHigherLevel.initializeDateField(getFragmentManager());
contentBinding.sampleInoculationTimeTransportMedia.initializeDateField(getFragmentManager());
contentBinding.sampleDateSampleSentToLab.initializeDateField(getFragmentManager());
contentBinding.sampleDistrictNotificationDate.initializeDateField(getFragmentManager());
contentBinding.sampleDateFormSentToRegion.initializeDateField(getFragmentManager());
contentBinding.sampleDateFormReceivedAtRegion.initializeDateField(getFragmentManager());
contentBinding.sampleDateFormSentToNational.initializeDateField(getFragmentManager());
contentBinding.sampleDateFormReceivedAtNational.initializeDateField(getFragmentManager());

if(record.getAssociatedCase().getDisease() != null){
super.hideFieldsForDisease(record.getAssociatedCase().getDisease(), contentBinding.mainContent, FormType.SAMPLE_EDIT);
Expand Down Expand Up @@ -446,6 +457,8 @@ public void onAfterLayoutBinding(final FragmentSampleEditLayoutBinding contentBi
handleAHF();
case NEW_INFLUENZA:
handleILI();
case CSM:
handleCSM();
}


Expand Down Expand Up @@ -571,4 +584,23 @@ private void handleILI() {
getContentBinding().sampleSampleMaterial.initializeSpinner(DataUtils.toItems(iliSampleMaterialList));
}

private void handleCSM() {
getContentBinding().samplePurpose.setValue(SamplePurpose.EXTERNAL);
getContentBinding().samplePurpose.setVisibility(GONE);
getContentBinding().sampleHasSampleBeenCollected.setCaption("CSF Sample Collected? Note: If NO, (Please STILL complete the form and send to district control officer)");

if (getContentBinding().sampleHasSampleBeenCollected.getValue() == null) {
getContentBinding().sampleSampleDateTime.setVisibility(View.GONE);
} else {
int visibility = (getContentBinding().sampleHasSampleBeenCollected.getValue() == YesNo.YES ? View.VISIBLE : View.GONE);
getContentBinding().sampleSampleDateTime.setVisibility(visibility);
}

getContentBinding().sampleHasSampleBeenCollected.addValueChangedListener(field -> {
int visibility = (field.getValue() == YesNo.YES ? View.VISIBLE : View.GONE);
getContentBinding().sampleSampleDateTime.setVisibility(visibility);
});

}

}
Loading

0 comments on commit 12c68d0

Please sign in to comment.