ConceptMap editor, names and CURP shown, catalog codes read
This commit is contained in:
+14
-3
@@ -36,15 +36,16 @@ test("indicators: the KPIs are the API's MeasureReports, every tab and the patie
|
||||
const list = page.waitForResponse((r) => r.url().includes('/fhir/Patient?'));
|
||||
await page.getByRole('tab', { name: 'Análisis de riesgos' }).click();
|
||||
const bundle = await (await list).json();
|
||||
const first = bundle.entry.find((e: any) => e.search.mode === 'match').resource.id;
|
||||
const patient = bundle.entry.find((e: any) => e.search.mode === 'match').resource;
|
||||
const first = patient.name?.[0]?.text ?? patient.id.slice(0, 10);
|
||||
const rows = page.locator('table.worklist tbody tr');
|
||||
await expect(rows).toHaveCount(Math.min(20, bundle.total));
|
||||
await expect(rows.first().locator('a.id')).toHaveText(first.slice(0, 10));
|
||||
await expect(rows.first().locator('a').first()).toHaveText(first);
|
||||
await page.getByRole('button', { name: 'Siguiente' }).click();
|
||||
await expect(page.getByText(`21–`)).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: 'Anterior' }).click();
|
||||
await rows.first().locator('a.id').click();
|
||||
await rows.first().locator('a').first().click();
|
||||
await expect(page.getByText('Historial médico')).toBeVisible();
|
||||
await expect(page.getByText('Pruebas y resultados')).toBeVisible();
|
||||
await expect(
|
||||
@@ -67,6 +68,16 @@ test('conectar: open the hospital pipeline, preview a source, run it to success'
|
||||
await expect(page.locator('formly-form')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Vista previa' }).click();
|
||||
await expect(page.locator('.preview tr[mat-row]').first()).toBeVisible();
|
||||
// A map node shows the site's codes in platform terms (its ConceptMap), editable as rows.
|
||||
await page.getByText('Mapear · cytology', { exact: true }).click();
|
||||
await expect(page.getByText('Códigos del sitio')).toBeVisible();
|
||||
await expect
|
||||
.poll(() =>
|
||||
page
|
||||
.locator('app-concept-map-editor input')
|
||||
.evaluateAll((els) => els.map((e) => (e as HTMLInputElement).value)),
|
||||
)
|
||||
.toContain('LIEAG');
|
||||
await page.getByRole('button', { name: 'Ejecutar' }).click();
|
||||
await expect(page.getByText('SUCCESS')).toBeVisible({ timeout: 10 * 60_000 });
|
||||
expect(problems).toEqual([]);
|
||||
|
||||
+421
-44
@@ -67,8 +67,7 @@
|
||||
"curp",
|
||||
"nss",
|
||||
"birth_date",
|
||||
"sex",
|
||||
"postal_code"
|
||||
"sex"
|
||||
],
|
||||
"title": "Field",
|
||||
"type": "string"
|
||||
@@ -101,21 +100,34 @@
|
||||
},
|
||||
"Extract": {
|
||||
"additionalProperties": false,
|
||||
"description": "Platform fields read from text, each kept with the text it was read from.\n\n`auto` asks the LLM when one is configured and answering, else applies `patterns`;\nwith neither, the row is held. Patterns are regexes with one group, per field (the\nLLM can propose them from sample documents); their values go through `values` and\n`formats` as in `map`.",
|
||||
"description": "Platform fields read from text, each kept with the text it was read from.\n\n`auto` asks the LLM when one is configured and answering, else applies `patterns`;\nwith neither, the row is held. Patterns are regexes with one group, per field (the\nLLM can propose them from sample documents); their values go through the ConceptMap\nand `formats` as in `map`.",
|
||||
"properties": {
|
||||
"column": {
|
||||
"title": "Column",
|
||||
"type": "string"
|
||||
},
|
||||
"concept_map": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Concept Map"
|
||||
},
|
||||
"entity": {
|
||||
"enum": [
|
||||
"identity",
|
||||
"death",
|
||||
"clinical_note",
|
||||
"cervical_cytology",
|
||||
"cervical_biopsy",
|
||||
"mammography",
|
||||
"breast_biopsy"
|
||||
"breast_biopsy",
|
||||
"clinical_note",
|
||||
"death"
|
||||
],
|
||||
"title": "Entity",
|
||||
"type": "string"
|
||||
@@ -187,17 +199,6 @@
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"values": {
|
||||
"additionalProperties": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"default": {},
|
||||
"title": "Values",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -208,6 +209,86 @@
|
||||
"title": "Extract",
|
||||
"type": "object"
|
||||
},
|
||||
"Fhir": {
|
||||
"additionalProperties": false,
|
||||
"description": "FHIR R4 Bundles a standard hospital sent (a column of their JSON) as rows of one\nentity: identity, death or a study (core.fhir_in). The sender's own codes go through\nits ConceptMap.",
|
||||
"properties": {
|
||||
"column": {
|
||||
"default": "doc",
|
||||
"title": "Column",
|
||||
"type": "string"
|
||||
},
|
||||
"concept_map": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Concept Map"
|
||||
},
|
||||
"entity": {
|
||||
"enum": [
|
||||
"identity",
|
||||
"cervical_cytology",
|
||||
"cervical_biopsy",
|
||||
"mammography",
|
||||
"breast_biopsy",
|
||||
"clinical_note",
|
||||
"death"
|
||||
],
|
||||
"title": "Entity",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"title": "Id",
|
||||
"type": "string"
|
||||
},
|
||||
"inputs": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Inputs",
|
||||
"type": "array"
|
||||
},
|
||||
"kind": {
|
||||
"const": "fhir",
|
||||
"default": "fhir",
|
||||
"title": "Kind",
|
||||
"type": "string"
|
||||
},
|
||||
"label": {
|
||||
"default": "",
|
||||
"title": "Label",
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Position"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"entity"
|
||||
],
|
||||
"title": "Fhir",
|
||||
"type": "object"
|
||||
},
|
||||
"HTTPValidationError": {
|
||||
"properties": {
|
||||
"detail": {
|
||||
@@ -376,8 +457,21 @@
|
||||
},
|
||||
"Map": {
|
||||
"additionalProperties": false,
|
||||
"description": "Columns to platform fields, with the site's codes and date formats.",
|
||||
"description": "Columns to platform fields, the site's codes translated by its ConceptMap\n(core.concept_map), and its date formats.",
|
||||
"properties": {
|
||||
"concept_map": {
|
||||
"anyOf": [
|
||||
{
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": "Concept Map"
|
||||
},
|
||||
"fields": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
@@ -429,17 +523,6 @@
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"values": {
|
||||
"additionalProperties": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"default": {},
|
||||
"title": "Values",
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -479,6 +562,7 @@
|
||||
"discriminator": {
|
||||
"mapping": {
|
||||
"extract": "#/components/schemas/Extract",
|
||||
"fhir": "#/components/schemas/Fhir",
|
||||
"join": "#/components/schemas/Join",
|
||||
"link": "#/components/schemas/Link",
|
||||
"map": "#/components/schemas/Map",
|
||||
@@ -505,6 +589,9 @@
|
||||
{
|
||||
"$ref": "#/components/schemas/Extract"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Fhir"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/Join"
|
||||
},
|
||||
@@ -602,12 +689,12 @@
|
||||
"entity": {
|
||||
"enum": [
|
||||
"identity",
|
||||
"death",
|
||||
"clinical_note",
|
||||
"cervical_cytology",
|
||||
"cervical_biopsy",
|
||||
"mammography",
|
||||
"breast_biopsy"
|
||||
"breast_biopsy",
|
||||
"clinical_note",
|
||||
"death"
|
||||
],
|
||||
"title": "Entity",
|
||||
"type": "string"
|
||||
@@ -837,12 +924,12 @@
|
||||
"entity": {
|
||||
"enum": [
|
||||
"identity",
|
||||
"death",
|
||||
"clinical_note",
|
||||
"cervical_cytology",
|
||||
"cervical_biopsy",
|
||||
"mammography",
|
||||
"breast_biopsy"
|
||||
"breast_biopsy",
|
||||
"clinical_note",
|
||||
"death"
|
||||
],
|
||||
"title": "Entity",
|
||||
"type": "string"
|
||||
@@ -1052,6 +1139,139 @@
|
||||
"summary": "Health"
|
||||
}
|
||||
},
|
||||
"/ingest/concept-maps": {
|
||||
"get": {
|
||||
"description": "Every ConceptMap a site saved: its id, latest version and when.",
|
||||
"operationId": "concept_maps",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"additionalProperties": true,
|
||||
"type": "object"
|
||||
},
|
||||
"title": "Response Concept Maps",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
}
|
||||
},
|
||||
"summary": "Concept Maps",
|
||||
"tags": [
|
||||
"ingest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/ingest/concept-maps/{map_id}": {
|
||||
"get": {
|
||||
"description": "A site's codes in platform terms (FHIR R4B ConceptMap), latest version.",
|
||||
"operationId": "get_concept_map",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "map_id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"title": "Map Id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Response Get Concept Map",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Get Concept Map",
|
||||
"tags": [
|
||||
"ingest"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"description": "Saves a new version of a ConceptMap. Its groups target the systems platform fields\ntake codes from, and only codes those fields allow (core.concept_map).",
|
||||
"operationId": "save_concept_map",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "map_id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"title": "Map Id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"title": "Doc",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"additionalProperties": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": "Response Save Concept Map",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Save Concept Map",
|
||||
"tags": [
|
||||
"ingest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/ingest/pipelines": {
|
||||
"get": {
|
||||
"operationId": "pipelines",
|
||||
@@ -1139,7 +1359,7 @@
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"description": "Saves a new version. Masked secrets sent back are kept as they were saved.",
|
||||
"description": "Saves a new version. Masked secrets sent back are kept as they were saved; every\nConceptMap a node names must exist.",
|
||||
"operationId": "save_pipeline",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -1852,12 +2072,12 @@
|
||||
"schema": {
|
||||
"enum": [
|
||||
"identity",
|
||||
"death",
|
||||
"clinical_note",
|
||||
"cervical_cytology",
|
||||
"cervical_biopsy",
|
||||
"mammography",
|
||||
"breast_biopsy"
|
||||
"breast_biopsy",
|
||||
"clinical_note",
|
||||
"death"
|
||||
],
|
||||
"title": "Entity",
|
||||
"type": "string"
|
||||
@@ -1955,12 +2175,12 @@
|
||||
"schema": {
|
||||
"enum": [
|
||||
"identity",
|
||||
"death",
|
||||
"clinical_note",
|
||||
"cervical_cytology",
|
||||
"cervical_biopsy",
|
||||
"mammography",
|
||||
"breast_biopsy"
|
||||
"breast_biopsy",
|
||||
"clinical_note",
|
||||
"death"
|
||||
],
|
||||
"title": "Entity",
|
||||
"type": "string"
|
||||
@@ -2200,6 +2420,77 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/{domain}/fhir": {
|
||||
"post": {
|
||||
"description": "A standard hospital's Bundle: checked as FHIR, kept as sent in the sender's inbox,\nand placed by the sender's pipeline (a run starts; follow it at the Location).",
|
||||
"operationId": "post_bundle",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "domain",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Domain"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "the sender's pipeline (its fhir nodes read this inbox)",
|
||||
"in": "query",
|
||||
"name": "sender",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"description": "the sender's pipeline (its fhir nodes read this inbox)",
|
||||
"maxLength": 40,
|
||||
"pattern": "^[a-z][a-z0-9_]*$",
|
||||
"title": "Sender",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"additionalProperties": true,
|
||||
"description": "a FHIR R4 batch or transaction Bundle",
|
||||
"title": "Bundle",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/fhir+json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "FHIR"
|
||||
},
|
||||
"202": {
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Post Bundle",
|
||||
"tags": [
|
||||
"fhir"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/{domain}/fhir/Condition": {
|
||||
"get": {
|
||||
"description": "What clinical notes diagnosed.",
|
||||
@@ -2288,7 +2579,7 @@
|
||||
},
|
||||
"/{domain}/fhir/DiagnosticReport": {
|
||||
"get": {
|
||||
"description": "Cervical cytologies and biopsies, as known by the last day with data.",
|
||||
"description": "The domain's reports (each study of the catalog with a report), as known by the last\nday with data.",
|
||||
"operationId": "search_diagnostic_report",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -2372,6 +2663,92 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/{domain}/fhir/Encounter": {
|
||||
"get": {
|
||||
"description": "Consultations: each study of the catalog without a report, as an encounter.",
|
||||
"operationId": "search_encounter",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "domain",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Domain"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Patient/<id>, comma-separated",
|
||||
"in": "query",
|
||||
"name": "subject",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Patient/<id>, comma-separated",
|
||||
"title": "Subject"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "_count",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"title": " Count"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "_offset",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"default": 0,
|
||||
"title": " Offset",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/fhir+json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "FHIR"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Search Encounter",
|
||||
"tags": [
|
||||
"fhir"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/{domain}/fhir/Measure": {
|
||||
"get": {
|
||||
"description": "Every measure of the domain (none for a domain without them yet).",
|
||||
@@ -2620,7 +2997,7 @@
|
||||
},
|
||||
"/{domain}/fhir/Observation": {
|
||||
"get": {
|
||||
"description": "The results of cervical cytologies (Bethesda, adequacy, HPV).",
|
||||
"description": "Every result of the domain's reports, one per field of the catalog.",
|
||||
"operationId": "search_observation",
|
||||
"parameters": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
import { Domain } from '../../models/domain';
|
||||
|
||||
export interface PostBundle$Params {
|
||||
domain: Domain;
|
||||
|
||||
/**
|
||||
* the sender's pipeline (its fhir nodes read this inbox)
|
||||
*/
|
||||
sender: string;
|
||||
body: {
|
||||
[key: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
export function postBundle(http: HttpClient, rootUrl: string, params: PostBundle$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
||||
}>> {
|
||||
const rb = new RequestBuilder(rootUrl, postBundle.PATH, 'post');
|
||||
if (params) {
|
||||
rb.path('domain', params.domain, {});
|
||||
rb.query('sender', params.sender, {});
|
||||
rb.body(params.body, 'application/json');
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/fhir+json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<{
|
||||
}>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
postBundle.PATH = '/{domain}/fhir';
|
||||
@@ -0,0 +1,44 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
import { Domain } from '../../models/domain';
|
||||
|
||||
export interface SearchEncounter$Params {
|
||||
domain: Domain;
|
||||
|
||||
/**
|
||||
* Patient/<id>, comma-separated
|
||||
*/
|
||||
subject?: (string | null);
|
||||
'_count'?: (number | null);
|
||||
'_offset'?: number;
|
||||
}
|
||||
|
||||
export function searchEncounter(http: HttpClient, rootUrl: string, params: SearchEncounter$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
||||
}>> {
|
||||
const rb = new RequestBuilder(rootUrl, searchEncounter.PATH, 'get');
|
||||
if (params) {
|
||||
rb.path('domain', params.domain, {});
|
||||
rb.query('subject', params.subject, {});
|
||||
rb.query('_count', params['_count'], {});
|
||||
rb.query('_offset', params['_offset'], {});
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/fhir+json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<{
|
||||
}>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
searchEncounter.PATH = '/{domain}/fhir/Encounter';
|
||||
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface ConceptMaps$Params {
|
||||
}
|
||||
|
||||
export function conceptMaps(http: HttpClient, rootUrl: string, params?: ConceptMaps$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
||||
[key: string]: any;
|
||||
}>>> {
|
||||
const rb = new RequestBuilder(rootUrl, conceptMaps.PATH, 'get');
|
||||
if (params) {
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<Array<{
|
||||
[key: string]: any;
|
||||
}>>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
conceptMaps.PATH = '/ingest/concept-maps';
|
||||
@@ -0,0 +1,35 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface GetConceptMap$Params {
|
||||
map_id: string;
|
||||
}
|
||||
|
||||
export function getConceptMap(http: HttpClient, rootUrl: string, params: GetConceptMap$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
||||
[key: string]: any;
|
||||
}>> {
|
||||
const rb = new RequestBuilder(rootUrl, getConceptMap.PATH, 'get');
|
||||
if (params) {
|
||||
rb.path('map_id', params.map_id, {});
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<{
|
||||
[key: string]: any;
|
||||
}>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
getConceptMap.PATH = '/ingest/concept-maps/{map_id}';
|
||||
@@ -0,0 +1,39 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface SaveConceptMap$Params {
|
||||
map_id: string;
|
||||
body: {
|
||||
[key: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
export function saveConceptMap(http: HttpClient, rootUrl: string, params: SaveConceptMap$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
||||
[key: string]: number;
|
||||
}>> {
|
||||
const rb = new RequestBuilder(rootUrl, saveConceptMap.PATH, 'put');
|
||||
if (params) {
|
||||
rb.path('map_id', params.map_id, {});
|
||||
rb.body(params.body, 'application/json');
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<{
|
||||
[key: string]: number;
|
||||
}>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
saveConceptMap.PATH = '/ingest/concept-maps/{map_id}';
|
||||
@@ -9,7 +9,7 @@ import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface Conflicts$Params {
|
||||
entity: 'identity' | 'death' | 'clinical_note' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy';
|
||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death';
|
||||
}
|
||||
|
||||
export function conflicts(http: HttpClient, rootUrl: string, params: Conflicts$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
||||
|
||||
@@ -9,7 +9,7 @@ import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface Held$Params {
|
||||
entity: 'identity' | 'death' | 'clinical_note' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy';
|
||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death';
|
||||
}
|
||||
|
||||
export function held(http: HttpClient, rootUrl: string, params: Held$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<{
|
||||
|
||||
@@ -5,6 +5,12 @@ export type { Domains$Params as Domains$Params } from './fn/operations/domains';
|
||||
export { domains as domains } from './fn/operations/domains';
|
||||
export type { Health$Params as Health$Params } from './fn/operations/health';
|
||||
export { health as health } from './fn/operations/health';
|
||||
export type { ConceptMaps$Params as ConceptMaps$Params } from './fn/ingest/concept-maps';
|
||||
export { conceptMaps as conceptMaps } from './fn/ingest/concept-maps';
|
||||
export type { GetConceptMap$Params as GetConceptMap$Params } from './fn/ingest/get-concept-map';
|
||||
export { getConceptMap as getConceptMap } from './fn/ingest/get-concept-map';
|
||||
export type { SaveConceptMap$Params as SaveConceptMap$Params } from './fn/ingest/save-concept-map';
|
||||
export { saveConceptMap as saveConceptMap } from './fn/ingest/save-concept-map';
|
||||
export type { Pipelines$Params as Pipelines$Params } from './fn/ingest/pipelines';
|
||||
export { pipelines as pipelines } from './fn/ingest/pipelines';
|
||||
export type { Pipeline$Params as Pipeline$Params } from './fn/ingest/pipeline';
|
||||
@@ -49,10 +55,14 @@ export type { Reject$Params as Reject$Params } from './fn/review/reject';
|
||||
export { reject as reject } from './fn/review/reject';
|
||||
export type { RunStatus$Params as RunStatus$Params } from './fn/runs/run-status';
|
||||
export { runStatus as runStatus } from './fn/runs/run-status';
|
||||
export type { PostBundle$Params as PostBundle$Params } from './fn/fhir/post-bundle';
|
||||
export { postBundle as postBundle } from './fn/fhir/post-bundle';
|
||||
export type { SearchCondition$Params as SearchCondition$Params } from './fn/fhir/search-condition';
|
||||
export { searchCondition as searchCondition } from './fn/fhir/search-condition';
|
||||
export type { SearchDiagnosticReport$Params as SearchDiagnosticReport$Params } from './fn/fhir/search-diagnostic-report';
|
||||
export { searchDiagnosticReport as searchDiagnosticReport } from './fn/fhir/search-diagnostic-report';
|
||||
export type { SearchEncounter$Params as SearchEncounter$Params } from './fn/fhir/search-encounter';
|
||||
export { searchEncounter as searchEncounter } from './fn/fhir/search-encounter';
|
||||
export type { SearchMeasure$Params as SearchMeasure$Params } from './fn/fhir/search-measure';
|
||||
export { searchMeasure as searchMeasure } from './fn/fhir/search-measure';
|
||||
export type { ReadMeasure$Params as ReadMeasure$Params } from './fn/fhir/read-measure';
|
||||
|
||||
@@ -7,6 +7,7 @@ export type { Condition } from './models/condition';
|
||||
export type { Correction } from './models/correction';
|
||||
export type { Domain } from './models/domain';
|
||||
export type { Extract } from './models/extract';
|
||||
export type { Fhir } from './models/fhir';
|
||||
export type { HttpValidationError } from './models/http-validation-error';
|
||||
export type { Join } from './models/join';
|
||||
export type { Link } from './models/link';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
export interface Correction {
|
||||
field: 'record_number' | 'full_name' | 'curp' | 'nss' | 'birth_date' | 'sex' | 'postal_code';
|
||||
field: 'record_number' | 'full_name' | 'curp' | 'nss' | 'birth_date' | 'sex';
|
||||
record: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@ import { Position } from '../models/position';
|
||||
*
|
||||
* `auto` asks the LLM when one is configured and answering, else applies `patterns`;
|
||||
* with neither, the row is held. Patterns are regexes with one group, per field (the
|
||||
* LLM can propose them from sample documents); their values go through `values` and
|
||||
* `formats` as in `map`.
|
||||
* LLM can propose them from sample documents); their values go through the ConceptMap
|
||||
* and `formats` as in `map`.
|
||||
*/
|
||||
export interface Extract {
|
||||
column: string;
|
||||
entity: 'identity' | 'death' | 'clinical_note' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy';
|
||||
concept_map?: (string | null);
|
||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death';
|
||||
formats?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
@@ -27,9 +28,4 @@ export interface Extract {
|
||||
[key: string]: string;
|
||||
};
|
||||
position?: (Position | null);
|
||||
values?: {
|
||||
[key: string]: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { Position } from '../models/position';
|
||||
|
||||
/**
|
||||
* FHIR R4 Bundles a standard hospital sent (a column of their JSON) as rows of one
|
||||
* entity: identity, death or a study (core.fhir_in). The sender's own codes go through
|
||||
* its ConceptMap.
|
||||
*/
|
||||
export interface Fhir {
|
||||
column?: string;
|
||||
concept_map?: (string | null);
|
||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death';
|
||||
id: string;
|
||||
inputs?: Array<string>;
|
||||
kind?: 'fhir';
|
||||
label?: string;
|
||||
position?: (Position | null);
|
||||
}
|
||||
@@ -4,9 +4,11 @@
|
||||
import { Position } from '../models/position';
|
||||
|
||||
/**
|
||||
* Columns to platform fields, with the site's codes and date formats.
|
||||
* Columns to platform fields, the site's codes translated by its ConceptMap
|
||||
* (core.concept_map), and its date formats.
|
||||
*/
|
||||
export interface Map {
|
||||
concept_map?: (string | null);
|
||||
fields: {
|
||||
[key: string]: string;
|
||||
};
|
||||
@@ -18,9 +20,4 @@ export interface Map {
|
||||
kind?: 'map';
|
||||
label?: string;
|
||||
position?: (Position | null);
|
||||
values?: {
|
||||
[key: string]: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { Extract } from '../models/extract';
|
||||
import { Fhir } from '../models/fhir';
|
||||
import { Join } from '../models/join';
|
||||
import { Link } from '../models/link';
|
||||
import { Map } from '../models/map';
|
||||
@@ -10,5 +11,5 @@ import { Route } from '../models/route';
|
||||
import { Source } from '../models/source';
|
||||
import { Target } from '../models/target';
|
||||
export interface Pipeline {
|
||||
nodes: Array<(Source | Read | Route | Map | Extract | Join | Link | Target)>;
|
||||
nodes: Array<(Source | Read | Route | Map | Extract | Fhir | Join | Link | Target)>;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
export interface Rejection {
|
||||
entity: 'identity' | 'death' | 'clinical_note' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy';
|
||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death';
|
||||
reason: string;
|
||||
record: string;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Position } from '../models/position';
|
||||
* one `link` node among the inputs. Rule breaks are held for review.
|
||||
*/
|
||||
export interface Target {
|
||||
entity: 'identity' | 'death' | 'clinical_note' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy';
|
||||
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'clinical_note' | 'death';
|
||||
id: string;
|
||||
inputs?: Array<string>;
|
||||
kind?: 'target';
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, inject, input, output, signal } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Api } from '../api/api';
|
||||
import { getConceptMap } from '../api/fn/ingest/get-concept-map';
|
||||
import { saveConceptMap } from '../api/fn/ingest/save-concept-map';
|
||||
|
||||
/** One translation: a site's code onto a platform code of one target system. */
|
||||
interface Row {
|
||||
target: string;
|
||||
code: string;
|
||||
platform: string;
|
||||
}
|
||||
|
||||
/** A site's codes in platform terms (a FHIR ConceptMap), edited as a table: a new
|
||||
* laboratory spelling is one more row. The API refuses a code no platform field allows. */
|
||||
@Component({
|
||||
selector: 'app-concept-map-editor',
|
||||
imports: [FormsModule, MatButtonModule, MatIconModule],
|
||||
template: `
|
||||
<h3>
|
||||
Códigos del sitio · <span class="muted">{{ id() }}</span>
|
||||
</h3>
|
||||
<table class="plain">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sistema destino</th>
|
||||
<th>Código del sitio</th>
|
||||
<th>Código de la plataforma</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of rows(); track $index) {
|
||||
<tr>
|
||||
<td>
|
||||
<select [(ngModel)]="row.target" [attr.aria-label]="'Sistema destino ' + $index">
|
||||
@for (t of targets(); track t) {
|
||||
<option [value]="t">{{ short(t) }}</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input [(ngModel)]="row.code" [attr.aria-label]="'Código del sitio ' + $index" />
|
||||
</td>
|
||||
<td>
|
||||
<input
|
||||
[(ngModel)]="row.platform"
|
||||
[attr.aria-label]="'Código de la plataforma ' + $index"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<button mat-icon-button (click)="remove($index)" aria-label="Quitar fila">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="actions">
|
||||
<button mat-stroked-button (click)="add()"><mat-icon>add</mat-icon> Fila</button>
|
||||
<button mat-flat-button (click)="save()">Guardar códigos</button>
|
||||
<span class="muted">{{ message() }}</span>
|
||||
</div>
|
||||
`,
|
||||
styles: `
|
||||
h3 {
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
margin: 16px 0 8px;
|
||||
}
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
font: inherit;
|
||||
padding: 4px;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class ConceptMapEditor {
|
||||
private readonly api = inject(Api);
|
||||
readonly id = input.required<string>();
|
||||
readonly saved = output<number>();
|
||||
protected readonly rows = signal<Row[]>([]);
|
||||
protected readonly targets = signal<string[]>([]);
|
||||
protected readonly message = signal('');
|
||||
private source = 'urn:isssteleon:site';
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
try {
|
||||
const doc = (await this.api.invoke(getConceptMap, { map_id: this.id() })) as Record<
|
||||
string,
|
||||
any
|
||||
>;
|
||||
const groups = (doc['group'] ?? []) as any[];
|
||||
this.source = groups[0]?.source ?? this.source;
|
||||
this.targets.set([...new Set(groups.map((g) => g.target))]);
|
||||
this.rows.set(
|
||||
groups.flatMap((g) =>
|
||||
(g.element ?? []).map((e: any) => ({
|
||||
target: g.target,
|
||||
code: e.code,
|
||||
platform: e.target?.[0]?.code ?? '',
|
||||
})),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
this.message.set(
|
||||
e instanceof HttpErrorResponse && e.status === 404 ? 'Nuevo: agregue filas.' : String(e),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected short(url: string): string {
|
||||
return url.split('/').pop() ?? url;
|
||||
}
|
||||
|
||||
protected add(): void {
|
||||
this.rows.update((r) => [...r, { target: this.targets()[0] ?? '', code: '', platform: '' }]);
|
||||
}
|
||||
|
||||
protected remove(i: number): void {
|
||||
this.rows.update((r) => r.filter((_, j) => j !== i));
|
||||
}
|
||||
|
||||
/** The rows as a ConceptMap: one group per target system. */
|
||||
protected async save(): Promise<void> {
|
||||
const groups = new Map<string, Row[]>();
|
||||
for (const r of this.rows().filter((r) => r.target && r.code && r.platform)) {
|
||||
groups.set(r.target, [...(groups.get(r.target) ?? []), r]);
|
||||
}
|
||||
const doc = {
|
||||
resourceType: 'ConceptMap',
|
||||
status: 'active',
|
||||
group: [...groups].map(([target, rows]) => ({
|
||||
source: this.source,
|
||||
target,
|
||||
element: rows.map((r) => ({
|
||||
code: r.code,
|
||||
target: [{ code: r.platform, equivalence: 'equivalent' }],
|
||||
})),
|
||||
})),
|
||||
};
|
||||
try {
|
||||
const { version } = await this.api.invoke(saveConceptMap, { map_id: this.id(), body: doc });
|
||||
this.message.set(`Versión ${version} guardada.`);
|
||||
this.saved.emit(version);
|
||||
} catch (e) {
|
||||
const detail = e instanceof HttpErrorResponse ? e.error?.detail : e;
|
||||
this.message.set(Array.isArray(detail) ? detail.join('; ') : String(detail));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,9 @@
|
||||
[model]="model"
|
||||
(modelChange)="edited($event)"
|
||||
/>
|
||||
@if (conceptMap(d); as cm) {
|
||||
<app-concept-map-editor [id]="cm" />
|
||||
}
|
||||
<button mat-stroked-button (click)="show()">Vista previa</button>
|
||||
@if (preview(); as rows) {
|
||||
<div class="preview">
|
||||
|
||||
@@ -22,6 +22,7 @@ import { startRun } from '../api/fn/ingest/start-run';
|
||||
import { runStatus } from '../api/fn/runs/run-status';
|
||||
import type { Pipeline } from '../api/models/pipeline';
|
||||
import type { Source } from '../api/models/source';
|
||||
import { ConceptMapEditor } from './concept-map-editor';
|
||||
import { FORMLY_TYPES, nodeSchema } from './schema-form';
|
||||
|
||||
type Doc = Pipeline['nodes'][number];
|
||||
@@ -52,6 +53,7 @@ export const KINDS: Record<Kind, string> = {
|
||||
route: 'Filtrar',
|
||||
map: 'Mapear',
|
||||
extract: 'Extraer',
|
||||
fhir: 'FHIR',
|
||||
join: 'Unir',
|
||||
link: 'Vincular',
|
||||
target: 'Destino',
|
||||
@@ -73,6 +75,7 @@ const ID = /^[a-z][a-z0-9_]*$/;
|
||||
MatListModule,
|
||||
MatTableModule,
|
||||
Vflow,
|
||||
ConceptMapEditor,
|
||||
],
|
||||
// Forms are this page's only: Formly loads with it, not with the app.
|
||||
providers: [provideFormlyCore([...withFormlyMaterial(), FORMLY_TYPES])],
|
||||
@@ -304,6 +307,10 @@ export class Conectar {
|
||||
const run = this.run();
|
||||
return run ? `${location.protocol}//${location.hostname}:5712/runs/${run.id}` : '';
|
||||
});
|
||||
/** The ConceptMap a node names, if its kind takes one. */
|
||||
protected conceptMap(d: Doc): string | undefined {
|
||||
return 'concept_map' in d ? (d.concept_map ?? undefined) : undefined;
|
||||
}
|
||||
protected kindLabel(kind: Doc['kind']): string {
|
||||
return KINDS[kind ?? 'source'];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import { code, ext, resources } from '../fhir';
|
||||
/** One row of the follow-up list: what the list shows of a patient at the cut-off. */
|
||||
export interface Row {
|
||||
patient: Patient;
|
||||
name?: string;
|
||||
curp?: string;
|
||||
status: string;
|
||||
ageGroup: string;
|
||||
cytology?: { date: string; result?: string; adequacy?: string };
|
||||
@@ -13,6 +15,8 @@ export interface Row {
|
||||
risk: Record<'cin2' | 'cancer', number | undefined>;
|
||||
}
|
||||
|
||||
export const CURP = 'https://isssteleon.org/fhir/sid/curp';
|
||||
|
||||
const AGE_GROUPS: [number, number][] = [
|
||||
[25, 34],
|
||||
[35, 44],
|
||||
@@ -72,17 +76,17 @@ export function rows(page: Bundle, start: string, cutoff: string, horizon: numbe
|
||||
return resources<Patient>(page, 'Patient', 'match').map((patient) => {
|
||||
const mine = reports.filter((r) => r.subject?.reference === `Patient/${patient.id}`);
|
||||
const by = (kind: string) => mine.filter((r) => code(r.code) === kind);
|
||||
const cytologies = by('cervical-cytology')
|
||||
const cytologies = by('cervical_cytology')
|
||||
.filter((r) => start <= r.effectiveDateTime! && r.effectiveDateTime! <= cutoff)
|
||||
.sort((a, b) => a.effectiveDateTime!.localeCompare(b.effectiveDateTime!));
|
||||
const last = cytologies.at(-1);
|
||||
const lastResults = last ? results(last) : new Map();
|
||||
const hpv = cytologies.filter((r) => results(r).has('hpv')).at(-1);
|
||||
const hpv = cytologies.filter((r) => results(r).has('cervical_cytology.hpv')).at(-1);
|
||||
const hpvResults = hpv ? results(hpv) : new Map();
|
||||
const types = ['hpv-16', 'hpv-18']
|
||||
const types = ['cervical_cytology.hpv_16', 'cervical_cytology.hpv_18']
|
||||
.filter((k) => hpvResults.has(k))
|
||||
.map((k) => hpvResults.get(k)!.valueBoolean);
|
||||
const biopsy = by('cervical-biopsy')
|
||||
const biopsy = by('cervical_biopsy')
|
||||
.filter((r) => ext(r, 'report-date'))
|
||||
.sort((a, b) =>
|
||||
ext(a, 'report-date')!.valueDate!.localeCompare(ext(b, 'report-date')!.valueDate!),
|
||||
@@ -91,22 +95,24 @@ export function rows(page: Bundle, start: string, cutoff: string, horizon: numbe
|
||||
const theirs = risks.filter((r) => r.subject?.reference === `Patient/${patient.id}`);
|
||||
return {
|
||||
patient,
|
||||
name: patient.name?.[0]?.text,
|
||||
curp: patient.identifier?.find((i) => i.system === CURP)?.value,
|
||||
status: ext(patient, 'follow-up-status')?.valueCoding?.code ?? '',
|
||||
ageGroup: ageGroup(patient.birthDate, cutoff),
|
||||
cytology: last && {
|
||||
date: last.effectiveDateTime!,
|
||||
result: code(lastResults.get('cytology-result')?.valueCodeableConcept),
|
||||
adequacy: code(lastResults.get('cytology-adequacy')?.valueCodeableConcept),
|
||||
result: code(lastResults.get('cervical_cytology.result')?.valueCodeableConcept),
|
||||
adequacy: code(lastResults.get('cervical_cytology.adequacy')?.valueCodeableConcept),
|
||||
},
|
||||
hpv: hpv && {
|
||||
date: hpv.effectiveDateTime!,
|
||||
positive: !!hpvResults.get('hpv')?.valueBoolean,
|
||||
positive: !!hpvResults.get('cervical_cytology.hpv')?.valueBoolean,
|
||||
types1618: types.length ? types.some((t) => t) : undefined,
|
||||
},
|
||||
daysToDiagnosis: last ? ext(last, 'days-to-diagnosis')?.valueInteger : undefined,
|
||||
biopsy: biopsy && {
|
||||
date: ext(biopsy, 'report-date')!.valueDate!,
|
||||
histology: code(biopsy.conclusionCode?.[0]),
|
||||
histology: code(results(biopsy).get('cervical_biopsy.histology')?.valueCodeableConcept),
|
||||
},
|
||||
risk: {
|
||||
cin2: currentRisk(theirs, 'cin2', horizon),
|
||||
|
||||
@@ -75,9 +75,12 @@
|
||||
@for (row of rows(); track row.patient.id) {
|
||||
<tr>
|
||||
<td>
|
||||
<a [routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]" class="id">{{
|
||||
row.patient.id!.slice(0, 10)
|
||||
<a [routerLink]="['/indicadores', domain(), 'pacientes', row.patient.id]">{{
|
||||
row.name ?? row.patient.id!.slice(0, 10)
|
||||
}}</a>
|
||||
@if (row.curp) {
|
||||
<div class="muted curp">{{ row.curp }}</div>
|
||||
}
|
||||
</td>
|
||||
<td>{{ row.ageGroup }}</td>
|
||||
<td>{{ name(row.status) }}</td>
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.id {
|
||||
a {
|
||||
color: var(--color-action);
|
||||
}
|
||||
|
||||
.curp {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pager {
|
||||
|
||||
@@ -6,9 +6,17 @@
|
||||
<p class="muted" role="alert">No se encontró la paciente.</p>
|
||||
} @else if (patient(); as p) {
|
||||
<h1>
|
||||
Paciente <code>{{ p.id!.slice(0, 10) }}</code>
|
||||
{{ identity().name ?? 'Paciente' }} <code class="muted">{{ p.id!.slice(0, 10) }}</code>
|
||||
</h1>
|
||||
<dl class="summary">
|
||||
<div>
|
||||
<dt>CURP</dt>
|
||||
<dd>{{ identity().curp ?? 'Sin dato' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Expedientes</dt>
|
||||
<dd>{{ identity().numbers.join(', ') || 'Sin dato' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Fecha de nacimiento</dt>
|
||||
<dd>{{ p.birthDate ?? 'Sin dato' }}</dd>
|
||||
|
||||
@@ -13,9 +13,19 @@ import type {
|
||||
RiskAssessment,
|
||||
} from 'fhir/r4';
|
||||
import { code, ext, Fhir, label, resources } from '../fhir';
|
||||
import { CURP } from '../indicadores/follow-up';
|
||||
import { name } from '../indicadores/measures';
|
||||
import { Figure, PALETTE, Plot } from '../plot';
|
||||
|
||||
/** An Observation's value as the screens say it, whatever its type. */
|
||||
function shown(o: Observation): string {
|
||||
if (o.valueBoolean !== undefined) return o.valueBoolean ? 'positivo' : 'negativo';
|
||||
if (o.valueCodeableConcept)
|
||||
return name(code(o.valueCodeableConcept) ?? '') || label(o.valueCodeableConcept);
|
||||
if (o.valueQuantity) return `${o.valueQuantity.value} ${o.valueQuantity.unit ?? ''}`.trim();
|
||||
return o.valueString ?? o.valueDateTime ?? '';
|
||||
}
|
||||
|
||||
/** One patient: her history (conditions, procedures), her tests and results, and the
|
||||
* champion models' risks with their curves. Everything read from the FHIR API. */
|
||||
@Component({
|
||||
@@ -86,13 +96,7 @@ export class Paciente {
|
||||
reported: ext(r, 'report-date')?.valueDate,
|
||||
kind: label(r.code),
|
||||
status: r.status,
|
||||
results: [
|
||||
...results.map(
|
||||
(o) =>
|
||||
`${label(o.code)}: ${o.valueBoolean !== undefined ? (o.valueBoolean ? 'positivo' : 'negativo') : name(code(o.valueCodeableConcept) ?? '')}`,
|
||||
),
|
||||
...(r.conclusionCode ?? []).map((c) => `Histología: ${name(code(c) ?? '')}`),
|
||||
],
|
||||
results: [...results.map((o) => `${label(o.code)}: ${shown(o)}`)],
|
||||
};
|
||||
});
|
||||
});
|
||||
@@ -169,6 +173,14 @@ export class Paciente {
|
||||
return Math.max(0, ...this.models().flatMap((m) => m.predictions.map((p) => p.high ?? p.p)));
|
||||
}
|
||||
protected readonly name = name;
|
||||
protected readonly identity = computed(() => {
|
||||
const p = this.patient();
|
||||
return {
|
||||
name: p?.name?.[0]?.text,
|
||||
curp: p?.identifier?.find((i) => i.system === CURP)?.value,
|
||||
numbers: (p?.identifier ?? []).filter((i) => i.system !== CURP).map((i) => i.value),
|
||||
};
|
||||
});
|
||||
protected readonly status = computed(() => {
|
||||
const p = this.patient();
|
||||
return p ? name(ext(p, 'follow-up-status')?.valueCoding?.code ?? '') : '';
|
||||
|
||||
@@ -40,7 +40,6 @@ const IDENTITY_FIELDS: Correction['field'][] = [
|
||||
'nss',
|
||||
'birth_date',
|
||||
'sex',
|
||||
'postal_code',
|
||||
];
|
||||
/** Bookkeeping columns, not values a reviewer judges. */
|
||||
const HIDDEN = [
|
||||
|
||||
Reference in New Issue
Block a user