Fixed render
Report CI typst_reporter passed all CI checks.
Beffroi/typst_reporter/pipeline/head This commit looks good
Details
Report CI typst_reporter passed all CI checks.
Beffroi/typst_reporter/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3ddef4fbae
commit
2b6cdb5a23
150
model.typ
150
model.typ
|
|
@ -373,7 +373,155 @@
|
|||
..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
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Diagnostic hypotheses
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let confidence-bar(theme, value) = {
|
||||
let value = int(value)
|
||||
let color = if value >= 80 {
|
||||
theme-color(theme, "critical")
|
||||
} else if value >= 50 {
|
||||
theme-color(theme, "warning")
|
||||
} else {
|
||||
theme-color(theme, "info")
|
||||
}
|
||||
|
||||
grid(
|
||||
columns: (1fr, 12mm),
|
||||
gutter: 6pt,
|
||||
align: (left + horizon, right + horizon),
|
||||
block(
|
||||
width: 100%,
|
||||
height: 5pt,
|
||||
radius: 2.5pt,
|
||||
fill: theme-color(theme, "paper_soft"),
|
||||
stroke: 0.4pt + theme-color(theme, "line"),
|
||||
)[
|
||||
#block(
|
||||
width: value * 1%,
|
||||
height: 100%,
|
||||
radius: 2.5pt,
|
||||
fill: color,
|
||||
)
|
||||
],
|
||||
text(size: 8pt, weight: "bold", fill: color)[#(str(value) + "%")],
|
||||
)
|
||||
}
|
||||
|
||||
#let diagnostic-list(theme, title, items) = {
|
||||
if items.len() > 0 {
|
||||
text(size: 7.5pt, weight: "bold", fill: theme-color(theme, "muted"))[#title]
|
||||
v(2pt)
|
||||
list(
|
||||
tight: true,
|
||||
..items.map(item => text(size: 8.5pt)[#as-content(item)]),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#let render-diagnostics(theme, diagnostics) = {
|
||||
let scale = dict-get(diagnostics, "confidence_scale", (:))
|
||||
let interpretation = dict-get(scale, "interpretation", none)
|
||||
let hypotheses = dict-get(diagnostics, "hypotheses", ())
|
||||
let leading = dict-get(diagnostics, "current_leading_assessment", (:))
|
||||
let unsupported = dict-get(diagnostics, "not_yet_supported", ())
|
||||
|
||||
if interpretation != none {
|
||||
callout(
|
||||
theme,
|
||||
[#as-content(interpretation)],
|
||||
title: "How to read confidence",
|
||||
kind: "info",
|
||||
)
|
||||
v(7pt)
|
||||
}
|
||||
|
||||
for hypothesis in hypotheses {
|
||||
let id = dict-get(hypothesis, "id", "Dx")
|
||||
let diagnosis = dict-get(hypothesis, "diagnosis", "Diagnostic hypothesis")
|
||||
let confidence = dict-get(hypothesis, "confidence_percent", 0)
|
||||
let status = dict-get(hypothesis, "status", none)
|
||||
let scope = dict-get(hypothesis, "scope", none)
|
||||
let evidence-for = dict-get(hypothesis, "evidence_for", ())
|
||||
let evidence-against = dict-get(hypothesis, "evidence_against", ())
|
||||
let hypothesis-interpretation = dict-get(hypothesis, "interpretation", none)
|
||||
let tests = dict-get(hypothesis, "tests_to_confirm", ())
|
||||
|
||||
block(
|
||||
width: 100%,
|
||||
breakable: true,
|
||||
inset: 8pt,
|
||||
stroke: 0.5pt + theme-color(theme, "line"),
|
||||
radius: 2pt,
|
||||
)[
|
||||
#grid(
|
||||
columns: (auto, 1fr, auto),
|
||||
gutter: 6pt,
|
||||
align: (left + horizon, left + horizon, right + horizon),
|
||||
badge(id, color: theme-color(theme, "accent")),
|
||||
text(size: 10pt, weight: "bold")[#diagnosis],
|
||||
if status != none {
|
||||
badge(status, color: severity-color(theme, status))
|
||||
} else {
|
||||
[]
|
||||
},
|
||||
)
|
||||
#v(5pt)
|
||||
#confidence-bar(theme, confidence)
|
||||
#if scope != none {
|
||||
v(3pt)
|
||||
text(size: 7.5pt, fill: theme-color(theme, "muted"))[
|
||||
SCOPE: #upper(str(scope))
|
||||
]
|
||||
}
|
||||
#if evidence-for.len() > 0 {
|
||||
v(6pt)
|
||||
diagnostic-list(theme, "EVIDENCE FOR", evidence-for)
|
||||
}
|
||||
#if evidence-against.len() > 0 {
|
||||
v(5pt)
|
||||
diagnostic-list(theme, "EVIDENCE AGAINST / LIMITATIONS", evidence-against)
|
||||
}
|
||||
#if hypothesis-interpretation != none {
|
||||
v(5pt)
|
||||
text(size: 7.5pt, weight: "bold", fill: theme-color(theme, "muted"))[INTERPRETATION]
|
||||
v(2pt)
|
||||
text(size: 8.5pt)[#as-content(hypothesis-interpretation)]
|
||||
}
|
||||
#if tests.len() > 0 {
|
||||
v(5pt)
|
||||
diagnostic-list(theme, "TESTS TO CONFIRM / REFUTE", tests)
|
||||
}
|
||||
]
|
||||
v(6pt)
|
||||
}
|
||||
|
||||
if leading.len() > 0 {
|
||||
let statement = dict-get(leading, "statement", none)
|
||||
let confidence = dict-get(leading, "confidence_percent", none)
|
||||
callout(
|
||||
theme,
|
||||
[
|
||||
#if confidence != none {
|
||||
confidence-bar(theme, confidence)
|
||||
v(5pt)
|
||||
}
|
||||
#as-content(statement)
|
||||
],
|
||||
title: "Current leading assessment",
|
||||
kind: "warning",
|
||||
)
|
||||
}
|
||||
|
||||
if unsupported.len() > 0 {
|
||||
v(7pt)
|
||||
diagnostic-list(theme, "NOT YET SUPPORTED", unsupported)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Action plan
|
||||
|
|
|
|||
Reference in New Issue