From 6d63c34778e373d237d779767ac04b012c318181 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 24 Aug 2023 20:11:31 +0200 Subject: [PATCH] small revisions --- .../nejm/NejmCaseReportFromPdfFilterer.java | 9 +++++++-- .../phenopacket2prompt/querygen/TimePointParser.java | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/monarchinitiative/phenopacket2prompt/nejm/NejmCaseReportFromPdfFilterer.java b/src/main/java/org/monarchinitiative/phenopacket2prompt/nejm/NejmCaseReportFromPdfFilterer.java index ab547ec..6a6e6e1 100644 --- a/src/main/java/org/monarchinitiative/phenopacket2prompt/nejm/NejmCaseReportFromPdfFilterer.java +++ b/src/main/java/org/monarchinitiative/phenopacket2prompt/nejm/NejmCaseReportFromPdfFilterer.java @@ -115,7 +115,9 @@ public NejmCaseReportFromPdfFilterer(String caseId, List lines) { line.startsWith("Pathological Diagnosis")){ inDifferentialDiagnosis = true; } else if (caseId.equalsIgnoreCase("PMID:33730458") && - line.startsWith("Pathological Discussion")){ + line.startsWith("Pathological Discussion")) { + inDifferentialDiagnosis = true; + } else if (caseId.equals("PMID:34437787") && line.startsWith("Dr. Andrew M. Crabbe")) { inDifferentialDiagnosis = true; } else { if (inCase && ! inDifferentialDiagnosis) { @@ -133,6 +135,9 @@ public NejmCaseReportFromPdfFilterer(String caseId, List lines) { } else if (line.strip().startsWith("Final Diagnosis")) { inActualDiagnosis = true; diagnosis = lines.get(index+1); + } else if (line.strip().startsWith("Anatomical Diagnosis")) { + inActualDiagnosis = true; + diagnosis = lines.get(index+1); } @@ -159,7 +164,7 @@ public NejmCaseReportFromPdfFilterer(String caseId, List lines) { int start=-1; int end=-1; while(matcher.find()) { - n_matched++; + n_matched++; if (n_matched==1){ start = matcher.end()+1; } else if (n_matched==2) { diff --git a/src/main/java/org/monarchinitiative/phenopacket2prompt/querygen/TimePointParser.java b/src/main/java/org/monarchinitiative/phenopacket2prompt/querygen/TimePointParser.java index b76fd53..6974bda 100644 --- a/src/main/java/org/monarchinitiative/phenopacket2prompt/querygen/TimePointParser.java +++ b/src/main/java/org/monarchinitiative/phenopacket2prompt/querygen/TimePointParser.java @@ -32,7 +32,7 @@ public class TimePointParser { private final Pattern pattern9 = Pattern.compile("After a \\b\\w+\\b[ -](weeks?|days?|months?|years?) admission",Pattern.CASE_INSENSITIVE); private final Pattern pattern10 = Pattern.compile("On admission to (the other|another) hospital",Pattern.CASE_INSENSITIVE); private final Pattern pattern11 = Pattern.compile("Over the next \\b\\w+\\b (hours?|days?|weeks?|months?|years?)",Pattern.CASE_INSENSITIVE); - + private final Pattern pattern12 = Pattern.compile("3.5 years before the current evaluation"); /** Note we do all searching in lower case */ private final Set fixedPatterns = Set.of("in the emergency department", "on examination", "in childhood", "examination was notable for", @@ -55,7 +55,7 @@ public TimePointParser() { patternList.add(pattern8); patternList.add(pattern9); patternList.add(pattern10); - // patternList.add(pattern11); + patternList.add(pattern12); }