Mostrar métodos y escenarios sin curva en la supervivencia de la ficha
This commit is contained in:
@@ -560,7 +560,7 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
}
|
}
|
||||||
@if (models().some((m) => m.model.endsWith('.survival') && m.scenarios.length)) {
|
@if (models().some((m) => m.model.endsWith('.survival'))) {
|
||||||
<mat-card appearance="outlined" class="wide" data-section="supervivencia">
|
<mat-card appearance="outlined" class="wide" data-section="supervivencia">
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-card-title>{{
|
<mat-card-title>{{
|
||||||
@@ -585,17 +585,27 @@
|
|||||||
<li>{{ name }}</li>
|
<li>{{ name }}</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
@if (s.methods.length) {
|
||||||
|
<h3>Métodos</h3>
|
||||||
|
<ul class="scenarios methods">
|
||||||
|
@for (name of s.methods; track name) {
|
||||||
|
<li>{{ name }}</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
@for (f of s.figures; track f.title) {
|
@for (f of s.figures; track f.title) {
|
||||||
<h4>{{ f.title }}</h4>
|
<h4>{{ f.title }}</h4>
|
||||||
<app-plot [figure]="f.figure" [height]="340" />
|
<app-plot [figure]="f.figure" [height]="340" />
|
||||||
} @empty {
|
}
|
||||||
<p class="muted">
|
@for (name of s.unavailable; track name) {
|
||||||
Sus escenarios no tienen fallecimientos suficientes para trazar curvas.
|
<h4>{{ name }}</h4>
|
||||||
</p>
|
<p class="muted">No disponible: datos insuficientes.</p>
|
||||||
}
|
}
|
||||||
<app-factores [rows]="s.factors" />
|
<app-factores [rows]="s.factors" />
|
||||||
} @else if (survival.error()) {
|
} @else if (survival.error()) {
|
||||||
<p class="muted" role="alert">No se pudo leer el informe del modelo.</p>
|
<p class="muted" role="alert">No se pudo leer el informe del modelo.</p>
|
||||||
|
} @else {
|
||||||
|
<p class="muted">No disponible: datos insuficientes.</p>
|
||||||
}
|
}
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ function facts(observations: Observation[]): Fact[] {
|
|||||||
|
|
||||||
/** One patient: her history (conditions, procedures), her tests and results, and the
|
/** One patient: her history (conditions, procedures), her tests and results, and the
|
||||||
* champion models' risks with their curves. Everything read from the FHIR API. */
|
* champion models' risks with their curves. Everything read from the FHIR API. */
|
||||||
|
/** The names of the methods the figures draw, each once. */
|
||||||
|
function methods(figures: { figure: { data: unknown[] } }[]): string[] {
|
||||||
|
const names = figures.flatMap((f) => f.figure.data.map((t) => (t as { name?: string }).name));
|
||||||
|
return [...new Set(names.filter((n): n is string => !!n))];
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-paciente',
|
selector: 'app-paciente',
|
||||||
imports: [
|
imports: [
|
||||||
@@ -347,6 +353,8 @@ export class Paciente {
|
|||||||
return {
|
return {
|
||||||
factors: mine(summary?.['filas'] ?? []) as ScenarioFactors[],
|
factors: mine(summary?.['filas'] ?? []) as ScenarioFactors[],
|
||||||
scenarios: m.scenarios,
|
scenarios: m.scenarios,
|
||||||
|
unavailable: [] as string[],
|
||||||
|
methods: [] as string[],
|
||||||
figures: mine(r['escenarios'] ?? []).map((e) =>
|
figures: mine(r['escenarios'] ?? []).map((e) =>
|
||||||
scenarioFigure(
|
scenarioFigure(
|
||||||
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, recaídas = ${e.recaidas.toLocaleString('es-MX')})`,
|
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, recaídas = ${e.recaidas.toLocaleString('es-MX')})`,
|
||||||
@@ -357,17 +365,22 @@ export class Paciente {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
const drawn = mine((report?.['escenarios'] ?? []) as any[]);
|
||||||
factors: mine((report?.['factores_escenarios'] ?? []) as any[]) as ScenarioFactors[],
|
const figures = drawn.map((e) =>
|
||||||
scenarios: m.scenarios,
|
|
||||||
figures: mine((report?.['escenarios'] ?? []) as any[]).map((e) =>
|
|
||||||
scenarioFigure(
|
scenarioFigure(
|
||||||
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, fallecidos = ${e.fallecidos.toLocaleString('es-MX')})`,
|
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, fallecidos = ${e.fallecidos.toLocaleString('es-MX')})`,
|
||||||
e,
|
e,
|
||||||
e.horizons_months,
|
e.horizons_months,
|
||||||
'Supervivencia S(t)',
|
'Supervivencia S(t)',
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
return {
|
||||||
|
factors: mine((report?.['factores_escenarios'] ?? []) as any[]) as ScenarioFactors[],
|
||||||
|
scenarios: m.scenarios,
|
||||||
|
figures,
|
||||||
|
// her scenarios the report draws no curve for
|
||||||
|
unavailable: m.scenarios.filter((s) => !drawn.some((e) => e.escenario === s)),
|
||||||
|
methods: methods(figures),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -484,7 +497,10 @@ export class Paciente {
|
|||||||
protected readonly curve = computed<Figure>(() => curveFigure(this.riskModels(), this.top()));
|
protected readonly curve = computed<Figure>(() => curveFigure(this.riskModels(), this.top()));
|
||||||
protected readonly curveText = computed(() => curveText(this.riskModels()));
|
protected readonly curveText = computed(() => curveText(this.riskModels()));
|
||||||
private top(): number {
|
private top(): number {
|
||||||
return Math.max(0, ...this.riskModels().flatMap((m) => m.predictions.map((p) => p.high ?? p.p)));
|
return Math.max(
|
||||||
|
0,
|
||||||
|
...this.riskModels().flatMap((m) => m.predictions.map((p) => p.high ?? p.p)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
protected readonly name = name;
|
protected readonly name = name;
|
||||||
protected readonly levelNames = LEVEL_NAMES;
|
protected readonly levelNames = LEVEL_NAMES;
|
||||||
|
|||||||
Reference in New Issue
Block a user