Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
seanfinan committed Aug 20, 2021
2 parents d9e1cc2 + 2c26546 commit 12150d5
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions src/main/java/org/healthnlp/deepphe/neo4j/reader/NodeReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
Expand Down Expand Up @@ -175,7 +177,6 @@ public PatientSummary getPatientSummary(final GraphDatabaseService graphDb,
return patientSummary;
}


/////////////////////////////////////////////////////////////////////////////////////////
//
// NEOPLASM DATA
Expand Down Expand Up @@ -361,7 +362,6 @@ private NeoplasmAttribute createAttribute(final GraphDatabaseService graphDb,
return null;
}


/////////////////////////////////////////////////////////////////////////////////////////
//
// NOTE DATA
Expand Down Expand Up @@ -396,8 +396,8 @@ public Note getNote(final GraphDatabaseService graphDb,
}

private List<NewBiomarkerSummary> getBiomarkers(final GraphDatabaseService graphDb,
final Log log,
final String patientId) {
final Log log,
final String patientId) {
final List<NewBiomarkerSummary> biomarkers = new ArrayList<>();

try (Transaction tx = graphDb.beginTx()) {
Expand Down Expand Up @@ -525,7 +525,6 @@ private Note createNote(final GraphDatabaseService graphDb,
return note;
}


/////////////////////////////////////////////////////////////////////////////////////////
//
// SECTION DATA
Expand Down Expand Up @@ -578,7 +577,6 @@ private Section createSection(final GraphDatabaseService graphDb,
return null;
}


/////////////////////////////////////////////////////////////////////////////////////////
//
// MENTION RELATION AND COREF DATA
Expand Down Expand Up @@ -708,7 +706,6 @@ private List<MentionCoref> getCorefs(final Collection<FullMention> fullMentions)
return corefs;
}


/////////////////////////////////////////////////////////////////////////////////////////
//
// MENTION RELATION AND COREF HELPER CLASS
Expand All @@ -729,6 +726,7 @@ static private PatientInfo createPatientInfo(final Node patientNode) throws Runt
}

public static PatientInfo populateNewRandomPatient(NewStructuredPatientData structuredPatientData) throws ParseException {

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

String fed = structuredPatientData.getFirstEncounterDate();
Expand All @@ -753,25 +751,19 @@ public static PatientInfo populateNewRandomPatient(NewStructuredPatientData stru
patientInfo.setGender(structuredPatientData.getGender());
return patientInfo;


}

public static NewStructuredPatientData getStructuredPatientDataForPatientId(String actualPatientId) {
Gson gson = new Gson();
try {
JsonReader reader = new JsonReader(new FileReader("/Users/johnlevander/dev/dphe-neo4j-plugin/fake_patient_structured_data.json"));
List<NewStructuredPatientData> data = gson.fromJson(reader, new TypeToken<List<NewStructuredPatientData>>() {
}.getType());
for (NewStructuredPatientData structuredPatientData : data) {
if (structuredPatientData.getPatientId().equals(actualPatientId)) {
return structuredPatientData;
}
JsonReader reader = new JsonReader(new InputStreamReader(NodeReader.class.getClassLoader().getResourceAsStream("fake_patient_structured_data.json")));
List<NewStructuredPatientData> data = gson.fromJson(reader, new TypeToken<List<NewStructuredPatientData>>() {
}.getType());
for (NewStructuredPatientData structuredPatientData : data) {
if (structuredPatientData.getPatientId().equals(actualPatientId)) {
return structuredPatientData;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;

}

//TODO: throwing generic exception, make it more specific
Expand Down Expand Up @@ -822,7 +814,6 @@ public PatientSummaryAndStagesList patientSummaryAndStagesList(GraphDatabaseServ
patientSummaryAndStages.getStages().addAll(stages);
}


// Add to the set, this doesn't allow duplicates
patientSummaryAndStagesList.getPatientSummaryAndStages().add(patientSummaryAndStages);
}
Expand Down Expand Up @@ -869,8 +860,6 @@ public NewCancerAndTumorSummary getCancerAndTumorSummary(GraphDatabaseService gr
List<NewCancerSummary> cancers = new ArrayList<>();
cancerAndTumorSummary.setCancers(cancers);



List<NeoplasmSummary> neoplasmSummaries = getCancers(graphDb, log, patientId);

for (NeoplasmSummary cancer : Objects.requireNonNull(neoplasmSummaries)) {
Expand Down Expand Up @@ -1103,7 +1092,6 @@ public List<GuiPatientSummary> getPatientSummaries(GraphDatabaseService graphDb,
//.filter(Objects::nonNull)
.collect(Collectors.toList());


// List<PatientSummary> patientSummaries = new ArrayList<>();
// try ( Transaction tx = graphDb.beginTx() ) {
// // DataUtil.getAllPatientNodes() is supposed to return all unique patients
Expand Down Expand Up @@ -1152,7 +1140,6 @@ private GuiPatientSummary createPatientSummary(GraphDatabaseService graphDb, Nod

}


/////////////////////////////////////////////////////////////////////////////////////////
//
// MENTION RELATION AND COREF HELPER CLASS
Expand Down

0 comments on commit 12150d5

Please sign in to comment.