Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 442b872

Browse files
Creation of a drop-down list for selecting COVID variants (SORMAS-Foundation#4174)
* Management of the data model related to Disease variants of Cases SORMAS-Foundation#4042 * Management of Disease variants inside Case forms SORMAS-Foundation#4042 * Management of DiseaseVariant in Case grid, export and filters SORMAS-Foundation#4042 * Add a documentation on the procedure for creating new Disease variants SORMAS-Foundation#4042
1 parent 6702351 commit 442b872

47 files changed

Lines changed: 1151 additions & 73 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

GUIDE_ADD_NEW_DISEASE_VARIANT.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# How to add a new disease variant?
2+
3+
This guide explains how to add a new disease variant to SORMAS.
4+
5+
## I. Preparation of the data
6+
7+
First step is to retrieve the identifiers of the diseases.
8+
An exhaustive list can be found inside the enum ```de.symeda.sormas.api.Disease```.
9+
10+
## II. Persist the data
11+
12+
1. Get into pgAdmin or into the postgreSQL shell to be able to execute the following queries into the PostgreSQL database.
13+
2. Replace the variable ```{{ DISEASE ID }}``` in the following query with the Disease ID taken from the Java enum indicated in step I.
14+
3. Replace the variable ```{{ VARIANT NAME }}``` in the following query with the name of the disease variant.
15+
4. Replace the ```[...]``` by all other rows you need to add.
16+
5. Execute the generated query.
17+
6. Let's verify that the table ```diseasevariant``` is well completed with your data.
18+
19+
Here is the SQL query to execute:
20+
21+
```sql
22+
INSERT INTO diseasevariant (id, uuid, creationdate, changedate, disease, name)
23+
VALUES
24+
(nextval('entity_seq'), gen_random_uuid(), now(), now(), '{{ DISEASE ID }}', '{{ VARIANT NAME }}'),
25+
[...];
26+
```
27+
28+
Here is an example of the query with sample data:
29+
30+
```sql
31+
INSERT INTO diseasevariant (id, uuid, creationdate, changedate, disease, name)
32+
VALUES
33+
(nextval('entity_seq'), gen_random_uuid(), now(), now(), 'YELLOW_FEVER', 'Yellow Fever Variant 1'),
34+
(nextval('entity_seq'), gen_random_uuid(), now(), now(), 'YELLOW_FEVER', 'Yellow Fever Variant 2'),
35+
(nextval('entity_seq'), gen_random_uuid(), now(), now(), 'DENGUE', 'Dengue Variant 1'),
36+
(nextval('entity_seq'), gen_random_uuid(), now(), now(), 'MALARIA', 'Malaria Variant 1'),
37+
(nextval('entity_seq'), gen_random_uuid(), now(), now(), 'MALARIA', 'Malaria Variant 2');
38+
```
39+
40+
In case PostgreSQL complains about unknown function ```gen_random_uuid()```, it means the ```pgcrypto``` extension is not enabled.
41+
To enable it, please login with a superadmin account on your PostgreSQL server and execute the following query:
42+
43+
```sql
44+
create extension pgcrypto;
45+
```
46+
47+
That's it. The forms in the web application and Android app will now have their ```Disease variant``` fields filled.

sormas-api/src/main/java/de/symeda/sormas/api/Disease.java

Lines changed: 63 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,76 +24,78 @@ public enum Disease
2424
implements
2525
StatisticsGroupingKey {
2626

27-
AFP(true, true, true, false, 0),
28-
CHOLERA(true, true, true, true, 5),
29-
CONGENITAL_RUBELLA(true, true, true, true, 21),
30-
CSM(true, true, true, false, 10),
31-
DENGUE(true, true, true, false, 14),
32-
EVD(true, true, true, true, 21),
33-
GUINEA_WORM(true, true, true, false, 0),
34-
LASSA(true, true, true, true, 21),
35-
MEASLES(true, true, true, false, 21),
36-
MONKEYPOX(true, true, true, true, 21),
37-
NEW_INFLUENZA(true, true, true, true, 17),
38-
PLAGUE(true, true, true, true, 7),
39-
POLIO(true, true, true, false, 0),
40-
UNSPECIFIED_VHF(true, true, true, true, 21),
41-
WEST_NILE_FEVER(true, false, true, false, 0),
42-
YELLOW_FEVER(true, true, true, false, 6),
43-
RABIES(true, true, true, true, 6),
44-
ANTHRAX(true, true, true, false, 0),
45-
CORONAVIRUS(true, true, true, true, 14),
46-
PNEUMONIA(true, false, true, false, 0),
47-
MALARIA(true, false, false, false, 0),
48-
TYPHOID_FEVER(true, false, false, false, 0),
49-
ACUTE_VIRAL_HEPATITIS(true, false, false, false, 0),
50-
NON_NEONATAL_TETANUS(true, false, false, false, 0),
51-
HIV(true, false, false, false, 0),
52-
SCHISTOSOMIASIS(true, false, false, false, 0),
53-
SOIL_TRANSMITTED_HELMINTHS(true, false, false, false, 0),
54-
TRYPANOSOMIASIS(true, false, false, false, 0),
55-
DIARRHEA_DEHYDRATION(true, false, false, false, 0),
56-
DIARRHEA_BLOOD(true, false, false, false, 0),
57-
SNAKE_BITE(true, false, false, false, 0),
58-
RUBELLA(true, false, false, false, 0),
59-
TUBERCULOSIS(true, false, false, false, 0),
60-
LEPROSY(true, false, false, false, 0),
61-
LYMPHATIC_FILARIASIS(true, false, false, false, 0),
62-
BURULI_ULCER(true, false, false, false, 0),
63-
PERTUSSIS(true, false, false, false, 0),
64-
NEONATAL_TETANUS(true, false, false, false, 0),
65-
ONCHOCERCIASIS(true, false, false, false, 0),
66-
DIPHTERIA(true, false, false, false, 0),
67-
TRACHOMA(true, false, false, false, 0),
68-
YAWS_ENDEMIC_SYPHILIS(true, false, false, false, 0),
69-
MATERNAL_DEATHS(true, false, false, false, 0),
70-
PERINATAL_DEATHS(true, false, false, false, 0),
71-
INFLUENZA_A(true, false, true, false, 0),
72-
INFLUENZA_B(true, false, true, false, 0),
73-
H_METAPNEUMOVIRUS(true, false, true, false, 0),
74-
RESPIRATORY_SYNCYTIAL_VIRUS(true, false, true, false, 0),
75-
PARAINFLUENZA_1_4(true, false, true, false, 0),
76-
ADENOVIRUS(true, false, true, false, 0),
77-
RHINOVIRUS(true, false, true, false, 0),
78-
ENTEROVIRUS(true, false, true, false, 0),
79-
M_PNEUMONIAE(true, false, true, false, 0),
80-
C_PNEUMONIAE(true, false, true, false, 0),
81-
OTHER(true, true, true, true, 21),
82-
UNDEFINED(true, true, true, true, 0);
27+
AFP(true, true, true, false, 0, true),
28+
CHOLERA(true, true, true, true, 5, true),
29+
CONGENITAL_RUBELLA(true, true, true, true, 21, true),
30+
CSM(true, true, true, false, 10, true),
31+
DENGUE(true, true, true, false, 14, true),
32+
EVD(true, true, true, true, 21, true),
33+
GUINEA_WORM(true, true, true, false, 0, true),
34+
LASSA(true, true, true, true, 21, true),
35+
MEASLES(true, true, true, false, 21, true),
36+
MONKEYPOX(true, true, true, true, 21, true),
37+
NEW_INFLUENZA(true, true, true, true, 17, true),
38+
PLAGUE(true, true, true, true, 7, true),
39+
POLIO(true, true, true, false, 0, true),
40+
UNSPECIFIED_VHF(true, true, true, true, 21, true),
41+
WEST_NILE_FEVER(true, false, true, false, 0, true),
42+
YELLOW_FEVER(true, true, true, false, 6, true),
43+
RABIES(true, true, true, true, 6, true),
44+
ANTHRAX(true, true, true, false, 0, true),
45+
CORONAVIRUS(true, true, true, true, 14, true),
46+
PNEUMONIA(true, false, true, false, 0, true),
47+
MALARIA(true, false, false, false, 0, true),
48+
TYPHOID_FEVER(true, false, false, false, 0, true),
49+
ACUTE_VIRAL_HEPATITIS(true, false, false, false, 0, true),
50+
NON_NEONATAL_TETANUS(true, false, false, false, 0, true),
51+
HIV(true, false, false, false, 0, true),
52+
SCHISTOSOMIASIS(true, false, false, false, 0, true),
53+
SOIL_TRANSMITTED_HELMINTHS(true, false, false, false, 0, true),
54+
TRYPANOSOMIASIS(true, false, false, false, 0, true),
55+
DIARRHEA_DEHYDRATION(true, false, false, false, 0, true),
56+
DIARRHEA_BLOOD(true, false, false, false, 0, true),
57+
SNAKE_BITE(true, false, false, false, 0, true),
58+
RUBELLA(true, false, false, false, 0, true),
59+
TUBERCULOSIS(true, false, false, false, 0, true),
60+
LEPROSY(true, false, false, false, 0, true),
61+
LYMPHATIC_FILARIASIS(true, false, false, false, 0, true),
62+
BURULI_ULCER(true, false, false, false, 0, true),
63+
PERTUSSIS(true, false, false, false, 0, true),
64+
NEONATAL_TETANUS(true, false, false, false, 0, true),
65+
ONCHOCERCIASIS(true, false, false, false, 0, true),
66+
DIPHTERIA(true, false, false, false, 0, true),
67+
TRACHOMA(true, false, false, false, 0, true),
68+
YAWS_ENDEMIC_SYPHILIS(true, false, false, false, 0, true),
69+
MATERNAL_DEATHS(true, false, false, false, 0, true),
70+
PERINATAL_DEATHS(true, false, false, false, 0, true),
71+
INFLUENZA_A(true, false, true, false, 0, true),
72+
INFLUENZA_B(true, false, true, false, 0, true),
73+
H_METAPNEUMOVIRUS(true, false, true, false, 0, true),
74+
RESPIRATORY_SYNCYTIAL_VIRUS(true, false, true, false, 0, true),
75+
PARAINFLUENZA_1_4(true, false, true, false, 0, true),
76+
ADENOVIRUS(true, false, true, false, 0, true),
77+
RHINOVIRUS(true, false, true, false, 0, true),
78+
ENTEROVIRUS(true, false, true, false, 0, true),
79+
M_PNEUMONIAE(true, false, true, false, 0, true),
80+
C_PNEUMONIAE(true, false, true, false, 0, true),
81+
OTHER(true, true, true, true, 21, false),
82+
UNDEFINED(true, true, true, true, 0, false);
8383

8484
private boolean defaultActive;
8585
private boolean defaultPrimary;
8686
private boolean defaultCaseBased;
8787
private boolean defaultFollowUpEnabled;
8888
private int defaultFollowUpDuration;
89+
private boolean variantAllowed;
8990

90-
Disease(boolean defaultActive, boolean defaultPrimary, boolean defaultCaseBased, boolean defaultFollowUpEnabled, int defaultFollowUpDuration) {
91+
Disease(boolean defaultActive, boolean defaultPrimary, boolean defaultCaseBased, boolean defaultFollowUpEnabled, int defaultFollowUpDuration, boolean variantAllowed) {
9192

9293
this.defaultActive = defaultActive;
9394
this.defaultPrimary = defaultPrimary;
9495
this.defaultCaseBased = defaultCaseBased;
9596
this.defaultFollowUpEnabled = defaultFollowUpEnabled;
9697
this.defaultFollowUpDuration = defaultFollowUpDuration;
98+
this.variantAllowed = variantAllowed;
9799
}
98100

99101
public String toString() {
@@ -142,6 +144,10 @@ public boolean isDiseaseGroup() {
142144
return this == UNSPECIFIED_VHF;
143145
}
144146

147+
public boolean isVariantAllowed() {
148+
return variantAllowed;
149+
}
150+
145151
@Override
146152
public int keyCompareTo(StatisticsGroupingKey o) {
147153

sormas-api/src/main/java/de/symeda/sormas/api/FacadeProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import de.symeda.sormas.api.contact.ContactFacade;
3535
import de.symeda.sormas.api.disease.DiseaseConfigurationFacade;
3636
import de.symeda.sormas.api.disease.DiseaseFacade;
37+
import de.symeda.sormas.api.disease.DiseaseVariantFacade;
3738
import de.symeda.sormas.api.docgeneneration.DocumentTemplateFacade;
3839
import de.symeda.sormas.api.docgeneneration.EventDocumentFacade;
3940
import de.symeda.sormas.api.docgeneneration.QuarantineOrderFacade;
@@ -251,6 +252,10 @@ public static DiseaseConfigurationFacade getDiseaseConfigurationFacade() {
251252
return get().lookupEjbRemote(DiseaseConfigurationFacade.class);
252253
}
253254

255+
public static DiseaseVariantFacade getDiseaseVariantFacade() {
256+
return get().lookupEjbRemote(DiseaseVariantFacade.class);
257+
}
258+
254259
public static MaternalHistoryFacade getMaternalHistoryFacade() {
255260
return get().lookupEjbRemote(MaternalHistoryFacade.class);
256261
}

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseBulkEditData.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
import de.symeda.sormas.api.Disease;
2424
import de.symeda.sormas.api.EntityDto;
25+
import de.symeda.sormas.api.disease.DiseaseVariantDto;
26+
import de.symeda.sormas.api.disease.DiseaseVariantReferenceDto;
2527
import de.symeda.sormas.api.facility.FacilityReferenceDto;
2628
import de.symeda.sormas.api.facility.FacilityType;
2729
import de.symeda.sormas.api.region.CommunityReferenceDto;
@@ -37,6 +39,7 @@ public class CaseBulkEditData extends EntityDto {
3739
private static final long serialVersionUID = -4670022133882295863L;
3840

3941
public static final String DISEASE = "disease";
42+
public static final String DISEASE_VARIANT = "diseaseVariant";
4043
public static final String DISEASE_DETAILS = "diseaseDetails";
4144
public static final String PLAGUE_TYPE = "plagueType";
4245
public static final String DENGUE_FEVER_TYPE = "dengueFeverType";
@@ -53,6 +56,7 @@ public class CaseBulkEditData extends EntityDto {
5356
public static final String FACILITY_TYPE = "facilityType";
5457

5558
private Disease disease;
59+
private DiseaseVariantReferenceDto diseaseVariant;
5660
private String diseaseDetails;
5761
private PlagueType plagueType;
5862
private DengueFeverType dengueFeverType;
@@ -76,6 +80,14 @@ public void setDisease(Disease disease) {
7680
this.disease = disease;
7781
}
7882

83+
public DiseaseVariantReferenceDto getDiseaseVariant() {
84+
return diseaseVariant;
85+
}
86+
87+
public void setDiseaseVariant(DiseaseVariantReferenceDto diseaseVariant) {
88+
this.diseaseVariant = diseaseVariant;
89+
}
90+
7991
public String getDiseaseDetails() {
8092
return diseaseDetails;
8193
}

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseCriteria.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import de.symeda.sormas.api.Disease;
2424
import de.symeda.sormas.api.EntityRelevanceStatus;
2525
import de.symeda.sormas.api.contact.FollowUpStatus;
26+
import de.symeda.sormas.api.disease.DiseaseVariantDto;
27+
import de.symeda.sormas.api.disease.DiseaseVariantReferenceDto;
2628
import de.symeda.sormas.api.facility.FacilityReferenceDto;
2729
import de.symeda.sormas.api.facility.FacilityType;
2830
import de.symeda.sormas.api.facility.FacilityTypeGroup;
@@ -70,6 +72,7 @@ public class CaseCriteria extends BaseCriteria implements Cloneable {
7072

7173
private UserRole reportingUserRole;
7274
private Disease disease;
75+
private DiseaseVariantReferenceDto diseaseVariant;
7376
private CaseOutcome outcome;
7477
private CaseClassification caseClassification;
7578
private InvestigationStatus investigationStatus;
@@ -162,6 +165,19 @@ public Disease getDisease() {
162165
return disease;
163166
}
164167

168+
public void setDiseaseVariant(DiseaseVariantReferenceDto diseaseVariant) {
169+
this.diseaseVariant = diseaseVariant;
170+
}
171+
172+
public CaseCriteria diseaseVariant(DiseaseVariantReferenceDto diseaseVariant) {
173+
setDiseaseVariant(diseaseVariant);
174+
return this;
175+
}
176+
177+
public DiseaseVariantReferenceDto getDiseaseVariant() {
178+
return diseaseVariant;
179+
}
180+
165181
public void setRegion(RegionReferenceDto region) {
166182
this.region = region;
167183
}

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import de.symeda.sormas.api.contact.ContactDto;
3232
import de.symeda.sormas.api.contact.FollowUpStatus;
3333
import de.symeda.sormas.api.contact.QuarantineType;
34+
import de.symeda.sormas.api.disease.DiseaseVariantDto;
35+
import de.symeda.sormas.api.disease.DiseaseVariantReferenceDto;
3436
import de.symeda.sormas.api.epidata.EpiDataDto;
3537
import de.symeda.sormas.api.event.EventParticipantDto;
3638
import de.symeda.sormas.api.facility.FacilityReferenceDto;
@@ -78,6 +80,7 @@ public class CaseDataDto extends PseudonymizableDto {
7880
public static final String INVESTIGATION_STATUS = "investigationStatus";
7981
public static final String PERSON = "person";
8082
public static final String DISEASE = "disease";
83+
public static final String DISEASE_VARIANT = "diseaseVariant";
8184
public static final String DISEASE_DETAILS = "diseaseDetails";
8285
public static final String PLAGUE_TYPE = "plagueType";
8386
public static final String DENGUE_FEVER_TYPE = "dengueFeverType";
@@ -189,6 +192,7 @@ public class CaseDataDto extends PseudonymizableDto {
189192
@Outbreaks
190193
@Required
191194
private Disease disease;
195+
private DiseaseVariantReferenceDto diseaseVariant;
192196
@Outbreaks
193197
private String diseaseDetails;
194198
@Diseases({
@@ -724,6 +728,14 @@ public void setDisease(Disease disease) {
724728
this.disease = disease;
725729
}
726730

731+
public DiseaseVariantReferenceDto getDiseaseVariant() {
732+
return diseaseVariant;
733+
}
734+
735+
public void setDiseaseVariant(DiseaseVariantReferenceDto diseaseVariant) {
736+
this.diseaseVariant = diseaseVariant;
737+
}
738+
727739
public String getDiseaseDetails() {
728740
return diseaseDetails;
729741
}

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseExportDto.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import de.symeda.sormas.api.clinicalcourse.HealthConditionsDto;
3030
import de.symeda.sormas.api.contact.FollowUpStatus;
3131
import de.symeda.sormas.api.contact.QuarantineType;
32+
import de.symeda.sormas.api.disease.DiseaseVariantReferenceDto;
3233
import de.symeda.sormas.api.epidata.EpiDataDto;
3334
import de.symeda.sormas.api.event.EventStatus;
3435
import de.symeda.sormas.api.facility.FacilityHelper;
@@ -120,6 +121,7 @@ public class CaseExportDto implements Serializable {
120121
private String epidNumber;
121122
private String diseaseFormatted;
122123
private Disease disease;
124+
private DiseaseVariantReferenceDto diseaseVariant;
123125
@PersonalData
124126
@SensitiveData
125127
private String firstName;
@@ -271,7 +273,7 @@ public class CaseExportDto implements Serializable {
271273
//@formatter:off
272274
public CaseExportDto(long id, long personId, long personAddressId, long epiDataId, long symptomsId,
273275
long hospitalizationId, long districtId, long healthConditionsId, String uuid, String epidNumber,
274-
Disease disease, String diseaseDetails, String firstName, String lastName, Salutation salutation, String otherSalutation, Sex sex, YesNoUnknown pregnant,
276+
Disease disease, String diseaseVariantUuid, String diseaseVariantName, String diseaseDetails, String firstName, String lastName, Salutation salutation, String otherSalutation, Sex sex, YesNoUnknown pregnant,
275277
Integer approximateAge, ApproximateAgeType approximateAgeType, Integer birthdateDD, Integer birthdateMM,
276278
Integer birthdateYYYY, Date reportDate, String reportingUserUuid, String regionUuid, String region,
277279
String districtUuid, String district, String communityUuid, String community,
@@ -314,6 +316,7 @@ public CaseExportDto(long id, long personId, long personAddressId, long epiDataI
314316
this.armedForcesRelationType = ArmedForcesRelationType;
315317
this.diseaseFormatted = DiseaseHelper.toString(disease, diseaseDetails);
316318
this.disease = disease;
319+
this.diseaseVariant = new DiseaseVariantReferenceDto(diseaseVariantUuid, diseaseVariantName);
317320
this.firstName = firstName;
318321
this.lastName = lastName;
319322
this.salutation = EnumHelper.toString(salutation, otherSalutation, Salutation.OTHER);
@@ -499,6 +502,16 @@ public String getDiseaseFormatted() {
499502
return diseaseFormatted;
500503
}
501504

505+
@Order(7)
506+
@ExportTarget(caseExportTypes = {
507+
CaseExportType.CASE_SURVEILLANCE,
508+
CaseExportType.CASE_MANAGEMENT })
509+
@ExportProperty(CaseDataDto.DISEASE_VARIANT)
510+
@ExportGroup(ExportGroupType.CORE)
511+
public DiseaseVariantReferenceDto getDiseaseVariant() {
512+
return diseaseVariant;
513+
}
514+
502515
@Order(10)
503516
@ExportTarget(caseExportTypes = {
504517
CaseExportType.CASE_SURVEILLANCE,
@@ -1661,6 +1674,10 @@ public void setDiseaseFormatted(String diseaseFormatted) {
16611674
this.diseaseFormatted = diseaseFormatted;
16621675
}
16631676

1677+
public void setDiseaseVariant(DiseaseVariantReferenceDto diseaseVariant) {
1678+
this.diseaseVariant = diseaseVariant;
1679+
}
1680+
16641681
public void setFirstName(String firstName) {
16651682
this.firstName = firstName;
16661683
}

0 commit comments

Comments
 (0)