RED-7679: Removed unnecessary logs and updated tables demo rules

This commit is contained in:
Ali Oezyetimoglu 2023-11-06 08:54:19 +01:00
parent 2462b73346
commit dfb9838787

View File

@ -1,134 +0,0 @@
package drools
import com.iqser.red.service.redaction.v1.server.redaction.model.Section
global Section section
// --------------------------------------- Your rules below this line--------------------------------------------------
rule "0a: Study Type File Attribute"
when
Section(
!fileAttributeContainsAnyOf("OECD Number","402","403","404","405","425","429","436","438","439","471","487")
&& (
text.contains("DATA REQUIREMENT")
|| text.contains("TEST GUIDELINE")
|| text.contains("MÉTODO(S) DE REFERÊNCIA(S):")
)
&& (
text.contains("OECD")
|| text.contains("EPA")
|| text.contains("OPPTS")
)
)
then
section.addFileAttribute("OECD Number", "(?<=OECD)(?:[\\w\\s,\\[\\]\\(\\)\\.]{1,10}|(?:.{5,40}(?:Number |Procedure |Guideline )))(4[\\d]{2})", true, 1);
section.addFileAttribute("OECD Number", "(?<=OECD).{5,40}Method (4[\\d]{2}).{1,65}(\\d{4})\\)", true, 1);
end
rule "1: Guidelines"
when
Section(
(
text.contains("DATA REQUIREMENT")
|| text.contains("TEST GUIDELINE")
|| text.contains("MÉTODO(S) DE REFERÊNCIA(S):")
)
&& (
text.contains("OECD")
|| text.contains("EPA")
|| text.contains("OPPTS")
)
)
then
section.redactByRegEx("(?<=OECD)(?:[\\w\\s,\\[\\]\\(\\)\\.]{1,10}|.{5,40}(?:Number |Procedure |Guideline ))(4[\\d]{2})", true, 1, "oecd_guideline_number", 1, "OECD Guideline no. found", "n-a");
section.redactByRegEx("(?<=OECD)(?:[\\w\\s,\\[\\]\\(\\)\\.]{1,10}|.{5,40}(?:Number |Procedure |Guideline ))(4[\\d]{2}),?\\s\\(?(\\d{4})\\)?", true, 2, "oecd_guideline_year", 1, "OECD Guideline year found", "n-a");
section.redactByRegEx("(?<=OECD)[\\w\\s,\\[\\]]{1,10}\\((\\d{4})\\)\\s(4[\\d]{2})", true, 1, "oecd_guideline_year", 1, "OECD Guideline year found", "n-a");
section.redactByRegEx("(?<=OECD).{5,40}Method (4[\\d]{2}).{1,65}(\\d{4})\\)", true, 1, "oecd_guideline_number", 1, "OECD Guideline number found", "n-a");
section.redactByRegEx("(?<=OECD).{5,40}Method (4[\\d]{2}).{1,65}(\\d{4})\\)", true, 2, "oecd_guideline_year", 1, "OECD Guideline year found", "n-a");
end
rule "2: Full Table extraction (Guideline Deviation)"
when
Section(
fileAttributeByLabelEqualsIgnoreCase("OECD Number","425")
&& headlineContainsWord("Full Table")
&& hasTableHeader("Sex")
)
then
section.redactSectionTextWithoutHeadLine("guideline_deviation",2,"Full table extraction into guideline deviation","n-a");
end
rule "3: Individual row extraction (Clinical Signs)"
when
Section(
fileAttributeByLabelEqualsIgnoreCase("OECD Number","425")
&& headlineContainsWord("Individual Rows")
&& hasTableHeader("Animal No.")
&& (rowEquals("Animal No.","120-2") || rowEquals("Animal No.","120-5"))
)
then
section.redactSectionTextWithoutHeadLine("clinical_signs",3,"Individual row based on animal number","n-a");
end
rule "4: Individual column extraction (Strain)"
when
Section(
fileAttributeByLabelEqualsIgnoreCase("OECD Number","425")
&& headlineContainsWord("Individual Column")
&& hasTableHeader("Sex")
)
then
section.redactCell("Sex",4,"dosages",false,"Individual column based on column header","n-a");
end
rule "5: Dose Mortality"
when
Section(
fileAttributeByLabelEqualsIgnoreCase("OECD Number","425")
&& headlineContainsWord("Combined Columns")
&& hasTableHeader("Mortality")
&& hasTableHeader("Dosage (mg/kg bw)")
)
then
section.redactCell("Mortality",5,"dose_mortality",false,"Dose Mortality found.","n-a");
section.redactCell("Dosage (mg/kg bw)",5,"dose_mortality_dose",false,"Dose Mortality dose found.","n-a");
end
rule "6: targeted cell extraction (Experimental Start date)"
when
Section(
fileAttributeByLabelEqualsIgnoreCase("OECD Number","425")
&& headlineContainsWord("Value Extraction")
&& hasTableHeader("Mortality")
&& (rowEquals("Sex","male") || rowEquals("Sex","Male"))
&& rowEquals("Mortality","Survived")
)
then
section.redactCell("Treatment start",6,"experimental_start_date",false,"Female deaths date to experimental start date","n-a");
end
rule "7: targeted cell extraction (Experimental Stop date)"
when
Section(
isInTable()
&& (searchText.contains("female") || searchText.contains("Female"))
&& searchText.contains("Survived")
)
then
section.redactCellBelow(7,"experimental_end_date",true,false,"Female deaths date to experimental start date","n-a", "Sex", "Group 2");
end
rule "8: Indicator (Species)"
when
Section(
fileAttributeByLabelEqualsIgnoreCase("OECD Number","425")
&& headlineContainsWord("Entity-Based")
&& matchesType("vertebrates")
)
then
section.redactCell("Title",8,"study_design",false,"Vertebrate study found","n-a");
end