Skip to content

Commit 18b66a2

Browse files
appledoraistiakshihab
authored andcommitted
activity disease inference -> getIDfromSymptom
1 parent 378f13e commit 18b66a2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

app/src/main/java/com/github/meafs/recover/activites/DiseaseInference.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
import androidx.appcompat.app.AppCompatActivity;
99

1010
import com.github.meafs.recover.R;
11+
import com.github.meafs.recover.models.Symptoms;
1112
import com.google.android.material.chip.Chip;
1213
import com.google.android.material.chip.ChipGroup;
1314

1415
import java.util.ArrayList;
16+
import java.util.HashMap;
17+
import java.util.Map;
1518

1619
public class DiseaseInference extends AppCompatActivity {
1720
ArrayList<String> sympoms_selection = new ArrayList<String>();
@@ -59,4 +62,17 @@ public void onClick(View v) {
5962
chipGroup.addView(chip);
6063
}
6164
}
65+
66+
private Map<String, String> getIDfromDiseaseName(ArrayList<String> sympoms_selection) {
67+
ArrayList<String> all_symptoms = Symptoms.getAll_symptoms();
68+
Map <String, String> selection_map = new HashMap<String, String>();
69+
for (int i = 0; i< sympoms_selection.size();i++) {
70+
String symptom = sympoms_selection.get(i).toLowerCase().replace(" ","_");
71+
int pos = all_symptoms.indexOf(symptom);
72+
String symptom_id = all_symptoms.get(pos).split("\\.")[1] ;
73+
selection_map.put(symptom, symptom_id);
74+
}
75+
76+
return selection_map;
77+
}
6278
}

app/src/main/java/com/github/meafs/recover/models/Symptoms.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ public class Symptoms {
6161
"dizziness.64"
6262
));
6363

64+
65+
public static ArrayList<String> getAll_symptoms() {
66+
ArrayList<String> all_symptoms = new ArrayList<>() ;
67+
all_symptoms.addAll(throatAndChest);
68+
all_symptoms.addAll(skinAndNails);
69+
all_symptoms.addAll(stomachAndAppetite);
70+
all_symptoms.addAll(face);
71+
all_symptoms.addAll(muscleLimbsBonesVessels);
72+
all_symptoms.addAll(excretion);
73+
all_symptoms.addAll(mental);
74+
all_symptoms.addAll(riskFactors);
75+
all_symptoms.addAll(others);
76+
return all_symptoms;
77+
}
78+
6479
public static ArrayList<String> getSkinAndNails() {
6580
return skinAndNails;
6681
}

0 commit comments

Comments
 (0)