Commit 5548b059 authored by javi's avatar javi
Browse files

export srdomain finding and validation

parent 24574a92
......@@ -56,15 +56,15 @@ public class DocumentController {
return "";
}
@RequestMapping("/documents/{id}/exportFinding/{findingId}/{export_finding}")
public String setExportFinding(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId, @PathVariable(value="export_finding") String export_finding) {
documentService.setExportFinding(id, findingId, export_finding);
@RequestMapping("/documents/{id}/setExportSRDomain/{srDomainId}/{export_srDomain}")
public String setExportFinding(@PathVariable(value="id") Long id, @PathVariable(value="srDomainId") Integer srDomainId, @PathVariable(value="export_srDomain") Boolean export_srDomain) {
documentService.setExportSRDomainFinding(id, srDomainId, export_srDomain);
return "true";
}
@RequestMapping("/documents/{id}/findingValidation/{findingId}/{status}")
public String setFindingValidation(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId, @PathVariable(value="export_finding") String export_finding) {
documentService.setExportFinding(id, findingId, export_finding);
public String setFindingValidation(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId, @PathVariable(value="status") String status) {
documentService.setFindingValidation(id, findingId, status);
return "true";
}
......
......@@ -28,7 +28,7 @@ public interface DocumentService {
String findFindingsEvidenceByDocumentId(Long id);
Boolean setExportFinding(Long id, Integer findingId, String export_finding);
Boolean setExportSRDomainFinding(Long id, Integer findingId, Boolean export_srdomain);
Boolean setFindingValidation(Long id, Integer findingId,String status);
}
......@@ -111,9 +111,11 @@ public class DocumentServiceImpl implements DocumentService {
Document document = this.findByDocumentId(id);
Finding findingSelected = null;
for (Finding finding : documentAnnotations.getFindings()) {
if(finding.getFindingId().equals(findingId)) {
findingSelected = finding;
break;
if(finding.getSrDomainFindings()!=null) {
if(finding.getFindingId().equals(findingId)) {
findingSelected = finding;
break;
}
}
}
......@@ -145,20 +147,23 @@ public class DocumentServiceImpl implements DocumentService {
}
@Override
public Boolean setExportFinding(Long id, Integer findingId,String export_finding) {
public Boolean setExportSRDomainFinding(Long id, Integer srDomainId,Boolean export_srdomainfinding) {
DocumentAnnotations documentAnnotations = this.findDocumentAnnotationsByDocumentId(id);
Finding findingSelected = null;
SRDomainFinding sRDomainFindingSelected = null;
for (Annotation annotation : documentAnnotations.getRelevantSentences()) {
for (Finding finding : annotation.getFindings()) {
if(finding.getFindingId().equals(findingId)) {
findingSelected = finding;
break;
for (SRDomainFinding srDomainFinding : finding.getSrDomainFindings()) {
if(srDomainFinding.getSrDomainId().equals(srDomainId)) {
sRDomainFindingSelected = srDomainFinding;
break;
}
}
}
}
if(findingSelected!=null) {
if(sRDomainFindingSelected!=null) {
//https://stackoverflow.com/questions/47699646/updating-replacing-a-deeply-nested-object-in-mongodb-with-spring-data-mongodb
findingSelected.setExport(export_finding);
sRDomainFindingSelected.setExport(export_srdomainfinding);
documentAnnotationsRepository.save(documentAnnotations);
return true;
}
......@@ -266,80 +271,83 @@ public class DocumentServiceImpl implements DocumentService {
retStr.append("STUDYID|DOMAIN|SRSEQ|SRRISK|SPGRPCD|GRPLBL|SRGRPDOS|SRSEX|SRSTDY|SRSTPHSE|SROBSTDY|SRENDY|SRENPHSE|SROBENDY|SRDOMAIN|SRSPEC|SRTSTCD|SRFNDG|SRORES|SROBSV|SROBSQ|SRSEV|SRPCNT|SRSIGF|SRTRTEF|SRCOMNT");
retStr.append(System.getProperty("line.separator"));
for (Finding finding : documentAnnotations.getFindings()) {
for (SRDomainFinding srDomainFinding : finding.getSrDomainFindings()) {
//STUDYID -- > Study Identifier
retStr.append(id);
retStr.append("|");
//DOMAIN -- > Domain Abbreviation, always SR
retStr.append("SR");
retStr.append("|");
//SRSEQ -- > Sequence number
retStr.append("");
retStr.append("|");
//SRRISK --> Effect Level Associated with a Group/Sex, NOEL, LOEL, NOAEL, LOAEL, HNSTD, STD, MTD
retStr.append(srDomainFinding.getSRRISK()==null?"":srDomainFinding.getSRRISK());
retStr.append("|");
//SPGRPCD --> Sponsor-defined Group Code, group 1 , A
retStr.append(srDomainFinding.getSPGRPCD()==null?"":srDomainFinding.getSPGRPCD());
retStr.append("|");
//GRPLBL --> Sponsor-defined Group Name, "low dose", "mid dose"
retStr.append(srDomainFinding.getGRPLBL()==null?"":srDomainFinding.getGRPLBL());
retStr.append("|");
//SRGRPDOS --> Group Dose Level, "20 mg/kg"
retStr.append(srDomainFinding.getSRGRPDOS()==null?"":srDomainFinding.getSRGRPDOS());
retStr.append("|");
//SRSEX -- > Sex
retStr.append(srDomainFinding.getSRSEX()==null?"":srDomainFinding.getSRSEX());
retStr.append("|");
//SRSTDY --> Study Day of Start of Finding
retStr.append("");
retStr.append("|");
//SRSTPHSE --> Study Phase of first Observation, “PRE-DOSING”, “DOSING”, “RECOVERY”
retStr.append("");
retStr.append("|");
//SROBSTDY --> Start Phase Day of Observation
retStr.append("");
retStr.append("|");
//SRENPHSE -->Study Phase of last Observation
retStr.append("");
retStr.append("|");
//SRDOMAIN --> Domain of Finding
retStr.append(srDomainFinding.getSRDOMAIN()==null?"":srDomainFinding.getSRDOMAIN());
retStr.append("|");
//SRSPEC --> Specimen of Finding
retStr.append(srDomainFinding.getSRSPEC()==null?"":srDomainFinding.getSRSPEC());
retStr.append("|");
//SRTSTCD --> Test Short Name
retStr.append(srDomainFinding.getSRTSTCD()==null?"":srDomainFinding.getSRTSTCD());
retStr.append("|");
//SRFNDG --> Finding
retStr.append(srDomainFinding.getSRFNDG()==null?"":srDomainFinding.getSRFNDG());
retStr.append("|");
//SRORES --> Observation (original result)
retStr.append(srDomainFinding.getSRORES()==null?"":srDomainFinding.getSRORES());
retStr.append("|");
//SROBSV --> Manifestation of Finding, “I” (Increase), “D” (Decrease), “P” (Present) or “A” (Absent)
retStr.append(srDomainFinding.getSROBSV()==null?"":srDomainFinding.getSROBSV());
retStr.append("|");
//SROBSQ --> Observation Qualifier, “R” (Reversible), “T” (Transient) or ‘none’
retStr.append(srDomainFinding.getSROBSQ()==null?"":srDomainFinding.getSROBSQ());
retStr.append("|");
//SRSEV --> Severity of Finding
retStr.append("");
retStr.append("|");
//SRPCNT --> Scale of this Finding
retStr.append("");
retStr.append("|");
//SRSIGF --> Statistical Significance
retStr.append(srDomainFinding.getSRSIGF()==null?"":srDomainFinding.getSRSIGF());
retStr.append("|");
//SRTRTEF --> Treatment-Related
retStr.append(srDomainFinding.getSRTRTEF()==null?"":srDomainFinding.getSRTRTEF());
retStr.append("|");
//SRCOMNT --> Comment
retStr.append("\n");
if(finding.getSrDomainFindings()!=null) {
for (SRDomainFinding srDomainFinding : finding.getSrDomainFindings()) {
//STUDYID -- > Study Identifier
retStr.append(id);
retStr.append("|");
//DOMAIN -- > Domain Abbreviation, always SR
retStr.append("SR");
retStr.append("|");
//SRSEQ -- > Sequence number
retStr.append("");
retStr.append("|");
//SRRISK --> Effect Level Associated with a Group/Sex, NOEL, LOEL, NOAEL, LOAEL, HNSTD, STD, MTD
retStr.append(srDomainFinding.getSRRISK()==null?"":srDomainFinding.getSRRISK());
retStr.append("|");
//SPGRPCD --> Sponsor-defined Group Code, group 1 , A
retStr.append(srDomainFinding.getSPGRPCD()==null?"":srDomainFinding.getSPGRPCD());
retStr.append("|");
//GRPLBL --> Sponsor-defined Group Name, "low dose", "mid dose"
retStr.append(srDomainFinding.getGRPLBL()==null?"":srDomainFinding.getGRPLBL());
retStr.append("|");
//SRGRPDOS --> Group Dose Level, "20 mg/kg"
retStr.append(srDomainFinding.getSRGRPDOS()==null?"":srDomainFinding.getSRGRPDOS());
retStr.append("|");
//SRSEX -- > Sex
retStr.append(srDomainFinding.getSRSEX()==null?"":srDomainFinding.getSRSEX());
retStr.append("|");
//SRSTDY --> Study Day of Start of Finding
retStr.append("");
retStr.append("|");
//SRSTPHSE --> Study Phase of first Observation, “PRE-DOSING”, “DOSING”, “RECOVERY”
retStr.append("");
retStr.append("|");
//SROBSTDY --> Start Phase Day of Observation
retStr.append("");
retStr.append("|");
//SRENPHSE -->Study Phase of last Observation
retStr.append("");
retStr.append("|");
//SRDOMAIN --> Domain of Finding
retStr.append(srDomainFinding.getSRDOMAIN()==null?"":srDomainFinding.getSRDOMAIN());
retStr.append("|");
//SRSPEC --> Specimen of Finding
retStr.append(srDomainFinding.getSRSPEC()==null?"":srDomainFinding.getSRSPEC());
retStr.append("|");
//SRTSTCD --> Test Short Name
retStr.append(srDomainFinding.getSRTSTCD()==null?"":srDomainFinding.getSRTSTCD());
retStr.append("|");
//SRFNDG --> Finding
retStr.append(srDomainFinding.getSRFNDG()==null?"":srDomainFinding.getSRFNDG());
retStr.append("|");
//SRORES --> Observation (original result)
retStr.append(srDomainFinding.getSRORES()==null?"":srDomainFinding.getSRORES());
retStr.append("|");
//SROBSV --> Manifestation of Finding, “I” (Increase), “D” (Decrease), “P” (Present) or “A” (Absent)
retStr.append(srDomainFinding.getSROBSV()==null?"":srDomainFinding.getSROBSV());
retStr.append("|");
//SROBSQ --> Observation Qualifier, “R” (Reversible), “T” (Transient) or ‘none’
retStr.append(srDomainFinding.getSROBSQ()==null?"":srDomainFinding.getSROBSQ());
retStr.append("|");
//SRSEV --> Severity of Finding
retStr.append("");
retStr.append("|");
//SRPCNT --> Scale of this Finding
retStr.append("");
retStr.append("|");
//SRSIGF --> Statistical Significance
retStr.append(srDomainFinding.getSRSIGF()==null?"":srDomainFinding.getSRSIGF());
retStr.append("|");
//SRTRTEF --> Treatment-Related
retStr.append(srDomainFinding.getSRTRTEF()==null?"":srDomainFinding.getSRTRTEF());
retStr.append("|");
//SRCOMNT --> Comment
retStr.append("\n");
}
}
}
return retStr.toString().getBytes(Charset.forName("UTF-8"));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment