Mostrar solo curvas de probabilidad disponibles

This commit is contained in:
2026-12-02 22:53:44 -06:00
parent a19874438b
commit a22ce12067
2 changed files with 17 additions and 86 deletions
+6 -9
View File
@@ -557,20 +557,15 @@
<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>{{
domain() === 'cacu' ? 'Supervivencia por escenario clínico' : 'Riesgo de muerte' domain() === 'cacu' ? 'Supervivencia' : 'Riesgo de muerte'
}}</mat-card-title> }}</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<h3>Análisis de supervivencia</h3> <h3>Análisis de supervivencia</h3>
@if (domain() === 'cacu') {
<p class="muted" data-note="grupo">
Las curvas son estimaciones del grupo de pacientes del escenario clínico
correspondiente (S(t), probabilidad de supervivencia); no son predicciones
individuales.
</p>
}
@if (survival.isLoading()) { @if (survival.isLoading()) {
<app-loading what="las curvas de supervivencia" [figure]="true" /> <app-loading what="las curvas de supervivencia" [figure]="true" />
} @else if (domain() === 'cacu') {
<p class="muted">No disponible: el informe no contiene la curva para esta combinación.</p>
} @else if (survival.value(); as s) { } @else if (survival.value(); as s) {
<h3>Escenario clínico de la paciente</h3> <h3>Escenario clínico de la paciente</h3>
<ul class="scenarios"> <ul class="scenarios">
@@ -579,12 +574,14 @@
} }
</ul> </ul>
@if (s.methods.length) { @if (s.methods.length) {
<h3>Métodos</h3> <details>
<summary>Métodos</summary>
<ul class="scenarios methods"> <ul class="scenarios methods">
@for (name of s.methods; track name) { @for (name of s.methods; track name) {
<li>{{ name }}</li> <li>{{ name }}</li>
} }
</ul> </ul>
</details>
} }
@for (f of s.figures; track f.title) { @for (f of s.figures; track f.title) {
<h4>{{ f.title }}</h4> <h4>{{ f.title }}</h4>
+5 -71
View File
@@ -1,8 +1,5 @@
import { DecimalPipe } from '@angular/common';
import { Component, computed, input, signal } from '@angular/core'; import { Component, computed, input, signal } from '@angular/core';
import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import type { Parameters, ParametersParameter } from 'fhir/r4'; import type { Parameters, ParametersParameter } from 'fhir/r4';
import { Plot } from '../plot'; import { Plot } from '../plot';
import { curveFigure } from './risk-curve'; import { curveFigure } from './risk-curve';
@@ -56,11 +53,10 @@ export function parseSeries(answer: Parameters): Series[] {
})); }));
} }
/** The chosen series as bars at one horizon and as curves. Series are shown side by side; no /** The chosen series as curves. Series are shown side by side; no difference is computed. */
* difference between them is computed. */
@Component({ @Component({
selector: 'app-risk-series', selector: 'app-risk-series',
imports: [DecimalPipe, MatCheckboxModule, MatFormFieldModule, MatSelectModule, Plot], imports: [MatCheckboxModule, Plot],
template: ` template: `
<p class="muted">Cada serie tiene su propio desenlace y población: no se restan entre sí.</p> <p class="muted">Cada serie tiene su propio desenlace y población: no se restan entre sí.</p>
<div class="choices"> <div class="choices">
@@ -71,40 +67,11 @@ export function parseSeries(answer: Parameters): Series[] {
} }
</div> </div>
@if (selected().length) { @if (selected().length) {
<mat-form-field appearance="outline" subscriptSizing="dynamic"> @for (s of selected(); track s.id) {
<mat-label>Horizonte</mat-label> @for (assumption of s.assumptions; track assumption) {
<mat-select [value]="horizon()" (selectionChange)="picked.set($event.value)"> <p class="muted">{{ name(s) }}: {{ assumption }}</p>
@for (h of horizons(); track h) {
<mat-option [value]="h">{{ h === 0 ? 'Al índice' : h + ' años' }}</mat-option>
} }
</mat-select>
</mat-form-field>
<ul class="bars">
@for (b of bars(); track b.series.id) {
<li>
<span>{{ name(b.series) }}</span>
<small class="muted">{{ b.series.label }}</small>
@if (b.point; as p) {
<span class="track"><span class="fill" [style.width.%]="p.p * 100"></span></span>
<span>
{{ p.p * 100 | number: '1.1-2' }} %
@if (p.low !== undefined && p.high !== undefined) {
(IC 95 %: {{ p.low * 100 | number: '1.1-2' }}–{{
p.high * 100 | number: '1.1-2'
}})
} @else {
(IC 95 % no publicado)
} }
</span>
} @else {
<span class="muted">No disponible en este horizonte.</span>
}
@for (a of b.series.assumptions; track a) {
<small class="muted">{{ a }}</small>
}
</li>
}
</ul>
<app-plot [figure]="figure()" [height]="340" /> <app-plot [figure]="figure()" [height]="340" />
} }
@if (!available().length) { @if (!available().length) {
@@ -121,24 +88,6 @@ export function parseSeries(answer: Parameters): Series[] {
gap: 0 16px; gap: 0 16px;
margin-bottom: 8px; margin-bottom: 8px;
} }
.bars {
list-style: none;
padding: 0;
}
.bars li {
display: flex;
flex-direction: column;
margin-bottom: 10px;
}
.track {
background: var(--color-action-hover, #f1f6f6);
height: 10px;
}
.fill {
background: #4269a0;
display: block;
height: 100%;
}
`, `,
}) })
export class RiskSeries { export class RiskSeries {
@@ -158,21 +107,6 @@ export class RiskSeries {
protected readonly selected = computed(() => protected readonly selected = computed(() =>
this.available().filter((s) => this.chosen().has(s.id)), this.available().filter((s) => this.chosen().has(s.id)),
); );
protected readonly horizons = computed(() =>
[...new Set(this.selected().flatMap((s) => s.points.map((p) => p.years)))].sort(
(a, b) => a - b,
),
);
protected readonly picked = signal(5);
protected readonly horizon = computed(() =>
this.horizons().includes(this.picked()) ? this.picked() : this.horizons().at(-1)!,
);
protected readonly bars = computed(() =>
this.selected().map((series) => ({
series,
point: series.points.find((p) => p.years === this.horizon()),
})),
);
protected readonly figure = computed(() => { protected readonly figure = computed(() => {
const shown = this.selected().map((s) => ({ const shown = this.selected().map((s) => ({
model: s.id, model: s.id,