RSS-188: Study Type Number is a single component, added more components

This commit is contained in:
deiflaender 2022-11-10 14:07:19 +01:00
parent ab7f1bddb4
commit c5e3f5ea07

View File

@ -95,98 +95,112 @@ public class RSSPoc2Service {
redactionLog.getRedactionLogEntry().removeIf(r -> !r.isRedacted() || r.getChanges().get(r.getChanges().size() - 1).getType().equals(ChangeType.REMOVED));
resultMap.put(oecd + "-Study_Title", getTitle(redactionLog));
resultMap.put(oecd + "-Report_Number:", getReportNumber(redactionLog));
resultMap.put(oecd + "-PERFORMING_LABORATORY:", getPerformingLaboratory(redactionLog));
resultMap.put(oecd + "-Experimental_Starting_Date:", getExperimentalStartDate(redactionLog));
resultMap.put(oecd + "-Experimental_Completion_Date:", getExperimentalEndDate(redactionLog));
resultMap.put(oecd + "-GLP_Study", getGlpStudy(redactionLog));
resultMap.put(oecd + "-Certificate_of_Analysis,_Batch_Identification", getBatchNumber(redactionLog));
resultMap.put(oecd + "-TEST_GUIDELINE(S):_1", getTestGuideline1(redactionLog));
resultMap.put("Study_Type_Number", oecd);
resultMap.put("Study_Title", getTitle(redactionLog));
resultMap.put("Report_Number", getReportNumber(redactionLog));
resultMap.put("PERFORMING_LABORATORY", getPerformingLaboratory(redactionLog));
resultMap.put("Experimental_Starting_Date", getExperimentalStartDate(redactionLog));
resultMap.put("Experimental_Completion_Date", getExperimentalEndDate(redactionLog));
resultMap.put("GLP_Study", getGlpStudy(redactionLog));
resultMap.put("Certificate_of_Analysis,_Batch_Identification", getBatchNumber(redactionLog));
resultMap.put("TEST_GUIDELINE(S):_1", getTestGuideline1(redactionLog));
var testGuideline2 = getTestGuideline2(redactionLog);
resultMap.put(oecd + "-TEST_GUIDELINE(S):_2", testGuideline2 == null ? "" : testGuideline2);
resultMap.put("TEST_GUIDELINE(S):_2", testGuideline2 == null ? "" : testGuideline2);
if (oecdIn(oecd, Set.of("402", "403", "404", "405", "425", "429", "436", "471"))) {
resultMap.put(oecd + "-Study_Conclusion", getStudyConclusion(redactionLog));
resultMap.put("Study_Conclusion", getStudyConclusion(redactionLog));
var guidelineDeviationSentences = getAsSentences(redactionLog, "guideline_deviation");
int i = 1;
for (String guidelineDeviationSentence : guidelineDeviationSentences) {
resultMap.put(oecd + "-Deviation_from_the_Guideline_(Study_Plan)_" + i, guidelineDeviationSentence);
resultMap.put("Deviation_from_the_Guideline_(Study_Plan)_" + i, guidelineDeviationSentence);
i++;
}
}
if (oecdIn(oecd, Set.of("402", "403", "404", "405", "425", "429", "436"))) {
resultMap.put(oecd + "-Species", getSpecies(redactionLog));
resultMap.put(oecd + "-Strain", getStrain(redactionLog));
resultMap.put("Species", getSpecies(redactionLog));
resultMap.put("Strain", getStrain(redactionLog));
}
if (oecdIn(oecd, Set.of("402", "403", "425", "436"))) {
resultMap.put(oecd + "-Conclusion_-_LD50_(mg/L)", getLd50Value(redactionLog));
resultMap.put(oecd + "-Conclusion -LD50_Greater_than", getLd50GreaterThan(redactionLog));
resultMap.put(oecd + "-Conclusion_-_Minimum_Confidence", getConfidenceMinimal(redactionLog));
resultMap.put(oecd + "-Conclusion_-_Maximum_Confidence", getConfidenceMaximal(redactionLog));
resultMap.put("Conclusion_-_LD50_(mg/L)", getLd50Value(redactionLog));
resultMap.put("Conclusion -LD50_Greater_than", getLd50GreaterThan(redactionLog));
resultMap.put("Conclusion_-_Minimum_Confidence", getConfidenceMinimal(redactionLog));
resultMap.put("Conclusion_-_Maximum_Confidence", getConfidenceMaximal(redactionLog));
}
if (oecdIn(oecd, Set.of("402", "403", "436"))) {
resultMap.put("Necropsy_findings", getLongestBlock(redactionLog, "necropsy_findings"));
}
if (oecdIn(oecd, Set.of("403", "436"))) {
resultMap.put("Conducted_with_4_hours_of_Exposure?", getAsOneBlock(redactionLog, "4h_exposure"));
}
if (oecdIn(oecd, Set.of("406", "428", "438", "439", "471", "474", "487"))) {
resultMap.put(oecd + "-Study_Design", getAsOneBlock(redactionLog, "study_design"));
resultMap.put("Study_Design", getAsOneBlock(redactionLog, "study_design"));
}
if (oecdIn(oecd, Set.of("406", "428", "438", "439", "474", "487"))) {
resultMap.put(oecd + "-Results_and_Conclusions", getResultsAndConclusion(redactionLog));
resultMap.put("Results_and_Conclusions", getResultsAndConclusion(redactionLog));
}
if (oecdIn(oecd, Set.of("402"))) {
var weightBehaviorChangesSentences = getAsSentences(redactionLog, "weight_behavior_changes");
int i = 1;
for (String sentence : weightBehaviorChangesSentences) {
resultMap.put(oecd + "-Weight_Behavior_Change_" + i, sentence);
resultMap.put("Weight_Behavior_Change_" + i, sentence);
i++;
}
resultMap.put("Mortality_statement", getAsOneBlock(redactionLog, "mortality_statement"));
}
if (oecdIn(oecd, Set.of("403"))) {
resultMap.put(oecd + "-MMAD", getMmad(redactionLog));
resultMap.put(oecd + "-GSD", getGsd(redactionLog));
resultMap.put("MMAD", getMmad(redactionLog));
resultMap.put("GSD", getGsd(redactionLog));
var effectiveConcentrations = getEffectiveConcentrations(redactionLog);
Iterator<String> effectiveConcentrationsIterator = effectiveConcentrations.iterator();
int i = 1;
while (effectiveConcentrationsIterator.hasNext()) {
String effectiveConcentration = effectiveConcentrationsIterator.next();
resultMap.put(oecd + "-Effective_Concentration_(mg/L_of_air)_" + i, effectiveConcentration);
resultMap.put("Effective_Concentration_(mg/L_of_air)_" + i, effectiveConcentration);
i++;
}
var sentences = getAsSentences(redactionLog, "clinical_observations");
i = 1;
for (String sentence : sentences) {
resultMap.put(oecd + "-Clinical_Observations_" + i, sentence);
resultMap.put("Clinical_Observations_" + i, sentence);
i++;
}
sentences = getAsSentences(redactionLog, "bodyweight_changes");
i = 1;
for (String sentence : sentences) {
resultMap.put(oecd + "-Body_weight_changes_" + i, sentence);
resultMap.put("Body_weight_changes_" + i, sentence);
i++;
}
}
if (oecdIn(oecd, Set.of("404"))) {
resultMap.put(oecd + "-Dose_(ml/animal)", getDoseMlPerAnimal(redactionLog));
resultMap.put(oecd + "-Was_there_dilution_of_the_test_substance?", getDilution(redactionLog));
resultMap.put(oecd + "-Detailing_of_reported_changes", getAsOneBlock(redactionLog, "detailing"));
resultMap.put("Dose_(ml/animal)", getDoseMlPerAnimal(redactionLog));
resultMap.put("Was_there_dilution_of_the_test_substance?", getDilution(redactionLog));
resultMap.put("Detailing_of_reported_changes", getAsOneBlock(redactionLog, "detailing"));
}
if (oecdIn(oecd, Set.of("405"))) {
var sentences = getAsSentences(redactionLog, "detailing");
int i = 1;
for (String sentence : sentences) {
resultMap.put(oecd + "-Detailing_of_reported_changes_" + i, sentence);
resultMap.put("Detailing_of_reported_changes_" + i, sentence);
i++;
}
}
@ -196,30 +210,30 @@ public class RSSPoc2Service {
var clinicalSignsSentences = getAsSentences(redactionLog, "clinical_signs");
int i = 1;
for (String clinicalSignsSentence : clinicalSignsSentences) {
resultMap.put(oecd + "-Clincal_Signs_" + i, clinicalSignsSentence);
resultMap.put("Clincal_Signs_" + i, clinicalSignsSentence);
i++;
}
var mortalitySentences = getAsSentences(redactionLog, "mortality");
i = 1;
for (String mortalitySentence : mortalitySentences) {
resultMap.put(oecd + "-Mortality_" + i, mortalitySentence);
resultMap.put("Mortality_" + i, mortalitySentence);
i++;
}
resultMap.put(oecd + "-Dosages", getDosages(redactionLog));
resultMap.put("Dosages", getDosages(redactionLog));
}
if (oecdIn(oecd, Set.of("429"))) {
var sentences = getAsSentences(redactionLog, "preliminary_test_results");
int i = 1;
for (String sentence : sentences) {
resultMap.put(oecd + "-Preliminary_test_results" + i, sentence);
resultMap.put("Preliminary_test_results" + i, sentence);
i++;
}
resultMap.put(oecd + "-Test_results", getAsOneBlock(redactionLog, "test_results"));
resultMap.put(oecd + "-Was_the_definitive_study_conducted_with_positive_control?", getAsOneBlock(redactionLog, "positive_control"));
resultMap.put("Test_results", getAsOneBlock(redactionLog, "test_results"));
resultMap.put("Was_the_definitive_study_conducted_with_positive_control?", getAsOneBlock(redactionLog, "positive_control"));
}
rssFileResponses.add(new RSSFileResponse(file.getFilename(), resultMap));
@ -231,6 +245,18 @@ public class RSSPoc2Service {
}
private String getLongestBlock(RedactionLog redactionLog, String type) {
return redactionLog.getRedactionLogEntry()
.stream()
.filter(r -> r.getType().equals(type))
.map(RedactionLogEntry::getValue)
.sorted(Comparator.comparing(String::length).reversed())
.findFirst()
.orElse("");
}
private String getAsOneBlock(RedactionLog redactionLog, String type) {
return redactionLog.getRedactionLogEntry().stream().filter(r -> r.getType().equals(type)).map(RedactionLogEntry::getValue).collect(Collectors.joining(" "));