diff --git a/data/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCube.java b/data/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCube.java index bb8c64ea..2a7199ad 100644 --- a/data/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCube.java +++ b/data/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCube.java @@ -218,14 +218,14 @@ public void setLoadingMap(List> newMap) { } public List> getValuesForKeys(List sortedPatientIds) { - List> values = new ArrayList<>(); + List> values = new ArrayList<>(); //133400068 int x = 0; for(Integer id : sortedPatientIds) { - while(x < sortedByKey.length && sortedByKey[x].key= sortedByKey.length) { return values; } - while(sortedByKey[x].key==id) { + while(sortedByKey[x].key == id) { values.add(sortedByKey[x]); x++; } diff --git a/data/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCubeTest.java b/data/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCubeTest.java new file mode 100644 index 00000000..dd956f2d --- /dev/null +++ b/data/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/data/phenotype/PhenoCubeTest.java @@ -0,0 +1,21 @@ +package edu.harvard.hms.dbmi.avillach.hpds.data.phenotype; + +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.*; + +public class PhenoCubeTest { + + @Test + public void killme() { + KeyAndValue[] kill = { + new KeyAndValue<>(133400068, "A01.00 Typhoid fever, unspecified")}; + + PhenoCube subject = new PhenoCube<>("bob", KeyAndValue.class); + subject.setSortedByKey(kill); + + subject.getValuesForKeys(List.of(133400068)); + } +} \ No newline at end of file