Exemplo n.º 1
0
    def build_tbl(self, data):
        tbl = TableMaker(self.COLUMN_WIDTHS,
                         numHeaders=1,
                         firstRowCaption=False,
                         tblStyle="ntpTbl")

        # write header
        tbl.new_th(
            0,
            0,
            "Study design\nSpecies, strain (sex)\nAge at start\nDuration\nReference",
        )
        tbl.new_th(
            0,
            1,
            "Route\nAgent tested, purity\nVehicle\nDose(s)\n"
            "# animals at start\n# surviving animals",
        )
        tbl.new_th(0, 2, "Results")
        tbl.new_th(0, 3, "Significance")
        tbl.new_th(0, 4, "Comments")

        docx_tbl = tbl.render(self.doc)
        for d in data["studies"]:
            inner_tbl = self._build_study(d)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 2
0
    def build_tbl(self, data):
        tbl = TableMaker(
            self.COLUMN_WIDTHS, numHeaders=1, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # write header
        tbl.new_th(
            0,
            0,
            "Study design\nSpecies, strain (sex)\nAge at start\nDuration\nReference",
        )
        tbl.new_th(
            0,
            1,
            "Route\nAgent tested, purity\nVehicle\nDose(s)\n"
            "# animals at start\n# surviving animals",
        )
        tbl.new_th(0, 2, "Results")
        tbl.new_th(0, 3, "Significance")
        tbl.new_th(0, 4, "Comments")

        docx_tbl = tbl.render(self.doc)
        for d in data["studies"]:
            inner_tbl = self._build_study(d)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 3
0
    def build_bias_table(self, biasNames, descriptions):
        tbl = TableMaker(
            self.COLUMN_WIDTHS, numHeaders=0, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # write header
        tbl.new_th(0, 0, "Reference")
        for i, bias in enumerate(biasNames):
            tbl.new_th(0, i + 1, f"{self.convertCamelCase(bias)} rating")

        docx_tbl = tbl.render(self.doc)

        for desc in descriptions:
            inner_tbl = self.build_bias(biasNames, desc)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 4
0
    def build_bias_table(self, biasNames, descriptions):
        tbl = TableMaker(self.COLUMN_WIDTHS,
                         numHeaders=0,
                         firstRowCaption=False,
                         tblStyle="ntpTbl")

        # write header
        tbl.new_th(0, 0, "Reference")
        for i, bias in enumerate(biasNames):
            tbl.new_th(0, i + 1, f"{self.convertCamelCase(bias)} rating")

        docx_tbl = tbl.render(self.doc)

        for desc in descriptions:
            inner_tbl = self.build_bias(biasNames, desc)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 5
0
    def build_tbl(self, studies):
        tbl = TableMaker(
            self.COLUMN_WIDTHS, numHeaders=1, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # write header
        tbl.new_th(0, 0, "Reference and study design")
        tbl.new_th(0, 1, "Exposure")
        tbl.new_th(0, 2, "Dose levels")
        tbl.new_th(0, 3, "Tumor incidence (n/N) (%)")
        tbl.new_th(0, 4, "Comments")

        docx_tbl = tbl.render(self.doc)

        # write body
        for study in studies:
            inner_tbl = self._build_study(study)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)

        self.doc.add_paragraph("\n".join(list(self.footnotes.values())))
Exemplo n.º 6
0
    def build_ROB_table(self, study):
        widths = [2.8, 0.7, 4.0]
        tbl = TableMaker(widths, numHeaders=2, firstRowCaption=True, tblStyle="ntpTbl")

        # add caption
        tbl.new_td_run(0, 0, self.getTableCaptionRuns(study), colspan=3)

        # add headers
        cells = ['Risk of Bias', 'Rating', 'Rating rationale']
        for i, cell in enumerate(cells):
            tbl.new_th(1, i, cell)

        # add body
        row = 2
        for d in study["qualities"]:
            tbl.new_td_txt(row, 0, d["metric"]["metric"])
            tbl.new_td_txt(row, 1, d["score_symbol"], shade=d["score_shade"])
            tbl.new_td_txt(row, 2, strip_tags(d["notes"]))
            row += 1

        return tbl.render(self.doc)
Exemplo n.º 7
0
    def build_tbl(self, studies):
        tbl = TableMaker(self.COLUMN_WIDTHS,
                         numHeaders=1,
                         firstRowCaption=False,
                         tblStyle="ntpTbl")

        # write header
        tbl.new_th(0, 0, "Reference and study design")
        tbl.new_th(0, 1, "Exposure")
        tbl.new_th(0, 2, "Dose levels")
        tbl.new_th(0, 3, "Tumor incidence (n/N) (%)")
        tbl.new_th(0, 4, "Comments")

        docx_tbl = tbl.render(self.doc)

        # write body
        for study in studies:
            inner_tbl = self._build_study(study)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)

        self.doc.add_paragraph("\n".join(list(self.footnotes.values())))
Exemplo n.º 8
0
    def buildOccupationalTable(self, exposures):
        colWidths = [1.7, 1, 1.7, 1.3, 2.0, 1.3]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = "Occupational exposure data"
        tbl.new_th(0, 0, txt, colspan=6)

        # write header
        tbl.new_th(1, 0, "Industry, country, year")
        tbl.new_th(1, 1, "Job/process")
        tbl.new_th(1, 2, "Mean, agent")
        tbl.new_th(1, 3, "Range")
        tbl.new_th(1, 4, "Comments/\nadditional data")
        tbl.new_th(1, 5, "References")

        row = 2
        for exp in exposures:
            for res in exp["results"]:
                runs = [
                    tbl.new_run(exp["occupation"], newline=True, b=True),
                    tbl.new_run(
                        f'{exp["location"] or "Not-reported"}, {exp["collectionDate"]}',
                        newline=False,
                    ),
                ]
                tbl.new_td_run(row, 0, runs)

                txt = exp["occupationInfo"] or ""
                tbl.new_td_txt(row, 1, txt)

                txt = (
                    f'{res["exposureLevel"]} {res["units"]} ({res["exposureLevelDescription"]}),'
                    f' {res["agent"]}')
                tbl.new_td_txt(row, 2, txt)

                txt = res["exposureRangePrint"]
                tbl.new_td_txt(row, 3, txt)

                txt = exp["comments"] or ""
                tbl.new_td_txt(row, 4, txt)

                txt = exp["reference"]["name"]
                tbl.new_td_txt(row, 5, txt)

                row += 1

        tbl.render(self.doc)
        self.doc.add_page_break()
Exemplo n.º 9
0
    def buildEnviroMixedTables(self, exposures, title):
        colWidths = [2, 1.5, 1.5, 2, 2]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        tbl.new_th(0, 0, title, colspan=5)

        # write header
        tbl.new_th(1, 0, "Region, country (city)")
        tbl.new_th(1, 1, "Mean, agent")
        tbl.new_th(1, 2, "Range")
        tbl.new_th(1, 3, "Comments/\nadditional data")
        tbl.new_th(1, 4, "References")

        row = 2
        for exp in exposures:
            for res in exp["results"]:
                runs = [
                    tbl.new_run(exp["country"], newline=True, b=True),
                    tbl.new_run(
                        f'{exp["location"] or "Not-reported"}, {exp["collectionDate"]}',
                        newline=False,
                    ),
                ]
                tbl.new_td_run(row, 0, runs)

                txt = (
                    f'{res["exposureLevel"]} {res["units"]} ({res["exposureLevelDescription"]}),'
                    f' {res["agent"]}')
                tbl.new_td_txt(row, 1, txt)

                txt = res["exposureRangePrint"]
                tbl.new_td_txt(row, 2, txt)

                txt = exp["comments"] or ""
                tbl.new_td_txt(row, 3, txt)

                txt = exp["reference"]["name"]
                tbl.new_td_txt(row, 4, txt)

                row += 1

        tbl.render(self.doc)
        self.doc.add_page_break()
Exemplo n.º 10
0
    def buildHumanVivoTbl(self):
        colWidths = [0.9, 1.2, 1.2, 1.3, 1.4, 0.8, 1.4, 0.8]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = f"Table 1 [Genotoxicity and related effects] of [{self.getAgent()}] in humans in vivo"
        tbl.new_th(0, 0, txt, colspan=8)

        # write header
        tbl.new_th(1, 0, "End-point")
        tbl.new_th(1, 1, "Test")
        tbl.new_th(1, 2, "Tissue")
        tbl.new_th(1, 3, "Cell type\n(if specified)")
        tbl.new_th(1, 4, "Description of exposed and controls")
        tbl.new_th(1, 5, "Response/ significance*")
        tbl.new_th(1, 6, "Comments")
        tbl.new_th(1, 7, "Reference")

        row = 2
        for d in self.context["humanInVivo"]:
            tbl.new_td_txt(row, 0, d["endpoint"])
            tbl.new_td_txt(row, 1, d["endpointTest"])

            tbl.new_td_txt(row, 2, d["tissueHuman"])
            tbl.new_td_txt(row, 3, d["cellType"])
            tbl.new_td_txt(row, 4, d["exposureDescription"])

            txt = f'{d["result"]} {d["wrd_significance"]}'
            tbl.new_td_txt(row, 5, txt)

            tbl.new_td_txt(row, 6, d["wrd_comments"])
            tbl.new_td_txt(row, 7, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(HUMAN_VIVO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 11
0
    def buildHumanInVitro(self):
        colWidths = [1.0, 1.2, 1.4, 0.9, 0.9, 1.0, 1.6, 1.0]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = (
            f"Table 2 [Genotoxicity and related effects] of [{self.getAgent()}] in "
            "human cells in vitro"
        )
        tbl.new_th(0, 0, txt, colspan=8)

        # write header
        tbl.new_th(1, 0, "End-point")
        tbl.new_th(1, 1, "Test")
        tbl.new_th(1, 2, "Tissue, cell line")
        tbl.new_th(1, 3, "Results/\nResults without metabolic activation")
        tbl.new_th(1, 4, "Results with metabolic activation")
        tbl.new_th(1, 5, "Concentration (LEC or HIC)")
        tbl.new_th(1, 6, "Comments")
        tbl.new_th(1, 7, "Reference")

        row = 2
        for d in self.context["humanInVitro"]:

            tbl.new_td_txt(row, 0, d["endpoint"])
            tbl.new_td_txt(row, 1, d["endpointTest"])

            tbl.new_td_txt(row, 2, d["tissueCellLine"])

            tbl.new_td_txt(row, 3, d["wrd_resultA"])
            tbl.new_td_txt(row, 4, d["wrd_resultB"])

            txt = f'{d["wrd_led"]} {d["units"]}'
            tbl.new_td_txt(row, 5, txt)

            tbl.new_td_txt(row, 6, d["wrd_comments"])
            tbl.new_td_txt(row, 7, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(MAMMAL_VITRO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 12
0
    def buildTable(self):
        colWidths = [1.35, 1.8, 1.35, 0.9, 0.9, 0.9, 1.8]
        tbl = TableMaker(colWidths,
                         numHeaders=1,
                         tblStyle="ntpTbl",
                         firstRowCaption=False)

        # write header
        tbl.new_th(0, 0, "Reference")
        tbl.new_th(0, 1, "Test system")
        tbl.new_th(0, 2, "Endpoint/\ntest")
        tbl.new_th(0, 3, "Results")
        tbl.new_th(0, 4, "Results (with metabolic activation)")
        tbl.new_th(0, 5, "Agent, LED/HID dose")
        tbl.new_th(0, 6, "Comments")

        row = 0
        for d in self.context["objects"]:
            row += 1

            txt = dedent(f"""\
                {d['reference']['name']}
                {d['dataClass']}""")
            tbl.new_td_txt(row, 0, txt)

            txt = d["col2"]
            tbl.new_td_txt(row, 1, txt)

            txt = d["col3"]
            tbl.new_td_txt(row, 2, txt)

            txt = d["col4"]
            tbl.new_td_txt(row, 3, txt)

            txt = d["col5"]
            tbl.new_td_txt(row, 4, txt)

            txt = d["col6"]
            tbl.new_td_txt(row, 5, txt)

            txt = d["wrd_comments"]
            tbl.new_td_txt(row, 6, txt)

        tbl.render(self.doc)
Exemplo n.º 13
0
    def buildNonMammInVitroTbl(self):
        colWidths = [0.8, 1.2, 0.9, 0.9, 0.7, 0.7, 1, 1.8, 1]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = (
            f"Table 5 [Genotoxicity and related effects] of [{self.getAgent()}] in non-mammalian"
            " species"
        )
        tbl.new_th(0, 0, txt, colspan=9)

        # write header
        tbl.new_th(1, 0, "Phylogenetic class")
        tbl.new_th(1, 1, "Test system\n(species, strain)")
        tbl.new_th(1, 2, "End-point")
        tbl.new_th(1, 3, "Test")
        tbl.new_th(1, 4, "Results/\nResults without metabolic activation")
        tbl.new_th(1, 5, "Results with metabolic activation")
        tbl.new_th(1, 6, "Agent, concentration (LEC or HIC)")
        tbl.new_th(1, 7, "Comments")
        tbl.new_th(1, 8, "Reference")

        row = 2
        for d in self.context["nonMammalianInVitro"]:
            tbl.new_td_txt(row, 0, d["phylogeneticClass"])
            tbl.new_td_txt(row, 1, d["wrd_testSystem"])
            tbl.new_td_txt(row, 2, d["endpoint"])
            tbl.new_td_txt(row, 3, d["endpointTest"])
            tbl.new_td_txt(row, 4, d["wrd_resultA"])
            tbl.new_td_txt(row, 5, d["wrd_resultB"])
            tbl.new_td_txt(row, 6, d["wrd_experimental"])
            tbl.new_td_txt(row, 7, d["wrd_comments"])
            tbl.new_td_txt(row, 8, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(NONMAMMAL_VITRO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 14
0
    def build_table(self):
        tbl = TableMaker(self.COLUMN_WIDTHS, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = "Occupational exposure data"
        tbl.new_th(0, 0, txt, colspan=7)

        # write header
        tbl.new_th(1, 0, "Reference")
        tbl.new_th(1, 1, "Location,\ncollection date")
        tbl.new_th(1, 2, "Occupation description")
        tbl.new_th(1, 3, "Sampling matrix, approach,\nN, duration")
        tbl.new_th(1, 4, "Agent,\nexposure level")
        tbl.new_th(1, 5, "Exposure range")
        tbl.new_th(1, 6, "Comments/additional data")

        docx_tbl = tbl.render(self.doc)

        # write rows
        for d in self.context["exposures"]:
            inner_tbl = self.build_row(d)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 15
0
    def build_tbl(self, data):
        tbl = TableMaker(
            self.COLUMN_WIDTHS, numHeaders=1, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # write header
        tbl.new_th(
            0, 0, "Reference, location follow-up/enrollment period, study-design"
        )  # noqa
        tbl.new_th(
            0, 1, "Population size, description, exposure assessment method"
        )  # noqa
        tbl.new_th(0, 2, "Organ site")
        tbl.new_th(0, 3, "Exposure category or level")
        tbl.new_th(0, 4, "Exposed cases/ deaths")
        tbl.new_th(0, 5, "Risk estimate (95% CI)")
        tbl.new_th(0, 6, "Covariates controlled")
        tbl.new_th(0, 7, "Comments")

        docx_tbl = tbl.render(self.doc)

        for d in data["descriptions"]:
            inner_tbl = self._build_description(d)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 16
0
    def buildEnviroMixedTables(self, exposures, title):
        colWidths = [2, 1.5, 1.5, 2, 2]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        tbl.new_th(0, 0, title, colspan=5)

        # write header
        tbl.new_th(1, 0, "Region, country (city)")
        tbl.new_th(1, 1, "Mean, agent")
        tbl.new_th(1, 2, "Range")
        tbl.new_th(1, 3, "Comments/\nadditional data")
        tbl.new_th(1, 4, "References")

        row = 2
        for exp in exposures:
            for res in exp["results"]:
                runs = [
                    tbl.new_run(exp["country"], newline=True, b=True),
                    tbl.new_run(
                        f'{exp["location"] or "Not-reported"}, {exp["collectionDate"]}',
                        newline=False,
                    ),
                ]
                tbl.new_td_run(row, 0, runs)

                txt = (
                    f'{res["exposureLevel"]} {res["units"]} ({res["exposureLevelDescription"]}),'
                    f' {res["agent"]}'
                )
                tbl.new_td_txt(row, 1, txt)

                txt = res["exposureRangePrint"]
                tbl.new_td_txt(row, 2, txt)

                txt = exp["comments"] or ""
                tbl.new_td_txt(row, 3, txt)

                txt = exp["reference"]["name"]
                tbl.new_td_txt(row, 4, txt)

                row += 1

        tbl.render(self.doc)
        self.doc.add_page_break()
Exemplo n.º 17
0
    def _build_table(self, data):
        tbl = TableMaker(
            self.COLUMN_WIDTHS, numHeaders=0, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # write header
        tbl.new_th(0, 0, "Exposure assessment method")
        tbl.new_th(0, 1, "Description")
        tbl.new_th(0, 2, "Strengths")
        tbl.new_th(0, 3, "Limitations")
        tbl.new_th(0, 4, "Reference")
        tbl.new_th(0, 5, "Notes")

        # write data rows
        for i, d in enumerate(data["descriptions"]):
            r = i + 1

            txt = null_getter(d, "exposureAssessmentType")
            tbl.new_td_txt(r, 0, txt)

            txt = "\n".join(
                [
                    null_getter(d, "exposureAssessmentPopulationDetails"),
                    null_getter(d, "exposureAssessmentNotes"),
                ]
            )
            tbl.new_td_txt(r, 1, txt)

            txt = null_getter(d, "exposureAssessmentStrengths")
            tbl.new_td_txt(r, 2, txt)

            txt = null_getter(d, "exposureAssessmentLimitations")
            tbl.new_td_txt(r, 3, txt)

            txt = d["reference"]["name"]
            tbl.new_td_txt(r, 4, txt)

            txt = null_getter(d, "exposureAssessmentComments")
            tbl.new_td_txt(r, 5, txt)

        return tbl
Exemplo n.º 18
0
    def buildAniVivoTbl(self):
        colWidths = [1.0, 1.0, 1.0, 1.0, 0.5, 0.7, 1.2, 1.6, 1]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = (
            f"Table 3 [Genotoxicity and related effects] of [{self.getAgent()}] in non-human "
            "mammals in vivo")
        tbl.new_th(0, 0, txt, colspan=9)

        # write header
        tbl.new_th(1, 0, "End-point")
        tbl.new_th(1, 1, "Test")
        tbl.new_th(1, 2, "Species, strain, sex")
        tbl.new_th(1, 3, "Tissue")
        tbl.new_th(1, 4, "Results")
        tbl.new_th(1, 5, "Agent, dose (LED or HID)")
        tbl.new_th(1, 6, "Route, duration, dosing regimen")
        tbl.new_th(1, 7, "Comments")
        tbl.new_th(1, 8, "Reference")

        row = 2
        for d in self.context["animalInVivo"]:

            tbl.new_td_txt(row, 0, d["endpoint"])

            tbl.new_td_txt(row, 1, d["endpointTest"])

            txt = f'{d["species"]} {d["strain"]} { d["sex"]}'
            tbl.new_td_txt(row, 2, txt)

            tbl.new_td_txt(row, 3, d["tissueAnimal"])

            tbl.new_td_txt(row, 4, d["result"])

            txt = dedent(f"""\
                {d["agent"]}
                LED/HID: {d["wrd_led"]} {d["units"]}""")
            tbl.new_td_txt(row, 5, txt)

            txt = dedent(f"""\
                {d["dosingRoute"]};
                {d["dosingDuration"]}""")
            tbl.new_td_txt(row, 6, txt)

            tbl.new_td_txt(row, 7, d["wrd_comments"])
            tbl.new_td_txt(row, 8, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(ANIMAL_VIVO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 19
0
    def _build_table(self, data):
        tbl = TableMaker(
            self.COLUMN_WIDTHS, numHeaders=0, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # write header
        tbl.new_th(0, 0, "")
        tbl.new_th(0, 1, "Bias", colspan=6)
        tbl.new_th(0, 7, "Quality")
        tbl.new_th(0, 8, "Utility")

        tbl.new_th(1, 0, "Citation")
        tbl.new_th(1, 1, "Selection", vertical=True, height=0.5)
        tbl.new_th(1, 2, "Exposure", vertical=True)
        tbl.new_th(1, 3, "Outcome", vertical=True)
        tbl.new_th(1, 4, "Confounding methods", vertical=True)
        tbl.new_th(1, 5, "Adequacy of analysis", vertical=True)
        tbl.new_th(1, 6, "Selective reporting", vertical=True)
        tbl.new_th(1, 7, "Sensitivity", vertical=True)
        tbl.new_th(1, 8, "Integration", vertical=True)

        # write data rows
        for i, d in enumerate(data["descriptions"]):
            r = i + 2
            tbl.new_td_txt(r, 0, d["reference"]["name"])
            tbl.new_td_txt(r, 1, d["selectionBiasRating"])
            tbl.new_td_txt(r, 2, d["exposureAssessmentRating"])
            tbl.new_td_txt(r, 3, d["outcomeAssessmentRating"])
            confounders = [
                f'{conf["organSiteCategory"]}: {conf["confoundingRating"]}'
                for conf in d["confounders"]
            ]
            tbl.new_td_txt(r, 4, "\n".join(confounders))
            tbl.new_td_txt(r, 5, d["analysisRating"])
            tbl.new_td_txt(r, 6, d["selectiveReportingRating"])
            tbl.new_td_txt(r, 7, d["sensitivityRating"])
            tbl.new_td_txt(r, 8, d["overallUtility"])

        return tbl
Exemplo n.º 20
0
    def build_summary_table(self, ag):
        widths = [2.5, 2.7, 1.5, 0.5, 1.2, 1.6]
        tbl = TableMaker(widths, numHeaders=3, firstRowCaption=True, tblStyle="ntpTbl")

        doses = self.getDoses(ag)
        firstDose = doses.keys()[0]

        # add caption
        tbl.new_td_txt(0, 0, ag['name'], colspan=6)

        # add headers
        tbl.new_th(1, 0, r'Reference, Animal Model, and Dosing', rowspan=2)
        tbl.new_th(1, 1, r'Health outcome', rowspan=2)
        tbl.new_th(1, 2, r'Results', colspan=4)

        tbl.new_th(2, 2, u'Dose ({0})'.format(firstDose))
        tbl.new_th(2, 3, r'N')
        tbl.new_th(2, 4, u'Mean \u00B1 SD',)
        tbl.new_th(2, 5, r'% control (95% CI)')

        # build endpoint rows
        rows = 3
        for ep in ag["eps"]:

            if ep["data_extracted"] == False:
                continue

            # add endpoint-name as first-row
            tbl.new_td_run(
                rows, 2,
                [TableMaker.new_run(ep["name"], i=True, newline=False)],
                colspan=4
            )
            rows += 1

            # build column-header table
            data_type = ep["data_type"]
            for i, eg in enumerate(ep["groups"]):

                ci = []
                resp = u"-"

                if data_type == "C":
                    resp = unicode(eg.get("response", "-"))
                    if eg.get('stdev') is not None:
                        resp += u' \u00B1 {0:.2f}'.format(eg["stdev"])
                elif data_type in ["D", "DC"]:
                    if eg.get("incidence") is not None:
                        resp = u'{0}/{1}'.format(eg["incidence"], eg["n"])
                    ci.append(u"NR")
                else:  # ["P"]
                    resp = u'NR'

                if i != 0 and eg.get("percentControlMean") is not None:
                    ci.append("{0:.1f}".format(eg["percentControlMean"]))
                if eg.get("percentControlLow") is not None and eg.get("percentControlHigh") is not None:
                    ci.append(u'({0:.1f}, {1:.1f})'.format(eg["percentControlLow"], eg["percentControlHigh"]))
                ci = u" ".join(ci)

                tbl.new_td_txt(rows, 2, unicode(doses[firstDose][i]))
                tbl.new_td_txt(rows, 3, unicode(eg.get("n", "-")))
                tbl.new_td_txt(rows, 4, resp)
                tbl.new_td_txt(rows, 5, ci)
                rows += 1
        else:
            # add blank cells if none-exist
            tbl.new_td_txt(3, 2, "")
            tbl.new_td_txt(3, 3, "")
            tbl.new_td_txt(3, 4, "")
            tbl.new_td_txt(3, 5, "")

        # adjust rowspans for summary rows
        rowspan = rows - 3
        tbl.new_td_run(3, 0, self.getStudyDetailsRuns(ag, doses), rowspan=rowspan)
        tbl.new_td_run(3, 1, self.getHealthOutcomes(ag), rowspan=rowspan)

        tbl.render(self.doc)
        self.doc.add_paragraph("\n")
Exemplo n.º 21
0
    def build_desc_tbl(self, caption, descriptions, site):
        tbl = TableMaker(self.COLUMN_WIDTHS, numHeaders=2, tblStyle="ntpTbl")

        # write title
        tbl.new_th(0, 0, caption, colspan=6)

        # write header
        tbl.new_th(1, 0, "Reference, study-design, location, and year")
        tbl.new_th(1, 1, "Population description & exposure assessment method")
        tbl.new_th(1, 2, "Exposure category or level")
        tbl.new_th(1, 3, "Risk estimate\n(95% CI); exposed cases")
        tbl.new_th(1, 4, "Co-variates controlled")
        tbl.new_th(1, 5, "Comments, strengths, and weaknesses")

        docx_tbl = tbl.render(self.doc)

        # write additional rows
        for desc in descriptions:
            inner_tbl = self._build_description(desc, site)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 22
0
    def buildOccupationalTable(self, exposures):
        colWidths = [1.7, 1, 1.7, 1.3, 2.0, 1.3]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = "Occupational exposure data"
        tbl.new_th(0, 0, txt, colspan=6)

        # write header
        tbl.new_th(1, 0, "Industry, country, year")
        tbl.new_th(1, 1, "Job/process")
        tbl.new_th(1, 2, "Mean, agent")
        tbl.new_th(1, 3, "Range")
        tbl.new_th(1, 4, "Comments/\nadditional data")
        tbl.new_th(1, 5, "References")

        row = 2
        for exp in exposures:
            for res in exp["results"]:
                runs = [
                    tbl.new_run(exp["occupation"], newline=True, b=True),
                    tbl.new_run(
                        f'{exp["location"] or "Not-reported"}, {exp["collectionDate"]}',
                        newline=False,
                    ),
                ]
                tbl.new_td_run(row, 0, runs)

                txt = exp["occupationInfo"] or ""
                tbl.new_td_txt(row, 1, txt)

                txt = (
                    f'{res["exposureLevel"]} {res["units"]} ({res["exposureLevelDescription"]}),'
                    f' {res["agent"]}'
                )
                tbl.new_td_txt(row, 2, txt)

                txt = res["exposureRangePrint"]
                tbl.new_td_txt(row, 3, txt)

                txt = exp["comments"] or ""
                tbl.new_td_txt(row, 4, txt)

                txt = exp["reference"]["name"]
                tbl.new_td_txt(row, 5, txt)

                row += 1

        tbl.render(self.doc)
        self.doc.add_page_break()
Exemplo n.º 23
0
    def buildNonMammInVitroTbl(self):
        colWidths = [0.8, 1.2, 0.9, 0.9, 0.7, 0.7, 1, 1.8, 1]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = (
            f"Table 5 [Genotoxicity and related effects] of [{self.getAgent()}] in non-mammalian"
            " species")
        tbl.new_th(0, 0, txt, colspan=9)

        # write header
        tbl.new_th(1, 0, "Phylogenetic class")
        tbl.new_th(1, 1, "Test system\n(species, strain)")
        tbl.new_th(1, 2, "End-point")
        tbl.new_th(1, 3, "Test")
        tbl.new_th(1, 4, "Results/\nResults without metabolic activation")
        tbl.new_th(1, 5, "Results with metabolic activation")
        tbl.new_th(1, 6, "Agent, concentration (LEC or HIC)")
        tbl.new_th(1, 7, "Comments")
        tbl.new_th(1, 8, "Reference")

        row = 2
        for d in self.context["nonMammalianInVitro"]:
            tbl.new_td_txt(row, 0, d["phylogeneticClass"])
            tbl.new_td_txt(row, 1, d["wrd_testSystem"])
            tbl.new_td_txt(row, 2, d["endpoint"])
            tbl.new_td_txt(row, 3, d["endpointTest"])
            tbl.new_td_txt(row, 4, d["wrd_resultA"])
            tbl.new_td_txt(row, 5, d["wrd_resultB"])
            tbl.new_td_txt(row, 6, d["wrd_experimental"])
            tbl.new_td_txt(row, 7, d["wrd_comments"])
            tbl.new_td_txt(row, 8, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(NONMAMMAL_VITRO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 24
0
    def build_tbl(self, study):
        colWidths = (2, 4.5)
        tbl = TableMaker(
            colWidths, numHeaders=1, firstRowCaption=False, tblStyle="ntpTbl"
        )

        # Table caption
        txt = (
            f'Table X: {study["reference"]["name"]} ({study["sex"]} '
            f'{study["species"]}): {study["agent"]}: {study["dosingRoute"]}'
        )
        self.doc.add_heading(txt, level=2)

        # write header
        tbl.new_th(0, 0, "Study utility domain and question")
        tbl.new_th(0, 1, "Rating and rationale")

        # study design section
        self.add_rr_header(tbl, 1, "Study design")

        self.add_rr_row(
            tbl,
            2,
            "Randomization",
            study["randomizationRating"],
            study["randomizationRationale"],
        )

        self.add_rr_row(
            tbl,
            3,
            "Controls",
            study["concurrentControlsRating"],
            study["concurrentControlsRationale"],
        )

        tbl.new_td_txt(4, 0, "Historical data")
        response = "Yes" if study["historicalDataAvailable"] is True else "No"
        tbl.new_td_txt(4, 1, response)

        self.add_rr_row(
            tbl,
            5,
            "Animal model (sensitivity)",
            study["animalModelSensitivityRating"],
            study["animalModelSensitivityRationale"],
        )

        self.add_rr_row(
            tbl,
            6,
            "Statistical power (sensitivity)",
            study["statisticalPowerRating"],
            study["statisticalPowerRationale"],
        )

        # exposure section
        self.add_rr_header(tbl, 7, "Exposure")

        self.add_rr_row(
            tbl,
            8,
            "Chemical characterization",
            study["chemicalCharacterizationRating"],
            study["chemicalCharacterizationRationale"],
        )

        self.add_rr_row(
            tbl,
            9,
            "Dosing regimen",
            study["dosingRegimenRating"],
            study["dosingRegimenRationale"],
        )

        self.add_rr_row(
            tbl,
            10,
            "Exposure duration (sensitivity)",
            study["exposureDurationRating"],
            study["exposureDurationRationale"],
        )

        self.add_rr_row(
            tbl,
            11,
            "Dose-response (sensitivity)",
            study["doseResponseRating"],
            study["doseResponseRationale"],
        )

        # outcome section
        self.add_rr_header(tbl, 12, "Outcome")

        self.add_rr_row(
            tbl,
            13,
            "Pathology",
            study["outcomeMethodsRating"],
            study["outcomeMethodsRationale"],
        )

        self.add_rr_row(
            tbl,
            14,
            "Consistency between groups",
            study["groupConsistencyRating"],
            study["groupConsistencyRationale"],
        )

        self.add_rr_row(
            tbl,
            15,
            "Study duration (sensitivity)",
            study["durationRating"],
            study["durationRationale"],
        )

        # confounding section
        self.add_rr_header(tbl, 16, "Confounding")

        self.add_rr_row(
            tbl,
            17,
            "Confounding",
            study["confoundingRating"],
            study["confoundingRationale"],
        )

        # reporting & analysis section
        self.add_rr_header(tbl, 18, "Reporting and analysis")

        self.add_rr_row(
            tbl,
            19,
            "Reporting data and statistics",
            study["statisticalReportingRating"],
            study["statisticalReportingRationale"],
        )

        self.add_rr_row(
            tbl,
            20,
            "Combining lesions",
            study["tumorCombiningRating"],
            study["tumorCombiningRationale"],
        )

        # render table
        tbl.render(self.doc)

        # overall utility
        txt = f' {study["overallUtility"]}. {study["overallUtilityRationale"]}'
        p = self.doc.add_paragraph("")
        p.add_run("Overall utility: ").bold = True
        p.add_run(txt)

        self.doc.add_page_break()
Exemplo n.º 25
0
    def buildTable(self):
        colWidths = [1, 1, 1, 1, 1, 1, 1, .7, 1]
        tbl = TableMaker(
            colWidths, numHeaders=1, tblStyle="ntpTbl", firstRowCaption=False
        )

        # write header
        tbl.new_th(0, 0, "Reference,\nagent")
        tbl.new_th(0, 1, "Location,\ndate")
        tbl.new_th(0, 2, "Setting,\nscenario")
        tbl.new_th(0, 3, "Sampling\nmatrix")
        tbl.new_th(0, 4, "Number of\nsubjects")
        tbl.new_th(0, 5, "Mean,\nrange,\nunits")
        tbl.new_th(0, 6, "Endpoint &\nsignificance")
        tbl.new_th(0, 7, "Result")
        tbl.new_th(0, 8, "Covariates controlled")

        row = 1
        for ref in self.context["objects"]:

            rowspan = len(ref["results"])

            txt = f"{ref['reference']['name']}\n{ref['agent']}"
            tbl.new_td_txt(row, 0, txt, rowspan=rowspan)

            txt = f"{ref['location']}\n{ref['collectionDate']}"
            tbl.new_td_txt(row, 1, txt, rowspan=rowspan)

            for result in ref["results"]:

                txt = f"{result['exposureSetting']}\n{result['exposureScenario']}"
                tbl.new_td_txt(row, 2, txt)

                txt = result["samplingMatrix"]
                tbl.new_td_txt(row, 3, txt)

                txt = result["numberSubjects"]
                tbl.new_td_txt(row, 4, txt)

                txt = f"{result['exposureLevel']}\n{result['exposureLevelRange']}\n{result['units']}"
                tbl.new_td_txt(row, 5, txt)

                txt = f"{result['endpoint']}\n{result['significancePrint']}"
                tbl.new_td_txt(row, 6, txt)

                txt = result["result"]
                tbl.new_td_txt(row, 7, txt)

                txt = ",\n".join(result["covariates"])
                tbl.new_td_txt(row, 8, txt)

                row += 1

        tbl.render(self.doc)
Exemplo n.º 26
0
    def buildHumanVivoTbl(self):
        colWidths = [0.9, 1.2, 1.2, 1.3, 1.4, 0.8, 1.4, 0.8]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = f"Table 1 [Genotoxicity and related effects] of [{self.getAgent()}] in humans in vivo"
        tbl.new_th(0, 0, txt, colspan=8)

        # write header
        tbl.new_th(1, 0, "End-point")
        tbl.new_th(1, 1, "Test")
        tbl.new_th(1, 2, "Tissue")
        tbl.new_th(1, 3, "Cell type\n(if specified)")
        tbl.new_th(1, 4, "Description of exposed and controls")
        tbl.new_th(1, 5, "Response/ significance*")
        tbl.new_th(1, 6, "Comments")
        tbl.new_th(1, 7, "Reference")

        row = 2
        for d in self.context["humanInVivo"]:
            tbl.new_td_txt(row, 0, d["endpoint"])
            tbl.new_td_txt(row, 1, d["endpointTest"])

            tbl.new_td_txt(row, 2, d["tissueHuman"])
            tbl.new_td_txt(row, 3, d["cellType"])
            tbl.new_td_txt(row, 4, d["exposureDescription"])

            txt = f'{d["result"]} {d["wrd_significance"]}'
            tbl.new_td_txt(row, 5, txt)

            tbl.new_td_txt(row, 6, d["wrd_comments"])
            tbl.new_td_txt(row, 7, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(HUMAN_VIVO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 27
0
    def buildTable(self):
        colWidths = [1.35, 1.8, 1.35, 0.9, 0.9, 0.9, 1.8]
        tbl = TableMaker(
            colWidths, numHeaders=1, tblStyle="ntpTbl", firstRowCaption=False
        )

        # write header
        tbl.new_th(0, 0, "Reference")
        tbl.new_th(0, 1, "Test system")
        tbl.new_th(0, 2, "Endpoint/\ntest")
        tbl.new_th(0, 3, "Results")
        tbl.new_th(0, 4, "Results (with metabolic activation)")
        tbl.new_th(0, 5, "Agent, LED/HID dose")
        tbl.new_th(0, 6, "Comments")

        row = 0
        for d in self.context["objects"]:
            row += 1

            txt = dedent(
                f"""\
                {d['reference']['name']}
                {d['dataClass']}"""
            )
            tbl.new_td_txt(row, 0, txt)

            txt = d["col2"]
            tbl.new_td_txt(row, 1, txt)

            txt = d["col3"]
            tbl.new_td_txt(row, 2, txt)

            txt = d["col4"]
            tbl.new_td_txt(row, 3, txt)

            txt = d["col5"]
            tbl.new_td_txt(row, 4, txt)

            txt = d["col6"]
            tbl.new_td_txt(row, 5, txt)

            txt = d["wrd_comments"]
            tbl.new_td_txt(row, 6, txt)

        tbl.render(self.doc)
Exemplo n.º 28
0
    def buildHumanInVitro(self):
        colWidths = [1.0, 1.2, 1.4, 0.9, 0.9, 1.0, 1.6, 1.0]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = (
            f"Table 2 [Genotoxicity and related effects] of [{self.getAgent()}] in "
            "human cells in vitro")
        tbl.new_th(0, 0, txt, colspan=8)

        # write header
        tbl.new_th(1, 0, "End-point")
        tbl.new_th(1, 1, "Test")
        tbl.new_th(1, 2, "Tissue, cell line")
        tbl.new_th(1, 3, "Results/\nResults without metabolic activation")
        tbl.new_th(1, 4, "Results with metabolic activation")
        tbl.new_th(1, 5, "Concentration (LEC or HIC)")
        tbl.new_th(1, 6, "Comments")
        tbl.new_th(1, 7, "Reference")

        row = 2
        for d in self.context["humanInVitro"]:

            tbl.new_td_txt(row, 0, d["endpoint"])
            tbl.new_td_txt(row, 1, d["endpointTest"])

            tbl.new_td_txt(row, 2, d["tissueCellLine"])

            tbl.new_td_txt(row, 3, d["wrd_resultA"])
            tbl.new_td_txt(row, 4, d["wrd_resultB"])

            txt = f'{d["wrd_led"]} {d["units"]}'
            tbl.new_td_txt(row, 5, txt)

            tbl.new_td_txt(row, 6, d["wrd_comments"])
            tbl.new_td_txt(row, 7, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(MAMMAL_VITRO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 29
0
    def build_table(self):
        tbl = TableMaker(self.COLUMN_WIDTHS, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = "Occupational exposure data"
        tbl.new_th(0, 0, txt, colspan=7)

        # write header
        tbl.new_th(1, 0, "Reference")
        tbl.new_th(1, 1, "Location,\ncollection date")
        tbl.new_th(1, 2, "Occupation description")
        tbl.new_th(1, 3, "Sampling matrix, approach,\nN, duration")
        tbl.new_th(1, 4, "Agent,\nexposure level")
        tbl.new_th(1, 5, "Exposure range")
        tbl.new_th(1, 6, "Comments/additional data")

        docx_tbl = tbl.render(self.doc)

        # write rows
        for d in self.context["exposures"]:
            inner_tbl = self.build_row(d)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 30
0
    def build_desc_tbl(self, caption, descriptions, site):
        tbl = TableMaker(self.COLUMN_WIDTHS, numHeaders=2, tblStyle="ntpTbl")

        # write title
        tbl.new_th(0, 0, caption, colspan=6)

        # write header
        tbl.new_th(1, 0, "Reference, study-design, location, and year")
        tbl.new_th(1, 1, "Population description & exposure assessment method")
        tbl.new_th(1, 2, "Exposure category or level")
        tbl.new_th(1, 3, "Risk estimate\n(95% CI); exposed cases")
        tbl.new_th(1, 4, "Co-variates controlled")
        tbl.new_th(1, 5, "Comments, strengths, and weaknesses")

        docx_tbl = tbl.render(self.doc)

        # write additional rows
        for desc in descriptions:
            inner_tbl = self._build_description(desc, site)
            docx_tbl_inner = inner_tbl.render(self.doc)
            docx_tbl._cells.extend(docx_tbl_inner._cells)
Exemplo n.º 31
0
    def buildAniVivoTbl(self):
        colWidths = [1.0, 1.0, 1.0, 1.0, 0.5, 0.7, 1.2, 1.6, 1]
        tbl = TableMaker(colWidths, numHeaders=2, tblStyle="ntpTbl")

        # write title
        txt = (
            f"Table 3 [Genotoxicity and related effects] of [{self.getAgent()}] in non-human "
            "mammals in vivo"
        )
        tbl.new_th(0, 0, txt, colspan=9)

        # write header
        tbl.new_th(1, 0, "End-point")
        tbl.new_th(1, 1, "Test")
        tbl.new_th(1, 2, "Species, strain, sex")
        tbl.new_th(1, 3, "Tissue")
        tbl.new_th(1, 4, "Results")
        tbl.new_th(1, 5, "Agent, dose (LED or HID)")
        tbl.new_th(1, 6, "Route, duration, dosing regimen")
        tbl.new_th(1, 7, "Comments")
        tbl.new_th(1, 8, "Reference")

        row = 2
        for d in self.context["animalInVivo"]:

            tbl.new_td_txt(row, 0, d["endpoint"])

            tbl.new_td_txt(row, 1, d["endpointTest"])

            txt = f'{d["species"]} {d["strain"]} { d["sex"]}'
            tbl.new_td_txt(row, 2, txt)

            tbl.new_td_txt(row, 3, d["tissueAnimal"])

            tbl.new_td_txt(row, 4, d["result"])

            txt = dedent(
                f"""\
                {d["agent"]}
                LED/HID: {d["wrd_led"]} {d["units"]}"""
            )
            tbl.new_td_txt(row, 5, txt)

            txt = dedent(
                f"""\
                {d["dosingRoute"]};
                {d["dosingDuration"]}"""
            )
            tbl.new_td_txt(row, 6, txt)

            tbl.new_td_txt(row, 7, d["wrd_comments"])
            tbl.new_td_txt(row, 8, d["reference"]["name"])
            row += 1

        tbl.render(self.doc)
        self.doc.add_paragraph(ANIMAL_VIVO_FOOTNOTE)
        self.doc.add_page_break()
Exemplo n.º 32
0
    def buildTable(self):
        colWidths = [1, 1, 1, 1, 1, 1, 1, .7, 1]
        tbl = TableMaker(colWidths,
                         numHeaders=1,
                         tblStyle="ntpTbl",
                         firstRowCaption=False)

        # write header
        tbl.new_th(0, 0, "Reference,\nagent")
        tbl.new_th(0, 1, "Location,\ndate")
        tbl.new_th(0, 2, "Setting,\nscenario")
        tbl.new_th(0, 3, "Sampling\nmatrix")
        tbl.new_th(0, 4, "Number of\nsubjects")
        tbl.new_th(0, 5, "Mean,\nrange,\nunits")
        tbl.new_th(0, 6, "Endpoint &\nsignificance")
        tbl.new_th(0, 7, "Result")
        tbl.new_th(0, 8, "Covariates controlled")

        row = 1
        for ref in self.context["objects"]:

            rowspan = len(ref["results"])

            txt = f"{ref['reference']['name']}\n{ref['agent']}"
            tbl.new_td_txt(row, 0, txt, rowspan=rowspan)

            txt = f"{ref['location']}\n{ref['collectionDate']}"
            tbl.new_td_txt(row, 1, txt, rowspan=rowspan)

            for result in ref["results"]:

                txt = f"{result['exposureSetting']}\n{result['exposureScenario']}"
                tbl.new_td_txt(row, 2, txt)

                txt = result["samplingMatrix"]
                tbl.new_td_txt(row, 3, txt)

                txt = result["numberSubjects"]
                tbl.new_td_txt(row, 4, txt)

                txt = f"{result['exposureLevel']}\n{result['exposureLevelRange']}\n{result['units']}"
                tbl.new_td_txt(row, 5, txt)

                txt = f"{result['endpoint']}\n{result['significancePrint']}"
                tbl.new_td_txt(row, 6, txt)

                txt = result["result"]
                tbl.new_td_txt(row, 7, txt)

                txt = ",\n".join(result["covariates"])
                tbl.new_td_txt(row, 8, txt)

                row += 1

        tbl.render(self.doc)