Skip to content

Commit

Permalink
add support for patho and humgen reports
Browse files Browse the repository at this point in the history
  • Loading branch information
nr23730 committed Oct 22, 2024
1 parent df7a6d0 commit 87987fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
22 changes: 18 additions & 4 deletions src/main/java/de/uzl/lied/mtbimporter/tasks/AddResourceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,31 @@ private AddResourceData() {
* @throws IOException
*/
public static void processPdfFile(CbioPortalStudy study, File pdf) throws IOException {
String sampleId = pdf.getName()
.replaceAll("somaticGermline_|somatic_|tumorOnly_|_tumorOnly|_Report|_Slides|.pdf", "");
String patientId = FhirResolver.resolvePatientFromSample(sampleId);
String sampleId = pdf.getName().replaceAll(
".*_somaticGermline_|.*somatic_|.*tumorOnly_|_tumorOnly|_Report|_Slides|_Patho|_HumGen|.pdf", "");
String patientId = pdf.getName().replaceAll("_somatic.*|_tumorOnly.*", "");
if (patientId == null || patientId.length() == 0) {
FhirResolver.resolvePatientFromSample(sampleId);
}
File target = new File(
Settings.getResourceFolder(), study.getStudyId() + "/" + patientId + "/" + pdf.getName());
FileUtils.copyFile(pdf, target);
Files.setPosixFilePermissions(target.toPath(), PosixFilePermissions.fromString("rw-r--r--"));
SampleResource sr = new SampleResource();
sr.setPatientId(patientId);
sr.setSampleId(sampleId);
sr.setResourceId(pdf.getName().contains("_Report") ? "PATHOLOGY_SLIDE" : "SLIDE");
if (pdf.getName().contains("_Report")) {
sr.setResourceId("PATHOLOGY_SLIDE");
}
if (pdf.getName().contains("_Slides")) {
sr.setResourceId("SLIDE");
}
if (pdf.getName().contains("_Patho")) {
sr.setResourceId("PATHOLOGY_REPORT");
}
if (pdf.getName().contains("_HumGen")) {
sr.setResourceId("HUMGEN_REPORT");
}
try {
sr.setUrl(Settings.getUrlBase() + "/" + study.getStudyId() + "/" + patientId + "/" + pdf.getName());
} catch (MalformedURLException e) {
Expand Down
4 changes: 3 additions & 1 deletion template/data_resource_definition.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
RESOURCE_ID DISPLAY_NAME RESOURCE_TYPE DESCRIPTION OPEN_BY_DEFAULT PRIORITY
PATHOLOGY_SLIDE MIRACUM-Pipe Report SAMPLE The MIRACUM-Pipe report for the sample TRUE 1
SLIDE Slides SAMPLE Slides TRUE 1
PATHOLOGY_REPORT Pathology Report SAMPLE Pathology Report TRUE 1
SLIDE Slides SAMPLE Slides TRUE 1
HUMGEN_REPORT Human genetics SAMPLE Report of the human genetics TRUE 1

0 comments on commit 87987fa

Please sign in to comment.