Conectar dialog by kind of source; plain-language canvas; login page and guard; loading indicators as the old app; survival curves of her clinical scenarios in the CaMa record
This commit is contained in:
@@ -12,10 +12,15 @@ import type {
|
||||
Procedure,
|
||||
RiskAssessment,
|
||||
} from 'fhir/r4';
|
||||
import { code, ext, Fhir, label, resources } from '../fhir';
|
||||
import { Api } from '../api/api';
|
||||
import { readReport$Json } from '../api/fn/models/read-report-json';
|
||||
import type { Domain } from '../api/models/domain';
|
||||
import { code, EXT, ext, Fhir, label, resources } from '../fhir';
|
||||
import { scenarioFigure } from '../gobernanza/figures';
|
||||
import { CURP } from '../indicadores/follow-up';
|
||||
import { name } from '../indicadores/measures';
|
||||
import { Figure, PALETTE, Plot } from '../plot';
|
||||
import { Loading } from '../loading';
|
||||
|
||||
/** An Observation's value as the screens say it, whatever its type. */
|
||||
function shown(o: Observation): string {
|
||||
@@ -30,12 +35,13 @@ function shown(o: Observation): string {
|
||||
* champion models' risks with their curves. Everything read from the FHIR API. */
|
||||
@Component({
|
||||
selector: 'app-paciente',
|
||||
imports: [DecimalPipe, MatButtonModule, MatCardModule, MatIconModule, RouterLink, Plot],
|
||||
imports: [Loading, DecimalPipe, MatButtonModule, MatCardModule, MatIconModule, RouterLink, Plot],
|
||||
templateUrl: './paciente.html',
|
||||
styleUrl: './paciente.scss',
|
||||
})
|
||||
export class Paciente {
|
||||
private readonly fhir = inject(Fhir);
|
||||
private readonly api = inject(Api);
|
||||
readonly domain = input.required<string>();
|
||||
readonly id = input.required<string>();
|
||||
|
||||
@@ -114,7 +120,12 @@ export class Paciente {
|
||||
return [...latest.values()].map((r) => ({
|
||||
model: code(r.method) ?? '',
|
||||
text: r.method?.text ?? '',
|
||||
version: Number(/v(\d+)$/.exec(r.method?.text ?? '')?.[1] ?? 0),
|
||||
index: r.occurrenceDateTime ?? '',
|
||||
// the clinical scenarios of the model's report she falls in
|
||||
scenarios: (r.extension ?? [])
|
||||
.filter((e) => e.url === EXT + 'escenario-clinico')
|
||||
.map((e) => e.valueString ?? ''),
|
||||
predictions: (r.prediction ?? []).map((p) => ({
|
||||
years: p.whenRange?.high?.value ?? 0,
|
||||
p: p.probabilityDecimal ?? 0,
|
||||
@@ -123,6 +134,36 @@ export class Paciente {
|
||||
})),
|
||||
}));
|
||||
});
|
||||
/** "Análisis de supervivencia": the curves of her clinical scenarios, from the report of
|
||||
* the model version that scored her. */
|
||||
protected readonly survival = resource({
|
||||
params: () => {
|
||||
const m = this.models().find((x) => x.scenarios.length && x.version);
|
||||
return m ? { m, domain: this.domain() } : undefined;
|
||||
},
|
||||
loader: async ({ params: { m, domain } }) => {
|
||||
const report = await this.api.invoke(readReport$Json, {
|
||||
domain: domain as Domain,
|
||||
name: m.model.replace(`${domain}.`, ''),
|
||||
version: m.version,
|
||||
report: 'interpretability',
|
||||
});
|
||||
const drawn = ((report?.['escenarios'] ?? []) as any[]).filter((e) =>
|
||||
m.scenarios.includes(e.escenario),
|
||||
);
|
||||
return {
|
||||
scenarios: m.scenarios,
|
||||
figures: drawn.map((e) =>
|
||||
scenarioFigure(
|
||||
`${e.escenario} (n = ${e.n.toLocaleString('es-MX')}, fallecidos = ${e.fallecidos.toLocaleString('es-MX')})`,
|
||||
e,
|
||||
e.horizons_months,
|
||||
'Supervivencia S(t)',
|
||||
),
|
||||
),
|
||||
};
|
||||
},
|
||||
});
|
||||
protected readonly shown = signal<string | undefined>(undefined);
|
||||
protected readonly curve = computed<Figure>(() => {
|
||||
const models = this.models().filter((m) => m.predictions.length > 1);
|
||||
|
||||
Reference in New Issue
Block a user