CaMa: present diagnostic pathway and biopsy results
This commit is contained in:
@@ -5,7 +5,7 @@ import type { Measure } from 'fhir/r4';
|
||||
import { Mode } from './bars';
|
||||
import { scenarioBars } from './figures';
|
||||
import { detail, donut, formatScore, name, Reading, scoring } from './measures';
|
||||
import type { Section } from './pages';
|
||||
import type { ReadingsCard, Section } from './pages';
|
||||
import { Readings } from './readings';
|
||||
|
||||
/** The applied period's readings and the measures they are of. */
|
||||
@@ -27,7 +27,8 @@ type Shown = Extract<Section, { kind: 'readings' | 'columns' | 'choice' }>;
|
||||
<mat-card-content>
|
||||
<app-readings
|
||||
[title]="s.title"
|
||||
[headline]="headline()"
|
||||
[camaStyle]="hasCamaHeading(s)"
|
||||
[headline]="headlineOf(s)"
|
||||
[note]="s.note ?? ''"
|
||||
[modes]="s.modes"
|
||||
[loading]="of().loading"
|
||||
@@ -36,6 +37,37 @@ type Shown = Extract<Section, { kind: 'readings' | 'columns' | 'choice' }>;
|
||||
/>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
} @else if (s.kind === 'choice' && s.card) {
|
||||
@let open = chosen() || s.choices[0].label;
|
||||
<mat-card appearance="outlined" class="choice-card">
|
||||
<mat-card-content>
|
||||
<h3 class="title">{{ s.title }}</h3>
|
||||
<mat-button-toggle-group
|
||||
[attr.aria-label]="s.title"
|
||||
[value]="open"
|
||||
(change)="chosen.set($event.value)"
|
||||
>
|
||||
@for (c of s.choices; track c.label) {
|
||||
<mat-button-toggle [value]="c.label">{{ c.label }}</mat-button-toggle>
|
||||
}
|
||||
</mat-button-toggle-group>
|
||||
@for (c of s.choices; track c.label) {
|
||||
@if (c.label === open) {
|
||||
<app-readings
|
||||
[title]="c.section.title"
|
||||
[hideTitle]="true"
|
||||
[camaStyle]="true"
|
||||
[headline]="headlineOf(c.section)"
|
||||
[note]="c.section.note ?? ''"
|
||||
[modes]="c.section.modes"
|
||||
[loading]="of().loading"
|
||||
[read]="of().reading"
|
||||
[draw]="draw()"
|
||||
/>
|
||||
}
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
} @else {
|
||||
<h2>{{ s.title }}</h2>
|
||||
@if (s.kind === 'columns') {
|
||||
@@ -66,9 +98,17 @@ type Shown = Extract<Section, { kind: 'readings' | 'columns' | 'choice' }>;
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
margin-top: 16px;
|
||||
margin-top: 24px;
|
||||
min-width: 0;
|
||||
}
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
.choice-card app-readings {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.columns {
|
||||
display: grid;
|
||||
column-gap: 16px;
|
||||
@@ -84,15 +124,19 @@ export class ReadingsSection {
|
||||
readonly of = input.required<Source>();
|
||||
protected readonly chosen = signal('');
|
||||
|
||||
protected readonly headline = computed(() => {
|
||||
const s = this.section();
|
||||
const code = s.kind === 'readings' ? s.headline : undefined;
|
||||
protected hasCamaHeading(s: ReadingsCard): boolean {
|
||||
return s.modes.some((mode) => !!mode.heading);
|
||||
}
|
||||
|
||||
/** A reading card's headline: its measure's score and its counts, in its own units. */
|
||||
protected headlineOf(s: ReadingsCard): string {
|
||||
const code = s.headline;
|
||||
const measure = code && this.of().measure(code);
|
||||
const r = code && this.of().reading(code);
|
||||
if (!measure || !r) return '';
|
||||
const words = detail(measure, r);
|
||||
const words = detail(measure, r, s.unit);
|
||||
return scoring(measure) === 'cohort' ? words : `${formatScore(measure, r)} · ${words}`;
|
||||
});
|
||||
}
|
||||
protected readonly draw = computed(() => (mode: Mode) => {
|
||||
if (mode.kind !== 'figure') return undefined;
|
||||
const r = this.of().reading(mode.measure);
|
||||
|
||||
Reference in New Issue
Block a user