T17: sweep of the WebApp after the feature-parity work
Removed the legacy indicator layout, unused chart helpers, styles and exports, the card-actions component, fetch-all and explanatory comments; one pager shared by the four worklists, shared filter-row styles, one FHIR name and CURP reader, downloads through export/, the concept-map editor on Material controls.
This commit is contained in:
+14
-7
@@ -1,15 +1,14 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import type { Bundle, CodeableConcept, Extension, FhirResource } from 'fhir/r4';
|
||||
import type { Bundle, CodeableConcept, Extension, FhirResource, Patient } from 'fhir/r4';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { ApiConfiguration } from './api/api-configuration';
|
||||
|
||||
/** Our extensions and code systems (core.fhir). */
|
||||
export const CURP = 'https://isssteleon.org/fhir/sid/curp';
|
||||
export const EXT = 'https://isssteleon.org/fhir/StructureDefinition/';
|
||||
|
||||
export type Params = Record<string, string | number | readonly (string | number)[] | undefined>;
|
||||
|
||||
/** The domain's FHIR base (`/{domain}/fhir`): reads and searches, typed as R4. */
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class Fhir {
|
||||
private readonly http = inject(HttpClient);
|
||||
@@ -19,7 +18,6 @@ export class Fhir {
|
||||
return firstValueFrom(this.http.get<T>(`${this.root}/${domain}/fhir/${type}/${id}`));
|
||||
}
|
||||
|
||||
/** One page of a search. */
|
||||
search(domain: string, type: string, params: Params = {}): Promise<Bundle> {
|
||||
const query = Object.fromEntries(
|
||||
Object.entries(params).filter(([, v]) => v !== undefined),
|
||||
@@ -29,7 +27,6 @@ export class Fhir {
|
||||
);
|
||||
}
|
||||
|
||||
/** The page a bundle's `next` (or `previous`) link points to, through our own base. */
|
||||
follow(domain: string, bundle: Bundle, relation: 'next' | 'previous'): Promise<Bundle> | null {
|
||||
const link = bundle.link?.find((l) => l.relation === relation)?.url;
|
||||
if (!link) return null;
|
||||
@@ -40,7 +37,6 @@ export class Fhir {
|
||||
);
|
||||
}
|
||||
|
||||
/** Every page of a search. */
|
||||
async all(domain: string, type: string, params: Params = {}): Promise<Bundle[]> {
|
||||
const pages = [await this.search(domain, type, params)];
|
||||
for (let next = this.follow(domain, pages[0], 'next'); next;) {
|
||||
@@ -52,7 +48,6 @@ export class Fhir {
|
||||
}
|
||||
}
|
||||
|
||||
/** The resources of a bundle (or of several pages), by search mode. */
|
||||
export function resources<T extends FhirResource>(
|
||||
bundles: Bundle | Bundle[],
|
||||
type: T['resourceType'],
|
||||
@@ -79,3 +74,15 @@ export function code(concept: CodeableConcept | undefined): string | undefined {
|
||||
export function label(concept: CodeableConcept | undefined): string {
|
||||
return concept?.text ?? concept?.coding?.[0]?.display ?? concept?.coding?.[0]?.code ?? '';
|
||||
}
|
||||
|
||||
export function patientName(patient: Patient | undefined): string | undefined {
|
||||
return patient?.name?.[0]?.text;
|
||||
}
|
||||
|
||||
export function patientCurp(patient: Patient | undefined): string | undefined {
|
||||
return patient?.identifier?.find((i) => i.system === CURP)?.value;
|
||||
}
|
||||
|
||||
export function extensions(element: { extension?: Extension[] }, name: string): Extension[] {
|
||||
return (element.extension ?? []).filter((e) => e.url === EXT + name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user