CaMa: present diagnostic pathway and biopsy results
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
import { Component, input, signal } from '@angular/core';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { Loading } from '../loading';
|
||||
import { DurationRow, durationMax } from './durations';
|
||||
|
||||
/** A screening route as one compact card: a bar per step with its median, its observations
|
||||
* and its quartiles, read step by step or cumulatively from the sample. A step that is not
|
||||
* published, or has no measurements in the period, keeps its row and says so. */
|
||||
@Component({
|
||||
selector: 'app-route-card',
|
||||
imports: [Loading, MatButtonToggleModule, MatCardModule],
|
||||
template: `
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content>
|
||||
<div class="head">
|
||||
<h3>{{ title() }}</h3>
|
||||
@if (sample().length && step().length) {
|
||||
<mat-button-toggle-group
|
||||
aria-label="Lectura de los tiempos"
|
||||
[value]="mode()"
|
||||
(change)="mode.set($event.value)"
|
||||
>
|
||||
<mat-button-toggle value="step">Por pasos</mat-button-toggle>
|
||||
<mat-button-toggle value="sample">Acumulado desde la toma</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
}
|
||||
</div>
|
||||
@if (loading()) {
|
||||
<app-loading what="los tiempos" [figure]="true" />
|
||||
} @else {
|
||||
@let rows = mode() === 'sample' ? sample() : step();
|
||||
@let max = scale(rows);
|
||||
<p class="state">
|
||||
@if (mode() === 'sample') {
|
||||
Mediana de días desde la toma de la mastografía hasta cada etapa; cada medida se
|
||||
calcula por separado.
|
||||
} @else {
|
||||
Cada barra es la mediana de su paso, desde cero y por separado; los pasos pueden
|
||||
corresponder a poblaciones diferentes, por lo que las medianas no se suman.
|
||||
}
|
||||
Las marcas indican el primer y tercer cuartil.
|
||||
@if (max) {
|
||||
Escala: 0 a {{ max }} días.
|
||||
}
|
||||
</p>
|
||||
<table [attr.aria-label]="title()">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ mode() === 'sample' ? 'Etapa' : 'Paso' }}</th>
|
||||
<th>Mediana</th>
|
||||
<th>Observaciones</th>
|
||||
<th>Q1–Q3</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of rows; track row.label) {
|
||||
<tr [attr.data-status]="row.status">
|
||||
<th scope="row">
|
||||
{{ row.label }}
|
||||
@if (row.status === 'value') {
|
||||
<span class="track" aria-hidden="true">
|
||||
<span
|
||||
class="bar"
|
||||
[style.width.%]="max ? (100 * row.median!) / max : 0"
|
||||
></span>
|
||||
@if (row.low !== undefined && row.high !== undefined) {
|
||||
<span
|
||||
class="mark"
|
||||
[style.left.%]="max ? (100 * row.low) / max : 0"
|
||||
></span>
|
||||
<span
|
||||
class="mark"
|
||||
[style.left.%]="max ? (100 * row.high) / max : 0"
|
||||
></span>
|
||||
}
|
||||
</span>
|
||||
} @else {
|
||||
<span class="none">
|
||||
{{
|
||||
row.status === 'empty'
|
||||
? 'Sin mediciones en el periodo'
|
||||
: 'Indicador no publicado'
|
||||
}}
|
||||
</span>
|
||||
}
|
||||
</th>
|
||||
<td>{{ row.status === 'value' ? row.median + ' días' : '—' }}</td>
|
||||
<td>{{ row.observations ?? '—' }}</td>
|
||||
<td>
|
||||
{{
|
||||
row.low === undefined || row.high === undefined
|
||||
? '—'
|
||||
: row.low + '–' + row.high
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
`,
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.head {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3);
|
||||
justify-content: space-between;
|
||||
}
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
}
|
||||
.state {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 13px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
width: 100%;
|
||||
}
|
||||
th {
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
}
|
||||
th[scope='row'] {
|
||||
padding: 5px 0;
|
||||
}
|
||||
td,
|
||||
thead th:not(:first-child) {
|
||||
font-variant-numeric: tabular-nums;
|
||||
padding-left: 12px;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.track {
|
||||
background: #eef1f3;
|
||||
display: block;
|
||||
height: 8px;
|
||||
margin-top: 3px;
|
||||
position: relative;
|
||||
}
|
||||
.bar {
|
||||
background: #42a77e;
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
.mark {
|
||||
background: #17324d;
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
width: 2px;
|
||||
}
|
||||
.none {
|
||||
color: var(--color-text-secondary);
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
margin-top: 3px;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class RouteCard {
|
||||
readonly title = input.required<string>();
|
||||
/** The rows from the sample, and the rows step by step. */
|
||||
readonly sample = input.required<DurationRow[]>();
|
||||
readonly step = input.required<DurationRow[]>();
|
||||
readonly loading = input(false);
|
||||
|
||||
protected readonly mode = signal<'sample' | 'step'>('step');
|
||||
protected readonly scale = durationMax;
|
||||
}
|
||||
Reference in New Issue
Block a user