Skip to content

Commit

Permalink
repro
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Mar 27, 2024
1 parent 6df032b commit 673e15f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ public void setLoadingMap(List<KeyAndValue<V>> newMap) {
}

public List<KeyAndValue<V>> getValuesForKeys(List<Integer> sortedPatientIds) {
List<KeyAndValue<V>> values = new ArrayList<>();
List<KeyAndValue<V>> values = new ArrayList<>(); //133400068
int x = 0;
for(Integer id : sortedPatientIds) {
while(x < sortedByKey.length && sortedByKey[x].key<id) {
while(x < sortedByKey.length && sortedByKey[x].key < id) {
x++;
}
if (x >= sortedByKey.length) { return values; }
while(sortedByKey[x].key==id) {
while(sortedByKey[x].key == id) {
values.add(sortedByKey[x]);
x++;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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<>(20998, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(67844, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(67844, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(564280, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(1921279, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(1921279, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(2387865, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(2809924, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(2809924, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3103926, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3103926, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3109197, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3153064, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3664490, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3693389, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3693389, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3827355, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3970757, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(3970757, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(4894925, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(4894925, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(4894925, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(32048174, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(32346130, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(35425794, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(37174253, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(37174253, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(39409294, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(39409294, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(48241745, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(56769960, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(57516253, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(57516253, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(61049165, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(62229338, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(73817878, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(79715800, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(79851615, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(79851615, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(83263840, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(92167252, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(96724703, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(115214296, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(115214296, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(116448323, "A01.01 Typhoid meningitis"),
new KeyAndValue<>(116827996, "A01.00 Typhoid fever, unspecified"),
new KeyAndValue<>(116827996, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(125506124, "A01.09 Typhoid fever with other complications"),
new KeyAndValue<>(133400068, "A01.00 Typhoid fever, unspecified")};

PhenoCube<?> subject = new PhenoCube<>("bob", KeyAndValue.class);
subject.setSortedByKey(kill);

subject.getValuesForKeys(List.of(133400068));
}
}

0 comments on commit 673e15f

Please sign in to comment.