diff --git a/model.typ b/model.typ index 5d9ee01..81aaa4c 100644 --- a/model.typ +++ b/model.typ @@ -345,9 +345,10 @@ ) for entry in entries { + let time = str(dict-get(entry, "time", "")) rows.push( ( - [#as-content(dict-get(entry, "time", ""))], + [#text(size: 8pt)[#time]], [#as-content(dict-get(entry, "event", ""))], [#as-content(dict-get(entry, "notes", ""))], ), @@ -355,7 +356,7 @@ } table( - columns: (22mm, 1.1fr, 2fr), + columns: (31mm, 1.1fr, 2fr), inset: 5pt, stroke: 0.45pt + theme-color(theme, "line"), @@ -372,7 +373,7 @@ ..rows.flatten(), ) } - +\n\n// -----------------------------------------------------------------------------\n// ----- Diagnostic hypotheses\n// -----------------------------------------------------------------------------\n\n#let confidence-bar(theme, value) = {\n let value = int(value)\n let color = if value >= 80 {\n theme-color(theme, "critical")\n } else if value >= 50 {\n theme-color(theme, "warning")\n } else {\n theme-color(theme, "info")\n }\n\n grid(\n columns: (1fr, 12mm),\n gutter: 6pt,\n align: (left + horizon, right + horizon),\n block(\n width: 100%,\n height: 5pt,\n radius: 2.5pt,\n fill: theme-color(theme, "paper_soft"),\n stroke: 0.4pt + theme-color(theme, "line"),\n )[\n #block(\n width: value * 1%,\n height: 100%,\n radius: 2.5pt,\n fill: color,\n )\n ],\n text(size: 8pt, weight: "bold", fill: color)[#(str(value) + "%")],\n )\n}\n\n#let diagnostic-list(theme, title, items) = {\n if items.len() > 0 {\n text(size: 7.5pt, weight: "bold", fill: theme-color(theme, "muted"))[#title]\n v(2pt)\n list(\n tight: true,\n ..items.map(item => text(size: 8.5pt)[#as-content(item)]),\n )\n }\n}\n\n#let render-diagnostics(theme, diagnostics) = {\n let scale = dict-get(diagnostics, "confidence_scale", (:))\n let interpretation = dict-get(scale, "interpretation", none)\n let hypotheses = dict-get(diagnostics, "hypotheses", ())\n let leading = dict-get(diagnostics, "current_leading_assessment", (:))\n let unsupported = dict-get(diagnostics, "not_yet_supported", ())\n\n if interpretation != none {\n callout(\n theme,\n [#as-content(interpretation)],\n title: "How to read confidence",\n kind: "info",\n )\n v(7pt)\n }\n\n for hypothesis in hypotheses {\n let id = dict-get(hypothesis, "id", "Dx")\n let diagnosis = dict-get(hypothesis, "diagnosis", "Diagnostic hypothesis")\n let confidence = dict-get(hypothesis, "confidence_percent", 0)\n let status = dict-get(hypothesis, "status", none)\n let scope = dict-get(hypothesis, "scope", none)\n let evidence-for = dict-get(hypothesis, "evidence_for", ())\n let evidence-against = dict-get(hypothesis, "evidence_against", ())\n let hypothesis-interpretation = dict-get(hypothesis, "interpretation", none)\n let tests = dict-get(hypothesis, "tests_to_confirm", ())\n\n block(\n width: 100%,\n breakable: true,\n inset: 8pt,\n stroke: 0.5pt + theme-color(theme, "line"),\n radius: 2pt,\n )[\n #grid(\n columns: (auto, 1fr, auto),\n gutter: 6pt,\n align: (left + horizon, left + horizon, right + horizon),\n badge(id, color: theme-color(theme, "accent")),\n text(size: 10pt, weight: "bold")[#diagnosis],\n if status != none {\n badge(status, color: severity-color(theme, status))\n } else {\n []\n },\n )\n #v(5pt)\n #confidence-bar(theme, confidence)\n #if scope != none {\n v(3pt)\n text(size: 7.5pt, fill: theme-color(theme, "muted"))[\n SCOPE: #upper(str(scope))\n ]\n }\n #if evidence-for.len() > 0 {\n v(6pt)\n diagnostic-list(theme, "EVIDENCE FOR", evidence-for)\n }\n #if evidence-against.len() > 0 {\n v(5pt)\n diagnostic-list(theme, "EVIDENCE AGAINST / LIMITATIONS", evidence-against)\n }\n #if hypothesis-interpretation != none {\n v(5pt)\n text(size: 7.5pt, weight: "bold", fill: theme-color(theme, "muted"))[INTERPRETATION]\n v(2pt)\n text(size: 8.5pt)[#as-content(hypothesis-interpretation)]\n }\n #if tests.len() > 0 {\n v(5pt)\n diagnostic-list(theme, "TESTS TO CONFIRM / REFUTE", tests)\n }\n ]\n v(6pt)\n }\n\n if leading.len() > 0 {\n let statement = dict-get(leading, "statement", none)\n let confidence = dict-get(leading, "confidence_percent", none)\n callout(\n theme,\n [\n #if confidence != none {\n confidence-bar(theme, confidence)\n v(5pt)\n }\n #as-content(statement)\n ],\n title: "Current leading assessment",\n kind: "warning",\n )\n }\n\n if unsupported.len() > 0 {\n v(7pt)\n diagnostic-list(theme, "NOT YET SUPPORTED", unsupported)\n }\n}\n // ----------------------------------------------------------------------------- // ----- Action plan @@ -679,6 +680,18 @@ render-findings(theme, findings) } + // --------------------------------------------------------------------------- + // Diagnostic hypotheses + // --------------------------------------------------------------------------- + + let diagnostics = dict-get(report, "diagnostics", (:)) + let hypotheses = dict-get(diagnostics, "hypotheses", ()) + + if hypotheses.len() > 0 { + section-title(theme, "Diagnostic hypotheses") + render-diagnostics(theme, diagnostics) + } + // --------------------------------------------------------------------------- // Arbitrary sections // ---------------------------------------------------------------------------