diff --git a/e2e/pages.spec.ts b/e2e/pages.spec.ts
index 6e54e0a..f6d3651 100644
--- a/e2e/pages.spec.ts
+++ b/e2e/pages.spec.ts
@@ -9,6 +9,32 @@ function watch(page: Page): string[] {
return problems;
}
+// The pages show only to someone signed in (the API itself answers everyone).
+test.beforeEach(async ({ page }) => {
+ const signed = await page.request.post('/api/auth/login', {
+ form: { username: 'admin@isssteleon.test', password: 'solo-para-pruebas' },
+ });
+ expect(signed.status()).toBe(204);
+});
+
+test('login: the pages wait for a sign-in, and a wrong password says so', async ({ browser }) => {
+ const page = await browser.newPage({ baseURL: 'http://127.0.0.1:4310' });
+ await page.goto('/conectar');
+ await expect(page).toHaveURL(/\/login\?next=%2Fconectar/);
+ await expect(page.getByRole('heading', { name: 'Inicio de sesión' })).toBeVisible();
+ await page.getByRole('textbox', { name: 'Usuario' }).fill('admin@isssteleon.test');
+ await page.getByRole('textbox', { name: 'Contraseña' }).fill('otra');
+ await page.getByRole('button', { name: 'Ingresar' }).click();
+ await expect(page.getByText('Usuario o contraseña incorrectos.')).toBeVisible();
+ await page.getByRole('textbox', { name: 'Contraseña' }).fill('solo-para-pruebas');
+ await page.getByRole('button', { name: 'Ingresar' }).click();
+ await expect(page).toHaveURL(/\/conectar$/);
+ await page.getByRole('button', { name: 'Cuenta' }).click();
+ await page.getByRole('menuitem', { name: 'Salir' }).click();
+ await expect(page).toHaveURL(/\/login/);
+ await page.close();
+});
+
test("indicators: the KPIs are the API's MeasureReports, every tab and the patient view load", async ({
page,
}) => {
@@ -71,12 +97,12 @@ test('conectar: open the hospital pipeline, preview a source, run it to success'
await page.goto('/conectar');
await page.getByText('cacu', { exact: true }).click();
await expect(page.locator('vflow')).toBeVisible();
- await page.getByText('Fuente · Patients').click();
- await expect(page.locator('formly-form')).toBeVisible();
+ await page.getByText('Fuente de datos · Patients').click();
+ await expect(page.locator('formly-form')).toBeVisible(); // drawn by hand: its raw form
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 page.getByText('Traducir códigos · cytology', { exact: true }).click();
await expect(page.getByText('Códigos del sitio')).toBeVisible();
await expect
.poll(() =>
@@ -90,7 +116,9 @@ test('conectar: open the hospital pipeline, preview a source, run it to success'
expect(problems).toEqual([]);
});
-test('revision: what the hospital source holds, and a decision through the page', async ({ page }) => {
+test('revision: what the hospital source holds, and a decision through the page', async ({
+ page,
+}) => {
const problems = watch(page);
await page.goto('/revision');
await page.getByRole('tab', { name: 'Personas' }).click();
@@ -116,3 +144,37 @@ test('gobernanza: a version with its reports, its curves, and promotion refused
await expect(page.getByText('No se promovió')).toContainText('clinical_validation');
expect(problems.filter((p) => !p.includes('409'))).toEqual([]);
});
+
+test('conectar: someone who knows nothing of databases connects the SQL Server with the dialog', async ({
+ page,
+}) => {
+ const site = new URL((process.env['SITE_URL'] ?? '').replace(/^mssql\+pymssql/, 'http'));
+ const problems = watch(page);
+ await page.goto('/conectar');
+ await page.getByLabel('Nueva canalización').fill('asistente');
+ await page.getByLabel('Nueva canalización').press('Enter');
+ await page.getByRole('button', { name: 'Fuente de datos' }).click();
+ await expect(page.getByText('¿Dónde están los datos?')).toBeVisible();
+ await page.locator('[data-type="sqlserver"]').click();
+ await page.locator('[data-field="host"]').fill(site.hostname);
+ await page.locator('[data-field="database"]').fill(site.pathname.slice(1));
+ await page.locator('[data-field="user"]').fill(decodeURIComponent(site.username));
+ await page.locator('[data-field="password"]').fill(decodeURIComponent(site.password));
+ await page.getByRole('button', { name: 'Probar conexión' }).click();
+ await expect(page.getByText('Conexión correcta: 1 tabla.')).toBeVisible();
+ await page.locator('mat-select[data-field="table"]').click();
+ await page.getByRole('option', { name: 'ResultadoSubrogado' }).click();
+ await expect(page.getByText(/Primeras \d+ filas/)).toBeVisible();
+ await page.getByLabel('Nombre de esta fuente').fill('Resultados');
+ await page.getByRole('button', { name: 'Guardar', exact: true }).last().click();
+ await expect(page.getByText('Fuente de datos · Resultados')).toBeVisible();
+ // A wrong password says so in words, not a stack trace.
+ await page.getByRole('button', { name: 'Editar conexión' }).click();
+ await page.locator('[data-field="password"]').fill('not-it');
+ await page.getByRole('button', { name: 'Probar conexión' }).click();
+ await expect(page.getByText(/usuario o la contraseña no son correctos/)).toBeVisible();
+ await page.getByRole('button', { name: 'Cancelar' }).click();
+ await page.getByRole('button', { name: 'Guardar', exact: true }).click();
+ await expect(page.getByText('Versión 1 guardada.')).toBeVisible();
+ expect(problems).toEqual([]);
+});
diff --git a/openapi.json b/openapi.json
index 62f1427..fb5c0c3 100644
--- a/openapi.json
+++ b/openapi.json
@@ -58,6 +58,47 @@
"title": "Analysis",
"type": "object"
},
+ "Answers": {
+ "properties": {
+ "answers": {
+ "additionalProperties": true,
+ "default": {},
+ "title": "Answers",
+ "type": "object"
+ },
+ "node": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Node"
+ },
+ "pipeline": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Pipeline"
+ },
+ "type": {
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type"
+ ],
+ "title": "Answers",
+ "type": "object"
+ },
"Body_add_clinical_validation": {
"properties": {
"file": {
@@ -74,22 +115,118 @@
},
"Body_upload": {
"properties": {
- "file": {
- "contentMediaType": "application/octet-stream",
- "title": "File",
- "type": "string"
+ "files": {
+ "items": {
+ "contentMediaType": "application/octet-stream",
+ "type": "string"
+ },
+ "title": "Files",
+ "type": "array"
+ },
+ "folder": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Folder"
}
},
"required": [
- "file"
+ "files"
],
"title": "Body_upload",
"type": "object"
},
+ "Browsed": {
+ "properties": {
+ "entries": {
+ "items": {
+ "$ref": "#/components/schemas/Entry"
+ },
+ "title": "Entries",
+ "type": "array"
+ },
+ "parent": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Parent"
+ },
+ "path": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Path"
+ }
+ },
+ "required": [
+ "path",
+ "parent",
+ "entries"
+ ],
+ "title": "Browsed",
+ "type": "object"
+ },
+ "Catalog": {
+ "additionalProperties": false,
+ "properties": {
+ "formats": {
+ "items": {
+ "$ref": "#/components/schemas/Option"
+ },
+ "title": "Formats",
+ "type": "array"
+ },
+ "groups": {
+ "additionalProperties": {
+ "$ref": "#/components/schemas/Group"
+ },
+ "title": "Groups",
+ "type": "object"
+ },
+ "providers": {
+ "additionalProperties": {
+ "$ref": "#/components/schemas/Provider"
+ },
+ "title": "Providers",
+ "type": "object"
+ },
+ "types": {
+ "additionalProperties": {
+ "$ref": "#/components/schemas/SourceType"
+ },
+ "title": "Types",
+ "type": "object"
+ }
+ },
+ "required": [
+ "groups",
+ "providers",
+ "formats",
+ "types"
+ ],
+ "title": "Catalog",
+ "type": "object"
+ },
"Condition": {
"properties": {
"column": {
- "title": "Column",
+ "description": "Por ejemplo \u00abtext\u00bb, el texto le\u00eddo del documento.",
+ "title": "Columna",
"type": "string"
},
"op": {
@@ -99,12 +236,37 @@
"matches",
"present"
],
- "title": "Op",
- "type": "string"
+ "title": "Condici\u00f3n",
+ "type": "string",
+ "widget": {
+ "formlyConfig": {
+ "props": {
+ "options": [
+ {
+ "label": "es igual a",
+ "value": "equals"
+ },
+ {
+ "label": "contiene",
+ "value": "contains"
+ },
+ {
+ "label": "coincide con la expresi\u00f3n",
+ "value": "matches"
+ },
+ {
+ "label": "tiene alg\u00fan valor",
+ "value": "present"
+ }
+ ]
+ }
+ }
+ }
},
"value": {
"default": "",
- "title": "Value",
+ "description": "Lo que se busca; por ejemplo \u00abcitolog\u00eda\u00bb.",
+ "title": "Valor",
"type": "string"
}
},
@@ -166,6 +328,67 @@
"title": "Domain",
"type": "string"
},
+ "Entry": {
+ "properties": {
+ "kind": {
+ "enum": [
+ "folder",
+ "file"
+ ],
+ "title": "Kind",
+ "type": "string"
+ },
+ "name": {
+ "title": "Name",
+ "type": "string"
+ },
+ "path": {
+ "title": "Path",
+ "type": "string"
+ },
+ "size": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Size"
+ }
+ },
+ "required": [
+ "name",
+ "path",
+ "kind"
+ ],
+ "title": "Entry",
+ "type": "object"
+ },
+ "ErrorModel": {
+ "properties": {
+ "detail": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ }
+ ],
+ "title": "Detail"
+ }
+ },
+ "required": [
+ "detail"
+ ],
+ "title": "ErrorModel",
+ "type": "object"
+ },
"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 the ConceptMap\nand `formats` as in `map`.",
@@ -182,14 +405,15 @@
"type": "array"
}
],
- "title": "Column"
+ "title": "Columna con el texto"
},
"columns": {
"additionalProperties": {
"type": "string"
},
"default": {},
- "title": "Columns",
+ "description": "Dato \u2192 columna, sin leer el texto.",
+ "title": "Datos tomados de columnas",
"type": "object"
},
"concept_map": {
@@ -203,9 +427,10 @@
"type": "null"
}
],
- "title": "Concept Map"
+ "title": "Equivalencias de c\u00f3digos"
},
"entity": {
+ "description": "Qu\u00e9 estudio se saca del documento.",
"enum": [
"identity",
"cervical_cytology",
@@ -219,7 +444,7 @@
"ados2",
"eeg"
],
- "title": "Entity",
+ "title": "Estudio",
"type": "string"
},
"formats": {
@@ -227,12 +452,13 @@
"type": "string"
},
"default": {},
- "title": "Formats",
+ "title": "Formatos de fecha",
"type": "object"
},
"hints": {
"default": "",
- "title": "Hints",
+ "description": "Para el modelo de lenguaje.",
+ "title": "Indicaciones",
"type": "string"
},
"id": {
@@ -259,7 +485,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"method": {
@@ -269,15 +496,36 @@
"llm",
"patterns"
],
- "title": "Method",
- "type": "string"
+ "title": "C\u00f3mo leer",
+ "type": "string",
+ "widget": {
+ "formlyConfig": {
+ "props": {
+ "options": [
+ {
+ "label": "Autom\u00e1tico",
+ "value": "auto"
+ },
+ {
+ "label": "Con el modelo de lenguaje",
+ "value": "llm"
+ },
+ {
+ "label": "Con patrones",
+ "value": "patterns"
+ }
+ ]
+ }
+ }
+ }
},
"patterns": {
"additionalProperties": {
"type": "string"
},
"default": {},
- "title": "Patterns",
+ "description": "Dato \u2192 expresi\u00f3n con un grupo ( ).",
+ "title": "Patrones",
"type": "object"
},
"position": {
@@ -305,7 +553,7 @@
"properties": {
"column": {
"default": "doc",
- "title": "Column",
+ "title": "Columna con el FHIR",
"type": "string"
},
"concept_map": {
@@ -319,7 +567,7 @@
"type": "null"
}
],
- "title": "Concept Map"
+ "title": "Equivalencias de c\u00f3digos"
},
"entity": {
"enum": [
@@ -335,7 +583,7 @@
"ados2",
"eeg"
],
- "title": "Entity",
+ "title": "Estudio",
"type": "string"
},
"id": {
@@ -362,7 +610,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"position": {
@@ -383,6 +632,120 @@
"title": "Fhir",
"type": "object"
},
+ "FieldSpec": {
+ "additionalProperties": false,
+ "properties": {
+ "advanced": {
+ "default": false,
+ "title": "Advanced",
+ "type": "boolean"
+ },
+ "default": {
+ "title": "Default"
+ },
+ "help": {
+ "default": "",
+ "title": "Help",
+ "type": "string"
+ },
+ "label": {
+ "title": "Label",
+ "type": "string"
+ },
+ "options": {
+ "default": [],
+ "items": {
+ "$ref": "#/components/schemas/Option"
+ },
+ "title": "Options",
+ "type": "array"
+ },
+ "placeholder": {
+ "default": "",
+ "title": "Placeholder",
+ "type": "string"
+ },
+ "provider": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Provider"
+ },
+ "required": {
+ "default": true,
+ "title": "Required",
+ "type": "boolean"
+ },
+ "type": {
+ "default": "text",
+ "enum": [
+ "text",
+ "number",
+ "password",
+ "select",
+ "folder",
+ "server_file",
+ "upload",
+ "url",
+ "oauth",
+ "table",
+ "format"
+ ],
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": [
+ "label"
+ ],
+ "title": "FieldSpec",
+ "type": "object"
+ },
+ "Group": {
+ "additionalProperties": false,
+ "properties": {
+ "description": {
+ "title": "Description",
+ "type": "string"
+ },
+ "title": {
+ "title": "Title",
+ "type": "string"
+ }
+ },
+ "required": [
+ "title",
+ "description"
+ ],
+ "title": "Group",
+ "type": "object"
+ },
+ "Guided": {
+ "additionalProperties": false,
+ "description": "How the Conectar dialog drew a source: its type (core.sources) and the answers given.\nThe node's dlt fields are made from them; drawn by hand (\"Avanzado\"), a node has none.",
+ "properties": {
+ "answers": {
+ "additionalProperties": true,
+ "default": {},
+ "title": "Answers",
+ "type": "object"
+ },
+ "type": {
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": [
+ "type"
+ ],
+ "title": "Guided",
+ "type": "object"
+ },
"HTTPValidationError": {
"properties": {
"detail": {
@@ -406,8 +769,24 @@
"inner",
"left"
],
- "title": "How",
- "type": "string"
+ "title": "Cu\u00e1les quedan",
+ "type": "string",
+ "widget": {
+ "formlyConfig": {
+ "props": {
+ "options": [
+ {
+ "label": "Solo las que tienen pareja",
+ "value": "inner"
+ },
+ {
+ "label": "Todas las de la izquierda",
+ "value": "left"
+ }
+ ]
+ }
+ }
+ }
},
"id": {
"maxLength": 40,
@@ -433,10 +812,12 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"on": {
+ "description": "Pares [columna izquierda, derecha].",
"items": {
"maxItems": 2,
"minItems": 2,
@@ -450,7 +831,7 @@
],
"type": "array"
},
- "title": "On",
+ "title": "Columnas iguales",
"type": "array"
},
"position": {
@@ -487,7 +868,7 @@
"items": {
"type": "string"
},
- "title": "Fields",
+ "title": "Datos que comparar",
"type": "array"
},
"id": {
@@ -514,7 +895,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"position": {
@@ -529,17 +911,19 @@
},
"review": {
"default": 0.5,
+ "description": "Parecidos por encima de esto los ve un revisor.",
"exclusiveMinimum": 0.0,
"maximum": 1.0,
- "title": "Review",
+ "title": "Umbral para revisar",
"type": "number"
},
"rules": {
"default": [],
+ "description": "Vac\u00edo: las de siempre (mismo identificador, o misma fecha de nacimiento y nombre).",
"items": {
"type": "string"
},
- "title": "Rules",
+ "title": "Reglas",
"type": "array"
}
},
@@ -549,6 +933,42 @@
"title": "Link",
"type": "object"
},
+ "Listing": {
+ "additionalProperties": false,
+ "description": "What \"Probar conexi\u00f3n\" shows: a database's tables (the resources of `source`, built\nfrom `args`), or the first rows the type's own node reads (files, records).",
+ "properties": {
+ "args": {
+ "additionalProperties": true,
+ "default": {},
+ "title": "Args",
+ "type": "object"
+ },
+ "kind": {
+ "enum": [
+ "tables",
+ "rows"
+ ],
+ "title": "Kind",
+ "type": "string"
+ },
+ "source": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Source"
+ }
+ },
+ "required": [
+ "kind"
+ ],
+ "title": "Listing",
+ "type": "object"
+ },
"Map": {
"additionalProperties": false,
"description": "Columns to platform fields, the site's codes translated by its ConceptMap\n(core.concept_map), and its date formats.",
@@ -564,13 +984,15 @@
"type": "null"
}
],
- "title": "Concept Map"
+ "description": "La tabla de c\u00f3digos del sitio.",
+ "title": "Equivalencias de c\u00f3digos"
},
"fields": {
"additionalProperties": {
"type": "string"
},
- "title": "Fields",
+ "description": "Dato de la plataforma \u2192 columna del sitio.",
+ "title": "Campos",
"type": "object"
},
"formats": {
@@ -578,7 +1000,8 @@
"type": "string"
},
"default": {},
- "title": "Formats",
+ "description": "Por ejemplo %d/%m/%Y.",
+ "title": "Formatos de fecha",
"type": "object"
},
"id": {
@@ -605,7 +1028,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"position": {
@@ -623,7 +1047,8 @@
"type": "string"
},
"default": {},
- "title": "Values",
+ "description": "Un dato igual para todas las filas.",
+ "title": "Valores fijos",
"type": "object"
}
},
@@ -688,6 +1113,24 @@
"title": "Metric",
"type": "object"
},
+ "Option": {
+ "additionalProperties": false,
+ "properties": {
+ "label": {
+ "title": "Label",
+ "type": "string"
+ },
+ "value": {
+ "title": "Value"
+ }
+ },
+ "required": [
+ "value",
+ "label"
+ ],
+ "title": "Option",
+ "type": "object"
+ },
"PersonDecision": {
"properties": {
"candidate": {
@@ -787,12 +1230,56 @@
"title": "Position",
"type": "object"
},
+ "Provider": {
+ "additionalProperties": false,
+ "description": "A sign-in button's OAuth 2.0 provider (authorization code flow).",
+ "properties": {
+ "authorize_params": {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "default": {},
+ "title": "Authorize Params",
+ "type": "object"
+ },
+ "authorize_url": {
+ "title": "Authorize Url",
+ "type": "string"
+ },
+ "env": {
+ "title": "Env",
+ "type": "string"
+ },
+ "scope": {
+ "title": "Scope",
+ "type": "string"
+ },
+ "title": {
+ "title": "Title",
+ "type": "string"
+ },
+ "token_url": {
+ "title": "Token Url",
+ "type": "string"
+ }
+ },
+ "required": [
+ "title",
+ "env",
+ "authorize_url",
+ "token_url",
+ "scope"
+ ],
+ "title": "Provider",
+ "type": "object"
+ },
"Read": {
"additionalProperties": false,
"description": "Files in a column (PDF, Word, Excel, scans...) to text (MarkItDown, OCRmyPDF).",
"properties": {
"column": {
- "title": "Column",
+ "description": "Donde la entrada trae cada documento.",
+ "title": "Columna con los archivos",
"type": "string"
},
"id": {
@@ -819,7 +1306,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"position": {
@@ -904,12 +1392,14 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"otherwise": {
"default": false,
- "title": "Otherwise",
+ "description": "Recoge lo que nadie reconoce, para revisarlo.",
+ "title": "Lo que ning\u00fan otro tome",
"type": "boolean"
},
"position": {
@@ -927,7 +1417,7 @@
"items": {
"$ref": "#/components/schemas/Condition"
},
- "title": "When",
+ "title": "Pasan las filas donde",
"type": "array"
}
},
@@ -971,6 +1461,24 @@
"title": "SavedPipeline",
"type": "object"
},
+ "SignIn": {
+ "properties": {
+ "state": {
+ "title": "State",
+ "type": "string"
+ },
+ "url": {
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": [
+ "url",
+ "state"
+ ],
+ "title": "SignIn",
+ "type": "object"
+ },
"Source": {
"additionalProperties": false,
"description": "One table, file set or API resource, copied as it is (dlt). Merged on the source's\nown primary key or `primary_key`; replaced whole when it has none.",
@@ -978,9 +1486,20 @@
"args": {
"additionalProperties": true,
"default": {},
- "title": "Args",
+ "description": "Los de la fuente dlt.",
+ "title": "Argumentos (JSON)",
"type": "object"
},
+ "guided": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/Guided"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
"id": {
"maxLength": 40,
"pattern": "^[a-z][a-z0-9_]*$",
@@ -1005,7 +1524,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"position": {
@@ -1020,10 +1540,11 @@
},
"primary_key": {
"default": [],
+ "description": "Columnas que identifican una fila.",
"items": {
"type": "string"
},
- "title": "Primary Key",
+ "title": "Llave",
"type": "array"
},
"resource": {
@@ -1035,11 +1556,13 @@
"type": "null"
}
],
- "title": "Resource"
+ "description": "Cu\u00e1l, si la fuente ofrece varios (una tabla).",
+ "title": "Recurso"
},
"source": {
+ "description": "M\u00f3dulo:funci\u00f3n de la fuente dlt.",
"pattern": "^[A-Za-z_][\\w.]*:[A-Za-z_]\\w*$",
- "title": "Source",
+ "title": "Fuente dlt",
"type": "string"
},
"then": {
@@ -1052,7 +1575,8 @@
"type": "null"
}
],
- "title": "Then"
+ "description": "Transformador dlt para los archivos.",
+ "title": "Lector"
}
},
"required": [
@@ -1082,6 +1606,94 @@
"title": "SourceRef",
"type": "object"
},
+ "SourceType": {
+ "additionalProperties": false,
+ "properties": {
+ "args": {
+ "additionalProperties": true,
+ "default": {},
+ "title": "Args",
+ "type": "object"
+ },
+ "description": {
+ "title": "Description",
+ "type": "string"
+ },
+ "fields": {
+ "additionalProperties": {
+ "$ref": "#/components/schemas/FieldSpec"
+ },
+ "title": "Fields",
+ "type": "object"
+ },
+ "group": {
+ "title": "Group",
+ "type": "string"
+ },
+ "icon": {
+ "title": "Icon",
+ "type": "string"
+ },
+ "listing": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/Listing"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "primary_key": {
+ "default": [],
+ "items": {
+ "type": "string"
+ },
+ "title": "Primary Key",
+ "type": "array"
+ },
+ "resource": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Resource"
+ },
+ "source": {
+ "title": "Source",
+ "type": "string"
+ },
+ "then": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Then"
+ },
+ "title": {
+ "title": "Title",
+ "type": "string"
+ }
+ },
+ "required": [
+ "group",
+ "title",
+ "description",
+ "icon",
+ "fields",
+ "source"
+ ],
+ "title": "SourceType",
+ "type": "object"
+ },
"Study": {
"properties": {
"analysed": {
@@ -1151,6 +1763,7 @@
"description": "Rows of platform fields into one platform entity, each row given its person by the\none `link` node among the inputs. Rule breaks are held for review.",
"properties": {
"entity": {
+ "description": "En qu\u00e9 estudio de la plataforma se guarda.",
"enum": [
"identity",
"cervical_cytology",
@@ -1164,7 +1777,7 @@
"ados2",
"eeg"
],
- "title": "Entity",
+ "title": "Estudio",
"type": "string"
},
"id": {
@@ -1191,7 +1804,8 @@
},
"label": {
"default": "",
- "title": "Label",
+ "description": "C\u00f3mo se ve en el diagrama.",
+ "title": "Nombre",
"type": "string"
},
"position": {
@@ -1212,6 +1826,52 @@
"title": "Target",
"type": "object"
},
+ "Tested": {
+ "properties": {
+ "detail": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Detail"
+ },
+ "message": {
+ "title": "Message",
+ "type": "string"
+ },
+ "ok": {
+ "title": "Ok",
+ "type": "boolean"
+ },
+ "rows": {
+ "default": [],
+ "items": {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ "title": "Rows",
+ "type": "array"
+ },
+ "tables": {
+ "default": [],
+ "items": {
+ "type": "string"
+ },
+ "title": "Tables",
+ "type": "array"
+ }
+ },
+ "required": [
+ "ok",
+ "message"
+ ],
+ "title": "Tested",
+ "type": "object"
+ },
"Training": {
"properties": {
"as_of": {
@@ -1238,6 +1898,230 @@
"title": "Training",
"type": "object"
},
+ "Uploaded": {
+ "properties": {
+ "bucket_url": {
+ "title": "Bucket Url",
+ "type": "string"
+ },
+ "files": {
+ "items": {
+ "type": "string"
+ },
+ "title": "Files",
+ "type": "array"
+ }
+ },
+ "required": [
+ "bucket_url",
+ "files"
+ ],
+ "title": "Uploaded",
+ "type": "object"
+ },
+ "UserCreate": {
+ "properties": {
+ "domains": {
+ "default": [],
+ "items": {
+ "$ref": "#/components/schemas/Domain"
+ },
+ "title": "Domains",
+ "type": "array"
+ },
+ "email": {
+ "format": "email",
+ "title": "Email",
+ "type": "string"
+ },
+ "is_active": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": true,
+ "title": "Is Active"
+ },
+ "is_superuser": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": false,
+ "title": "Is Superuser"
+ },
+ "is_verified": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": false,
+ "title": "Is Verified"
+ },
+ "name": {
+ "default": "",
+ "title": "Name",
+ "type": "string"
+ },
+ "password": {
+ "title": "Password",
+ "type": "string"
+ }
+ },
+ "required": [
+ "email",
+ "password"
+ ],
+ "title": "UserCreate",
+ "type": "object"
+ },
+ "UserRead": {
+ "properties": {
+ "domains": {
+ "default": [],
+ "items": {
+ "$ref": "#/components/schemas/Domain"
+ },
+ "title": "Domains",
+ "type": "array"
+ },
+ "email": {
+ "format": "email",
+ "title": "Email",
+ "type": "string"
+ },
+ "id": {
+ "format": "uuid",
+ "title": "Id",
+ "type": "string"
+ },
+ "is_active": {
+ "default": true,
+ "title": "Is Active",
+ "type": "boolean"
+ },
+ "is_superuser": {
+ "default": false,
+ "title": "Is Superuser",
+ "type": "boolean"
+ },
+ "is_verified": {
+ "default": false,
+ "title": "Is Verified",
+ "type": "boolean"
+ },
+ "name": {
+ "default": "",
+ "title": "Name",
+ "type": "string"
+ }
+ },
+ "required": [
+ "id",
+ "email"
+ ],
+ "title": "UserRead",
+ "type": "object"
+ },
+ "UserUpdate": {
+ "properties": {
+ "domains": {
+ "anyOf": [
+ {
+ "items": {
+ "$ref": "#/components/schemas/Domain"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Domains"
+ },
+ "email": {
+ "anyOf": [
+ {
+ "format": "email",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Email"
+ },
+ "is_active": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Is Active"
+ },
+ "is_superuser": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Is Superuser"
+ },
+ "is_verified": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Is Verified"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Name"
+ },
+ "password": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Password"
+ }
+ },
+ "title": "UserUpdate",
+ "type": "object"
+ },
"ValidationError": {
"properties": {
"ctx": {
@@ -1327,6 +2211,72 @@
],
"title": "Version",
"type": "object"
+ },
+ "login": {
+ "properties": {
+ "client_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Client Id"
+ },
+ "client_secret": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "format": "password",
+ "title": "Client Secret"
+ },
+ "grant_type": {
+ "anyOf": [
+ {
+ "pattern": "^password$",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Grant Type"
+ },
+ "password": {
+ "format": "password",
+ "title": "Password",
+ "type": "string"
+ },
+ "scope": {
+ "default": "",
+ "title": "Scope",
+ "type": "string"
+ },
+ "username": {
+ "title": "Username",
+ "type": "string"
+ }
+ },
+ "required": [
+ "username",
+ "password"
+ ],
+ "title": "Body_auth:cookie.login",
+ "type": "object"
+ }
+ },
+ "securitySchemes": {
+ "APIKeyCookie": {
+ "in": "cookie",
+ "name": "isssteleon_session",
+ "type": "apiKey"
}
}
},
@@ -1336,6 +2286,102 @@
},
"openapi": "3.1.0",
"paths": {
+ "/auth/login": {
+ "post": {
+ "operationId": "auth:cookie.login",
+ "requestBody": {
+ "content": {
+ "application/x-www-form-urlencoded": {
+ "schema": {
+ "$ref": "#/components/schemas/login"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {}
+ }
+ },
+ "description": "Successful Response"
+ },
+ "204": {
+ "description": "No Content"
+ },
+ "400": {
+ "content": {
+ "application/json": {
+ "examples": {
+ "LOGIN_BAD_CREDENTIALS": {
+ "summary": "Bad credentials or the user is inactive.",
+ "value": {
+ "detail": "LOGIN_BAD_CREDENTIALS"
+ }
+ },
+ "LOGIN_USER_NOT_VERIFIED": {
+ "summary": "The user is not verified.",
+ "value": {
+ "detail": "LOGIN_USER_NOT_VERIFIED"
+ }
+ }
+ },
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
+ }
+ }
+ },
+ "description": "Bad Request"
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "summary": "Auth:Cookie.Login",
+ "tags": [
+ "auth"
+ ]
+ }
+ },
+ "/auth/logout": {
+ "post": {
+ "operationId": "auth:cookie.logout",
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {}
+ }
+ },
+ "description": "Successful Response"
+ },
+ "204": {
+ "description": "No Content"
+ },
+ "401": {
+ "description": "Missing token or inactive user."
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Auth:Cookie.Logout",
+ "tags": [
+ "auth"
+ ]
+ }
+ },
"/domains": {
"get": {
"operationId": "domains",
@@ -1813,6 +2859,108 @@
]
}
},
+ "/ingest/sources/browse": {
+ "get": {
+ "description": "The server folders a source may read: the roots, or what one folder under them\nholds. Nothing outside the roots is shown.",
+ "operationId": "browse",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "path",
+ "required": false,
+ "schema": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Path"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Browsed"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "summary": "Browse",
+ "tags": [
+ "ingest"
+ ]
+ }
+ },
+ "/ingest/sources/oauth/{provider}/start": {
+ "get": {
+ "description": "The provider's sign-in address. `origin` is the web app's (where the user returns:\n`{origin}/api/\u2026/callback`, the address IT registered).",
+ "operationId": "oauth_start",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "provider",
+ "required": true,
+ "schema": {
+ "title": "Provider",
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "origin",
+ "required": true,
+ "schema": {
+ "title": "Origin",
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SignIn"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "summary": "Oauth Start",
+ "tags": [
+ "ingest"
+ ]
+ }
+ },
"/ingest/sources/preview": {
"post": {
"description": "The first rows a source node would load.",
@@ -1920,9 +3068,87 @@
]
}
},
+ "/ingest/sources/test": {
+ "post": {
+ "description": "\"Probar conexi\u00f3n\": reaches the source with the answers given. A database lists its\ntables (until one is picked; then its first rows); files and records show their first\nrows. Never a server error: what went wrong comes back in plain words.",
+ "operationId": "test_source",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "limit",
+ "required": false,
+ "schema": {
+ "default": 20,
+ "maximum": 100,
+ "minimum": 1,
+ "title": "Limit",
+ "type": "integer"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Answers"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Tested"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "summary": "Test Source",
+ "tags": [
+ "ingest"
+ ]
+ }
+ },
+ "/ingest/sources/types": {
+ "get": {
+ "description": "Every kind of source the dialog offers, grouped, with the fields each one asks.",
+ "operationId": "source_types",
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Catalog"
+ }
+ }
+ },
+ "description": "Successful Response"
+ }
+ },
+ "summary": "Source Types",
+ "tags": [
+ "ingest"
+ ]
+ }
+ },
"/ingest/uploads": {
"post": {
- "description": "A CSV, Excel or document file for a `filesystem` source: use `bucket_url`.",
+ "description": "Files from the operator's computer (one, many, or a whole folder), kept on the\nserver for a `filesystem` source; streamed to disk, so large recordings fit. Send\n`folder` from a previous answer to add to the same set.",
"operationId": "upload",
"requestBody": {
"content": {
@@ -1939,11 +3165,7 @@
"content": {
"application/json": {
"schema": {
- "additionalProperties": {
- "type": "string"
- },
- "title": "Response Upload",
- "type": "object"
+ "$ref": "#/components/schemas/Uploaded"
}
}
},
@@ -2583,7 +3805,7 @@
},
"/review/persons": {
"get": {
- "description": "Persons to settle (with their possible owners) and torn persons (with their\nrecords) left by a pipeline's link node.",
+ "description": "Persons to settle (with their possible owners), torn persons and persons nothing\nnames (with their records) left by a pipeline's link node.",
"operationId": "persons",
"parameters": [
{
@@ -2898,6 +4120,376 @@
]
}
},
+ "/users/me": {
+ "get": {
+ "operationId": "users:current_user",
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserRead"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "401": {
+ "description": "Missing token or inactive user."
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Users:Current User",
+ "tags": [
+ "users"
+ ]
+ },
+ "patch": {
+ "operationId": "users:patch_current_user",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserUpdate"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserRead"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "400": {
+ "content": {
+ "application/json": {
+ "examples": {
+ "UPDATE_USER_EMAIL_ALREADY_EXISTS": {
+ "summary": "A user with this email already exists.",
+ "value": {
+ "detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"
+ }
+ },
+ "UPDATE_USER_INVALID_PASSWORD": {
+ "summary": "Password validation failed.",
+ "value": {
+ "detail": {
+ "code": "UPDATE_USER_INVALID_PASSWORD",
+ "reason": "Password should beat least 3 characters"
+ }
+ }
+ }
+ },
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
+ }
+ }
+ },
+ "description": "Bad Request"
+ },
+ "401": {
+ "description": "Missing token or inactive user."
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Users:Patch Current User",
+ "tags": [
+ "users"
+ ]
+ }
+ },
+ "/users/register": {
+ "post": {
+ "operationId": "register:register",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserCreate"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "201": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserRead"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "400": {
+ "content": {
+ "application/json": {
+ "examples": {
+ "REGISTER_INVALID_PASSWORD": {
+ "summary": "Password validation failed.",
+ "value": {
+ "detail": {
+ "code": "REGISTER_INVALID_PASSWORD",
+ "reason": "Password should beat least 3 characters"
+ }
+ }
+ },
+ "REGISTER_USER_ALREADY_EXISTS": {
+ "summary": "A user with this email already exists.",
+ "value": {
+ "detail": "REGISTER_USER_ALREADY_EXISTS"
+ }
+ }
+ },
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
+ }
+ }
+ },
+ "description": "Bad Request"
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Register:Register",
+ "tags": [
+ "users"
+ ]
+ }
+ },
+ "/users/{id}": {
+ "delete": {
+ "operationId": "users:delete_user",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "required": true,
+ "schema": {
+ "title": "Id",
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Successful Response"
+ },
+ "401": {
+ "description": "Missing token or inactive user."
+ },
+ "403": {
+ "description": "Not a superuser."
+ },
+ "404": {
+ "description": "The user does not exist."
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Users:Delete User",
+ "tags": [
+ "users"
+ ]
+ },
+ "get": {
+ "operationId": "users:user",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "required": true,
+ "schema": {
+ "title": "Id",
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserRead"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "401": {
+ "description": "Missing token or inactive user."
+ },
+ "403": {
+ "description": "Not a superuser."
+ },
+ "404": {
+ "description": "The user does not exist."
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Users:User",
+ "tags": [
+ "users"
+ ]
+ },
+ "patch": {
+ "operationId": "users:patch_user",
+ "parameters": [
+ {
+ "in": "path",
+ "name": "id",
+ "required": true,
+ "schema": {
+ "title": "Id",
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserUpdate"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UserRead"
+ }
+ }
+ },
+ "description": "Successful Response"
+ },
+ "400": {
+ "content": {
+ "application/json": {
+ "examples": {
+ "UPDATE_USER_EMAIL_ALREADY_EXISTS": {
+ "summary": "A user with this email already exists.",
+ "value": {
+ "detail": "UPDATE_USER_EMAIL_ALREADY_EXISTS"
+ }
+ },
+ "UPDATE_USER_INVALID_PASSWORD": {
+ "summary": "Password validation failed.",
+ "value": {
+ "detail": {
+ "code": "UPDATE_USER_INVALID_PASSWORD",
+ "reason": "Password should beat least 3 characters"
+ }
+ }
+ }
+ },
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
+ }
+ }
+ },
+ "description": "Bad Request"
+ },
+ "401": {
+ "description": "Missing token or inactive user."
+ },
+ "403": {
+ "description": "Not a superuser."
+ },
+ "404": {
+ "description": "The user does not exist."
+ },
+ "422": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ },
+ "description": "Validation Error"
+ }
+ },
+ "security": [
+ {
+ "APIKeyCookie": []
+ }
+ ],
+ "summary": "Users:Patch User",
+ "tags": [
+ "users"
+ ]
+ }
+ },
"/{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).",
diff --git a/src/app/api/fn/auth/auth-cookie-login.ts b/src/app/api/fn/auth/auth-cookie-login.ts
new file mode 100644
index 0000000..01a450b
--- /dev/null
+++ b/src/app/api/fn/auth/auth-cookie-login.ts
@@ -0,0 +1,32 @@
+/* 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 { Login } from '../../models/login';
+
+export interface AuthCookieLogin$Params {
+ body: Login
+}
+
+export function authCookieLogin(http: HttpClient, rootUrl: string, params: AuthCookieLogin$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, authCookieLogin.PATH, 'post');
+ if (params) {
+ rb.body(params.body, 'application/x-www-form-urlencoded');
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+authCookieLogin.PATH = '/auth/login';
diff --git a/src/app/api/fn/auth/auth-cookie-logout.ts b/src/app/api/fn/auth/auth-cookie-logout.ts
new file mode 100644
index 0000000..ff5ac75
--- /dev/null
+++ b/src/app/api/fn/auth/auth-cookie-logout.ts
@@ -0,0 +1,29 @@
+/* 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 AuthCookieLogout$Params {
+}
+
+export function authCookieLogout(http: HttpClient, rootUrl: string, params?: AuthCookieLogout$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, authCookieLogout.PATH, 'post');
+ if (params) {
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+authCookieLogout.PATH = '/auth/logout';
diff --git a/src/app/api/fn/ingest/browse.ts b/src/app/api/fn/ingest/browse.ts
new file mode 100644
index 0000000..ba99f04
--- /dev/null
+++ b/src/app/api/fn/ingest/browse.ts
@@ -0,0 +1,32 @@
+/* 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 { Browsed } from '../../models/browsed';
+
+export interface Browse$Params {
+ path?: (string | null);
+}
+
+export function browse(http: HttpClient, rootUrl: string, params?: Browse$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, browse.PATH, 'get');
+ if (params) {
+ rb.query('path', params.path, {});
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+browse.PATH = '/ingest/sources/browse';
diff --git a/src/app/api/fn/ingest/oauth-start.ts b/src/app/api/fn/ingest/oauth-start.ts
new file mode 100644
index 0000000..0e61283
--- /dev/null
+++ b/src/app/api/fn/ingest/oauth-start.ts
@@ -0,0 +1,34 @@
+/* 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 { SignIn } from '../../models/sign-in';
+
+export interface OauthStart$Params {
+ provider: string;
+ origin: string;
+}
+
+export function oauthStart(http: HttpClient, rootUrl: string, params: OauthStart$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, oauthStart.PATH, 'get');
+ if (params) {
+ rb.path('provider', params.provider, {});
+ rb.query('origin', params.origin, {});
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+oauthStart.PATH = '/ingest/sources/oauth/{provider}/start';
diff --git a/src/app/api/fn/ingest/source-types.ts b/src/app/api/fn/ingest/source-types.ts
new file mode 100644
index 0000000..62b7206
--- /dev/null
+++ b/src/app/api/fn/ingest/source-types.ts
@@ -0,0 +1,30 @@
+/* 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 { Catalog } from '../../models/catalog';
+
+export interface SourceTypes$Params {
+}
+
+export function sourceTypes(http: HttpClient, rootUrl: string, params?: SourceTypes$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, sourceTypes.PATH, 'get');
+ if (params) {
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+sourceTypes.PATH = '/ingest/sources/types';
diff --git a/src/app/api/fn/ingest/test-source.ts b/src/app/api/fn/ingest/test-source.ts
new file mode 100644
index 0000000..3f2b67c
--- /dev/null
+++ b/src/app/api/fn/ingest/test-source.ts
@@ -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';
+
+import { Answers } from '../../models/answers';
+import { Tested } from '../../models/tested';
+
+export interface TestSource$Params {
+ limit?: number;
+ body: Answers
+}
+
+export function testSource(http: HttpClient, rootUrl: string, params: TestSource$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, testSource.PATH, 'post');
+ if (params) {
+ rb.query('limit', params.limit, {});
+ rb.body(params.body, 'application/json');
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+testSource.PATH = '/ingest/sources/test';
diff --git a/src/app/api/fn/ingest/upload.ts b/src/app/api/fn/ingest/upload.ts
index f5055fe..c35dc19 100644
--- a/src/app/api/fn/ingest/upload.ts
+++ b/src/app/api/fn/ingest/upload.ts
@@ -8,14 +8,13 @@ import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { BodyUpload } from '../../models/body-upload';
+import { Uploaded } from '../../models/uploaded';
export interface Upload$Params {
body: BodyUpload
}
-export function upload(http: HttpClient, rootUrl: string, params: Upload$Params, context?: HttpContext): Observable> {
+export function upload(http: HttpClient, rootUrl: string, params: Upload$Params, context?: HttpContext): Observable> {
const rb = new RequestBuilder(rootUrl, upload.PATH, 'post');
if (params) {
rb.body(params.body, 'multipart/form-data');
@@ -26,9 +25,7 @@ export function upload(http: HttpClient, rootUrl: string, params: Upload$Params,
).pipe(
filter((r: any): r is HttpResponse => r instanceof HttpResponse),
map((r: HttpResponse) => {
- return r as StrictHttpResponse<{
- [key: string]: string;
- }>;
+ return r as StrictHttpResponse;
})
);
}
diff --git a/src/app/api/fn/users/register-register.ts b/src/app/api/fn/users/register-register.ts
new file mode 100644
index 0000000..7c1d739
--- /dev/null
+++ b/src/app/api/fn/users/register-register.ts
@@ -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';
+
+import { UserCreate } from '../../models/user-create';
+import { UserRead } from '../../models/user-read';
+
+export interface RegisterRegister$Params {
+ body: UserCreate
+}
+
+export function registerRegister(http: HttpClient, rootUrl: string, params: RegisterRegister$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, registerRegister.PATH, 'post');
+ if (params) {
+ rb.body(params.body, 'application/json');
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+registerRegister.PATH = '/users/register';
diff --git a/src/app/api/fn/users/users-current-user.ts b/src/app/api/fn/users/users-current-user.ts
new file mode 100644
index 0000000..c208f35
--- /dev/null
+++ b/src/app/api/fn/users/users-current-user.ts
@@ -0,0 +1,30 @@
+/* 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 { UserRead } from '../../models/user-read';
+
+export interface UsersCurrentUser$Params {
+}
+
+export function usersCurrentUser(http: HttpClient, rootUrl: string, params?: UsersCurrentUser$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, usersCurrentUser.PATH, 'get');
+ if (params) {
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+usersCurrentUser.PATH = '/users/me';
diff --git a/src/app/api/fn/users/users-delete-user.ts b/src/app/api/fn/users/users-delete-user.ts
new file mode 100644
index 0000000..256549f
--- /dev/null
+++ b/src/app/api/fn/users/users-delete-user.ts
@@ -0,0 +1,31 @@
+/* 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 UsersDeleteUser$Params {
+ id: string;
+}
+
+export function usersDeleteUser(http: HttpClient, rootUrl: string, params: UsersDeleteUser$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, usersDeleteUser.PATH, 'delete');
+ if (params) {
+ rb.path('id', params.id, {});
+ }
+
+ return http.request(
+ rb.build({ responseType: 'text', accept: '*/*', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return (r as HttpResponse).clone({ body: undefined }) as StrictHttpResponse;
+ })
+ );
+}
+
+usersDeleteUser.PATH = '/users/{id}';
diff --git a/src/app/api/fn/users/users-patch-current-user.ts b/src/app/api/fn/users/users-patch-current-user.ts
new file mode 100644
index 0000000..5e611bf
--- /dev/null
+++ b/src/app/api/fn/users/users-patch-current-user.ts
@@ -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';
+
+import { UserRead } from '../../models/user-read';
+import { UserUpdate } from '../../models/user-update';
+
+export interface UsersPatchCurrentUser$Params {
+ body: UserUpdate
+}
+
+export function usersPatchCurrentUser(http: HttpClient, rootUrl: string, params: UsersPatchCurrentUser$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, usersPatchCurrentUser.PATH, 'patch');
+ if (params) {
+ rb.body(params.body, 'application/json');
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+usersPatchCurrentUser.PATH = '/users/me';
diff --git a/src/app/api/fn/users/users-patch-user.ts b/src/app/api/fn/users/users-patch-user.ts
new file mode 100644
index 0000000..c1534d7
--- /dev/null
+++ b/src/app/api/fn/users/users-patch-user.ts
@@ -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';
+
+import { UserRead } from '../../models/user-read';
+import { UserUpdate } from '../../models/user-update';
+
+export interface UsersPatchUser$Params {
+ id: string;
+ body: UserUpdate
+}
+
+export function usersPatchUser(http: HttpClient, rootUrl: string, params: UsersPatchUser$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, usersPatchUser.PATH, 'patch');
+ if (params) {
+ rb.path('id', params.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 => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+usersPatchUser.PATH = '/users/{id}';
diff --git a/src/app/api/fn/users/users-user.ts b/src/app/api/fn/users/users-user.ts
new file mode 100644
index 0000000..f58fe4e
--- /dev/null
+++ b/src/app/api/fn/users/users-user.ts
@@ -0,0 +1,32 @@
+/* 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 { UserRead } from '../../models/user-read';
+
+export interface UsersUser$Params {
+ id: string;
+}
+
+export function usersUser(http: HttpClient, rootUrl: string, params: UsersUser$Params, context?: HttpContext): Observable> {
+ const rb = new RequestBuilder(rootUrl, usersUser.PATH, 'get');
+ if (params) {
+ rb.path('id', params.id, {});
+ }
+
+ return http.request(
+ rb.build({ responseType: 'json', accept: 'application/json', context })
+ ).pipe(
+ filter((r: any): r is HttpResponse => r instanceof HttpResponse),
+ map((r: HttpResponse) => {
+ return r as StrictHttpResponse;
+ })
+ );
+}
+
+usersUser.PATH = '/users/{id}';
diff --git a/src/app/api/functions.ts b/src/app/api/functions.ts
index 83cb499..2e4b639 100644
--- a/src/app/api/functions.ts
+++ b/src/app/api/functions.ts
@@ -1,6 +1,10 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
+export type { AuthCookieLogin$Params as AuthCookieLogin$Params } from './fn/auth/auth-cookie-login';
+export { authCookieLogin as authCookieLogin } from './fn/auth/auth-cookie-login';
+export type { AuthCookieLogout$Params as AuthCookieLogout$Params } from './fn/auth/auth-cookie-logout';
+export { authCookieLogout as authCookieLogout } from './fn/auth/auth-cookie-logout';
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';
@@ -23,10 +27,18 @@ export type { StartRun$Params as StartRun$Params } from './fn/ingest/start-run';
export { startRun as startRun } from './fn/ingest/start-run';
export type { Schema$Params as Schema$Params } from './fn/ingest/schema';
export { schema as schema } from './fn/ingest/schema';
+export type { Browse$Params as Browse$Params } from './fn/ingest/browse';
+export { browse as browse } from './fn/ingest/browse';
+export type { OauthStart$Params as OauthStart$Params } from './fn/ingest/oauth-start';
+export { oauthStart as oauthStart } from './fn/ingest/oauth-start';
export type { SourcePreview$Params as SourcePreview$Params } from './fn/ingest/source-preview';
export { sourcePreview as sourcePreview } from './fn/ingest/source-preview';
export type { SourceResources$Params as SourceResources$Params } from './fn/ingest/source-resources';
export { sourceResources as sourceResources } from './fn/ingest/source-resources';
+export type { TestSource$Params as TestSource$Params } from './fn/ingest/test-source';
+export { testSource as testSource } from './fn/ingest/test-source';
+export type { SourceTypes$Params as SourceTypes$Params } from './fn/ingest/source-types';
+export { sourceTypes as sourceTypes } from './fn/ingest/source-types';
export type { Upload$Params as Upload$Params } from './fn/ingest/upload';
export { upload as upload } from './fn/ingest/upload';
export type { Models$Params as Models$Params } from './fn/models/models';
@@ -67,6 +79,18 @@ export type { Studies$Params as Studies$Params } from './fn/eeg/studies';
export { studies as studies } from './fn/eeg/studies';
export type { Study$Params as Study$Params } from './fn/eeg/study';
export { study as study } from './fn/eeg/study';
+export type { UsersCurrentUser$Params as UsersCurrentUser$Params } from './fn/users/users-current-user';
+export { usersCurrentUser as usersCurrentUser } from './fn/users/users-current-user';
+export type { UsersPatchCurrentUser$Params as UsersPatchCurrentUser$Params } from './fn/users/users-patch-current-user';
+export { usersPatchCurrentUser as usersPatchCurrentUser } from './fn/users/users-patch-current-user';
+export type { RegisterRegister$Params as RegisterRegister$Params } from './fn/users/register-register';
+export { registerRegister as registerRegister } from './fn/users/register-register';
+export type { UsersUser$Params as UsersUser$Params } from './fn/users/users-user';
+export { usersUser as usersUser } from './fn/users/users-user';
+export type { UsersDeleteUser$Params as UsersDeleteUser$Params } from './fn/users/users-delete-user';
+export { usersDeleteUser as usersDeleteUser } from './fn/users/users-delete-user';
+export type { UsersPatchUser$Params as UsersPatchUser$Params } from './fn/users/users-patch-user';
+export { usersPatchUser as usersPatchUser } from './fn/users/users-patch-user';
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';
diff --git a/src/app/api/models.ts b/src/app/api/models.ts
index 12a9984..0521c53 100644
--- a/src/app/api/models.ts
+++ b/src/app/api/models.ts
@@ -2,30 +2,49 @@
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export type { Analysis } from './models/analysis';
+export type { Answers } from './models/answers';
export type { BodyAddClinicalValidation } from './models/body-add-clinical-validation';
export type { BodyUpload } from './models/body-upload';
+export type { Browsed } from './models/browsed';
+export type { Catalog } from './models/catalog';
export type { Condition } from './models/condition';
export type { Correction } from './models/correction';
export type { Domain } from './models/domain';
+export type { Entry } from './models/entry';
+export type { ErrorModel } from './models/error-model';
export type { Extract } from './models/extract';
export type { Fhir } from './models/fhir';
+export type { FieldSpec } from './models/field-spec';
+export type { Group } from './models/group';
+export type { Guided } from './models/guided';
export type { HttpValidationError } from './models/http-validation-error';
export type { Join } from './models/join';
export type { Link } from './models/link';
+export type { Listing } from './models/listing';
+export type { Login } from './models/login';
export type { Map } from './models/map';
export type { Metric } from './models/metric';
+export type { Option } from './models/option';
export type { PersonDecision } from './models/person-decision';
export type { Pipeline } from './models/pipeline';
export type { Position } from './models/position';
+export type { Provider } from './models/provider';
export type { Read } from './models/read';
export type { Rejection } from './models/rejection';
export type { Route } from './models/route';
export type { RunRequest } from './models/run-request';
export type { SavedPipeline } from './models/saved-pipeline';
+export type { SignIn } from './models/sign-in';
export type { Source } from './models/source';
export type { SourceRef } from './models/source-ref';
+export type { SourceType } from './models/source-type';
export type { Study } from './models/study';
export type { Target } from './models/target';
+export type { Tested } from './models/tested';
export type { Training } from './models/training';
+export type { Uploaded } from './models/uploaded';
+export type { UserCreate } from './models/user-create';
+export type { UserRead } from './models/user-read';
+export type { UserUpdate } from './models/user-update';
export type { ValidationError } from './models/validation-error';
export type { Version } from './models/version';
diff --git a/src/app/api/models/answers.ts b/src/app/api/models/answers.ts
new file mode 100644
index 0000000..45da8fa
--- /dev/null
+++ b/src/app/api/models/answers.ts
@@ -0,0 +1,11 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Answers {
+ answers?: {
+[key: string]: any;
+};
+ node?: (string | null);
+ pipeline?: (string | null);
+ type: string;
+}
diff --git a/src/app/api/models/body-upload.ts b/src/app/api/models/body-upload.ts
index 0600f02..28c29b7 100644
--- a/src/app/api/models/body-upload.ts
+++ b/src/app/api/models/body-upload.ts
@@ -2,5 +2,6 @@
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface BodyUpload {
- file: string;
+ files: Array;
+ folder?: (string | null);
}
diff --git a/src/app/api/models/browsed.ts b/src/app/api/models/browsed.ts
new file mode 100644
index 0000000..7a18d7e
--- /dev/null
+++ b/src/app/api/models/browsed.ts
@@ -0,0 +1,9 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { Entry } from '../models/entry';
+export interface Browsed {
+ entries: Array;
+ parent: (string | null);
+ path: (string | null);
+}
diff --git a/src/app/api/models/catalog.ts b/src/app/api/models/catalog.ts
new file mode 100644
index 0000000..f377243
--- /dev/null
+++ b/src/app/api/models/catalog.ts
@@ -0,0 +1,19 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { Group } from '../models/group';
+import { Option } from '../models/option';
+import { Provider } from '../models/provider';
+import { SourceType } from '../models/source-type';
+export interface Catalog {
+ formats: Array;
+ groups: {
+[key: string]: Group;
+};
+ providers: {
+[key: string]: Provider;
+};
+ types: {
+[key: string]: SourceType;
+};
+}
diff --git a/src/app/api/models/condition.ts b/src/app/api/models/condition.ts
index 7e39071..045ab03 100644
--- a/src/app/api/models/condition.ts
+++ b/src/app/api/models/condition.ts
@@ -2,7 +2,15 @@
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface Condition {
+
+ /**
+ * Por ejemplo «text», el texto leído del documento.
+ */
column: string;
op: 'equals' | 'contains' | 'matches' | 'present';
+
+ /**
+ * Lo que se busca; por ejemplo «citología».
+ */
value?: string;
}
diff --git a/src/app/api/models/entry.ts b/src/app/api/models/entry.ts
new file mode 100644
index 0000000..9fe297d
--- /dev/null
+++ b/src/app/api/models/entry.ts
@@ -0,0 +1,9 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Entry {
+ kind: 'folder' | 'file';
+ name: string;
+ path: string;
+ size?: (number | null);
+}
diff --git a/src/app/api/models/error-model.ts b/src/app/api/models/error-model.ts
new file mode 100644
index 0000000..356aace
--- /dev/null
+++ b/src/app/api/models/error-model.ts
@@ -0,0 +1,8 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface ErrorModel {
+ detail: (string | {
+[key: string]: string;
+});
+}
diff --git a/src/app/api/models/extract.ts b/src/app/api/models/extract.ts
index 69490cb..d43a9b9 100644
--- a/src/app/api/models/extract.ts
+++ b/src/app/api/models/extract.ts
@@ -13,20 +13,40 @@ import { Position } from '../models/position';
*/
export interface Extract {
column: (string | Array);
+
+ /**
+ * Dato → columna, sin leer el texto.
+ */
columns?: {
[key: string]: string;
};
concept_map?: (string | null);
+
+ /**
+ * Qué estudio se saca del documento.
+ */
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
formats?: {
[key: string]: string;
};
+
+ /**
+ * Para el modelo de lenguaje.
+ */
hints?: string;
id: string;
inputs?: Array;
kind?: 'extract';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
method?: 'auto' | 'llm' | 'patterns';
+
+ /**
+ * Dato → expresión con un grupo ( ).
+ */
patterns?: {
[key: string]: string;
};
diff --git a/src/app/api/models/fhir.ts b/src/app/api/models/fhir.ts
index 6022b5e..56b036e 100644
--- a/src/app/api/models/fhir.ts
+++ b/src/app/api/models/fhir.ts
@@ -15,6 +15,10 @@ export interface Fhir {
id: string;
inputs?: Array;
kind?: 'fhir';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
position?: (Position | null);
}
diff --git a/src/app/api/models/field-spec.ts b/src/app/api/models/field-spec.ts
new file mode 100644
index 0000000..2c5d061
--- /dev/null
+++ b/src/app/api/models/field-spec.ts
@@ -0,0 +1,15 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { Option } from '../models/option';
+export interface FieldSpec {
+ advanced?: boolean;
+ default?: any;
+ help?: string;
+ label: string;
+ options?: Array;
+ placeholder?: string;
+ provider?: (string | null);
+ required?: boolean;
+ type?: 'text' | 'number' | 'password' | 'select' | 'folder' | 'server_file' | 'upload' | 'url' | 'oauth' | 'table' | 'format';
+}
diff --git a/src/app/api/models/group.ts b/src/app/api/models/group.ts
new file mode 100644
index 0000000..8fea9a9
--- /dev/null
+++ b/src/app/api/models/group.ts
@@ -0,0 +1,7 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Group {
+ description: string;
+ title: string;
+}
diff --git a/src/app/api/models/guided.ts b/src/app/api/models/guided.ts
new file mode 100644
index 0000000..e75cc8f
--- /dev/null
+++ b/src/app/api/models/guided.ts
@@ -0,0 +1,14 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+
+/**
+ * How the Conectar dialog drew a source: its type (core.sources) and the answers given.
+ * The node's dlt fields are made from them; drawn by hand ("Avanzado"), a node has none.
+ */
+export interface Guided {
+ answers?: {
+[key: string]: any;
+};
+ type: string;
+}
diff --git a/src/app/api/models/join.ts b/src/app/api/models/join.ts
index a795d6b..96c7fe6 100644
--- a/src/app/api/models/join.ts
+++ b/src/app/api/models/join.ts
@@ -11,7 +11,15 @@ export interface Join {
id: string;
inputs?: Array;
kind?: 'join';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
+
+ /**
+ * Pares [columna izquierda, derecha].
+ */
on: Array<[string, string]>;
position?: (Position | null);
}
diff --git a/src/app/api/models/link.ts b/src/app/api/models/link.ts
index fbfaca9..9e3d8b0 100644
--- a/src/app/api/models/link.ts
+++ b/src/app/api/models/link.ts
@@ -16,8 +16,20 @@ export interface Link {
id: string;
inputs?: Array;
kind?: 'link';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
position?: (Position | null);
+
+ /**
+ * Parecidos por encima de esto los ve un revisor.
+ */
review?: number;
+
+ /**
+ * Vacío: las de siempre (mismo identificador, o misma fecha de nacimiento y nombre).
+ */
rules?: Array;
}
diff --git a/src/app/api/models/listing.ts b/src/app/api/models/listing.ts
new file mode 100644
index 0000000..f669610
--- /dev/null
+++ b/src/app/api/models/listing.ts
@@ -0,0 +1,15 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+
+/**
+ * What "Probar conexión" shows: a database's tables (the resources of `source`, built
+ * from `args`), or the first rows the type's own node reads (files, records).
+ */
+export interface Listing {
+ args?: {
+[key: string]: any;
+};
+ kind: 'tables' | 'rows';
+ source?: (string | null);
+}
diff --git a/src/app/api/models/login.ts b/src/app/api/models/login.ts
new file mode 100644
index 0000000..63d5b65
--- /dev/null
+++ b/src/app/api/models/login.ts
@@ -0,0 +1,11 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Login {
+ client_id?: (string | null);
+ client_secret?: (string | null);
+ grant_type?: (string | null);
+ password: string;
+ scope?: string;
+ username: string;
+}
diff --git a/src/app/api/models/map.ts b/src/app/api/models/map.ts
index 5eb663a..3efccb7 100644
--- a/src/app/api/models/map.ts
+++ b/src/app/api/models/map.ts
@@ -8,18 +8,38 @@ import { Position } from '../models/position';
* (core.concept_map), and its date formats.
*/
export interface Map {
+
+ /**
+ * La tabla de códigos del sitio.
+ */
concept_map?: (string | null);
+
+ /**
+ * Dato de la plataforma → columna del sitio.
+ */
fields: {
[key: string]: string;
};
+
+ /**
+ * Por ejemplo %d/%m/%Y.
+ */
formats?: {
[key: string]: string;
};
id: string;
inputs?: Array;
kind?: 'map';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
position?: (Position | null);
+
+ /**
+ * Un dato igual para todas las filas.
+ */
values?: {
[key: string]: string;
};
diff --git a/src/app/api/models/option.ts b/src/app/api/models/option.ts
new file mode 100644
index 0000000..75a85c8
--- /dev/null
+++ b/src/app/api/models/option.ts
@@ -0,0 +1,7 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Option {
+ label: string;
+ value: any;
+}
diff --git a/src/app/api/models/provider.ts b/src/app/api/models/provider.ts
new file mode 100644
index 0000000..43e30cc
--- /dev/null
+++ b/src/app/api/models/provider.ts
@@ -0,0 +1,17 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+
+/**
+ * A sign-in button's OAuth 2.0 provider (authorization code flow).
+ */
+export interface Provider {
+ authorize_params?: {
+[key: string]: string;
+};
+ authorize_url: string;
+ env: string;
+ scope: string;
+ title: string;
+ token_url: string;
+}
diff --git a/src/app/api/models/read.ts b/src/app/api/models/read.ts
index a02b620..2f7b104 100644
--- a/src/app/api/models/read.ts
+++ b/src/app/api/models/read.ts
@@ -7,10 +7,18 @@ import { Position } from '../models/position';
* Files in a column (PDF, Word, Excel, scans...) to text (MarkItDown, OCRmyPDF).
*/
export interface Read {
+
+ /**
+ * Donde la entrada trae cada documento.
+ */
column: string;
id: string;
inputs?: Array;
kind?: 'read';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
position?: (Position | null);
}
diff --git a/src/app/api/models/route.ts b/src/app/api/models/route.ts
index de24e93..57ac688 100644
--- a/src/app/api/models/route.ts
+++ b/src/app/api/models/route.ts
@@ -13,7 +13,15 @@ export interface Route {
id: string;
inputs?: Array;
kind?: 'route';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
+
+ /**
+ * Recoge lo que nadie reconoce, para revisarlo.
+ */
otherwise?: boolean;
position?: (Position | null);
when?: Array;
diff --git a/src/app/api/models/sign-in.ts b/src/app/api/models/sign-in.ts
new file mode 100644
index 0000000..4722984
--- /dev/null
+++ b/src/app/api/models/sign-in.ts
@@ -0,0 +1,7 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface SignIn {
+ state: string;
+ url: string;
+}
diff --git a/src/app/api/models/source-type.ts b/src/app/api/models/source-type.ts
new file mode 100644
index 0000000..d7539f8
--- /dev/null
+++ b/src/app/api/models/source-type.ts
@@ -0,0 +1,22 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { FieldSpec } from '../models/field-spec';
+import { Listing } from '../models/listing';
+export interface SourceType {
+ args?: {
+[key: string]: any;
+};
+ description: string;
+ fields: {
+[key: string]: FieldSpec;
+};
+ group: string;
+ icon: string;
+ listing?: (Listing | null);
+ primary_key?: Array;
+ resource?: (string | null);
+ source: string;
+ then?: (string | null);
+ title: string;
+}
diff --git a/src/app/api/models/source.ts b/src/app/api/models/source.ts
index e72ff7f..ca4498a 100644
--- a/src/app/api/models/source.ts
+++ b/src/app/api/models/source.ts
@@ -1,6 +1,7 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
+import { Guided } from '../models/guided';
import { Position } from '../models/position';
/**
@@ -8,16 +9,41 @@ import { Position } from '../models/position';
* own primary key or `primary_key`; replaced whole when it has none.
*/
export interface Source {
+
+ /**
+ * Los de la fuente dlt.
+ */
args?: {
[key: string]: any;
};
+ guided?: (Guided | null);
id: string;
inputs?: Array;
kind?: 'source';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
position?: (Position | null);
+
+ /**
+ * Columnas que identifican una fila.
+ */
primary_key?: Array;
+
+ /**
+ * Cuál, si la fuente ofrece varios (una tabla).
+ */
resource?: (string | null);
+
+ /**
+ * Módulo:función de la fuente dlt.
+ */
source: string;
+
+ /**
+ * Transformador dlt para los archivos.
+ */
then?: (string | null);
}
diff --git a/src/app/api/models/target.ts b/src/app/api/models/target.ts
index ea0da43..e198c5a 100644
--- a/src/app/api/models/target.ts
+++ b/src/app/api/models/target.ts
@@ -8,10 +8,18 @@ import { Position } from '../models/position';
* one `link` node among the inputs. Rule breaks are held for review.
*/
export interface Target {
+
+ /**
+ * En qué estudio de la plataforma se guarda.
+ */
entity: 'identity' | 'cervical_cytology' | 'cervical_biopsy' | 'mammography' | 'breast_biopsy' | 'breast_treatment' | 'clinical_note' | 'death' | 'mchat' | 'ados2' | 'eeg';
id: string;
inputs?: Array;
kind?: 'target';
+
+ /**
+ * Cómo se ve en el diagrama.
+ */
label?: string;
position?: (Position | null);
}
diff --git a/src/app/api/models/tested.ts b/src/app/api/models/tested.ts
new file mode 100644
index 0000000..7441852
--- /dev/null
+++ b/src/app/api/models/tested.ts
@@ -0,0 +1,12 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Tested {
+ detail?: (string | null);
+ message: string;
+ ok: boolean;
+ rows?: Array<{
+[key: string]: any;
+}>;
+ tables?: Array;
+}
diff --git a/src/app/api/models/uploaded.ts b/src/app/api/models/uploaded.ts
new file mode 100644
index 0000000..2fac9c8
--- /dev/null
+++ b/src/app/api/models/uploaded.ts
@@ -0,0 +1,7 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+export interface Uploaded {
+ bucket_url: string;
+ files: Array;
+}
diff --git a/src/app/api/models/user-create.ts b/src/app/api/models/user-create.ts
new file mode 100644
index 0000000..84d737e
--- /dev/null
+++ b/src/app/api/models/user-create.ts
@@ -0,0 +1,13 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { Domain } from '../models/domain';
+export interface UserCreate {
+ domains?: Array;
+ email: string;
+ is_active?: (boolean | null);
+ is_superuser?: (boolean | null);
+ is_verified?: (boolean | null);
+ name?: string;
+ password: string;
+}
diff --git a/src/app/api/models/user-read.ts b/src/app/api/models/user-read.ts
new file mode 100644
index 0000000..763c9f3
--- /dev/null
+++ b/src/app/api/models/user-read.ts
@@ -0,0 +1,13 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { Domain } from '../models/domain';
+export interface UserRead {
+ domains?: Array;
+ email: string;
+ id: string;
+ is_active?: boolean;
+ is_superuser?: boolean;
+ is_verified?: boolean;
+ name?: string;
+}
diff --git a/src/app/api/models/user-update.ts b/src/app/api/models/user-update.ts
new file mode 100644
index 0000000..a9dddbb
--- /dev/null
+++ b/src/app/api/models/user-update.ts
@@ -0,0 +1,13 @@
+/* eslint-disable */
+/* Code generated by ng-openapi-gen DO NOT EDIT. */
+
+import { Domain } from '../models/domain';
+export interface UserUpdate {
+ domains?: (Array | null);
+ email?: (string | null);
+ is_active?: (boolean | null);
+ is_superuser?: (boolean | null);
+ is_verified?: (boolean | null);
+ name?: (string | null);
+ password?: (string | null);
+}
diff --git a/src/app/app.html b/src/app/app.html
index 4d3a5bd..74ebbdb 100644
--- a/src/app/app.html
+++ b/src/app/app.html
@@ -22,12 +22,23 @@
} @else {
}
-
- Indicadores
- Conectar
- Revisión
- Gobernanza
-
+ @if (!onLogin()) {
+
+ Indicadores
+ Conectar
+ Revisión
+ Gobernanza
+
+ @if (auth.user(); as u) {
+
+ account_circle {{ u.name || u.email }}
+
+
+ {{ u.email }}
+ logout Salir
+
+ }
+ }
diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts
index bb8e565..1155d75 100644
--- a/src/app/app.routes.ts
+++ b/src/app/app.routes.ts
@@ -1,21 +1,38 @@
import { Routes } from '@angular/router';
+import { domainAllowed, signedIn } from './auth/auth';
export const routes: Routes = [
- { path: '', pathMatch: 'full', redirectTo: 'indicadores/cacu' },
+ { path: 'login', loadComponent: () => import('./auth/login').then((m) => m.Login) },
{
- path: 'indicadores/:domain',
- loadComponent: () => import('./indicadores/indicadores').then((m) => m.Indicadores),
+ path: '',
+ canActivateChild: [signedIn],
+ children: [
+ { path: '', pathMatch: 'full', redirectTo: 'indicadores/cacu' },
+ {
+ path: 'indicadores/:domain',
+ canActivate: [domainAllowed],
+ loadComponent: () => import('./indicadores/indicadores').then((m) => m.Indicadores),
+ },
+ {
+ path: 'indicadores/:domain/pacientes/:id',
+ canActivate: [domainAllowed],
+ loadComponent: () => import('./paciente/paciente').then((m) => m.Paciente),
+ },
+ {
+ path: 'conectar',
+ loadComponent: () => import('./conectar/conectar').then((m) => m.Conectar),
+ },
+ {
+ path: 'revision',
+ loadComponent: () => import('./revision/revision').then((m) => m.Revision),
+ },
+ { path: 'gobernanza', pathMatch: 'full', redirectTo: 'gobernanza/cacu' },
+ {
+ path: 'gobernanza/:domain',
+ canActivate: [domainAllowed],
+ loadComponent: () => import('./gobernanza/gobernanza').then((m) => m.Gobernanza),
+ },
+ { path: '**', redirectTo: 'indicadores/cacu' },
+ ],
},
- {
- path: 'indicadores/:domain/pacientes/:id',
- loadComponent: () => import('./paciente/paciente').then((m) => m.Paciente),
- },
- { path: 'conectar', loadComponent: () => import('./conectar/conectar').then((m) => m.Conectar) },
- { path: 'revision', loadComponent: () => import('./revision/revision').then((m) => m.Revision) },
- { path: 'gobernanza', pathMatch: 'full', redirectTo: 'gobernanza/cacu' },
- {
- path: 'gobernanza/:domain',
- loadComponent: () => import('./gobernanza/gobernanza').then((m) => m.Gobernanza),
- },
- { path: '**', redirectTo: 'indicadores/cacu' },
];
diff --git a/src/app/app.scss b/src/app/app.scss
index 5fab037..91046ef 100644
--- a/src/app/app.scss
+++ b/src/app/app.scss
@@ -72,3 +72,8 @@
display: none;
}
}
+
+.user {
+ color: var(--color-text-secondary);
+ font-weight: 600;
+}
diff --git a/src/app/app.ts b/src/app/app.ts
index e086b65..50a8bfa 100644
--- a/src/app/app.ts
+++ b/src/app/app.ts
@@ -8,6 +8,7 @@ import { filter, map } from 'rxjs';
import { Api } from './api/api';
import { domains } from './api/fn/operations/domains';
import { Domain } from './api/models/domain';
+import { Auth } from './auth/auth';
export const DOMAINS: Record = {
cacu: 'Cáncer cervicouterino',
@@ -32,6 +33,7 @@ export const DOMAINS: Record = {
export class App {
private readonly api = inject(Api);
private readonly router = inject(Router);
+ protected readonly auth = inject(Auth);
protected readonly labels = DOMAINS;
protected readonly domains = resource({ loader: () => this.api.invoke(domains) });
private readonly url = toSignal(
@@ -46,6 +48,17 @@ export class App {
() => /^\/indicadores\/(\w+)/.exec(this.url())?.[1] as Domain | undefined,
);
protected readonly others = computed(() =>
- (this.domains.value() ?? []).filter((d) => d !== this.domain()),
+ (this.domains.value() ?? []).filter((d) => d !== this.domain() && this.auth.canSee(d)),
);
+ /** The sign-in page shows only the brand. */
+ protected readonly onLogin = computed(() => this.url().startsWith('/login'));
+ /** Where "Indicadores" goes: the first domain this user may see. */
+ protected readonly home = computed(
+ () => `/indicadores/${this.auth.user()?.domains[0] ?? 'cacu'}`,
+ );
+
+ protected async logout(): Promise {
+ await this.auth.logout();
+ await this.router.navigateByUrl('/login');
+ }
}
diff --git a/src/app/auth/auth.ts b/src/app/auth/auth.ts
new file mode 100644
index 0000000..1e04c52
--- /dev/null
+++ b/src/app/auth/auth.ts
@@ -0,0 +1,83 @@
+import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';
+import { Injectable, computed, inject, signal } from '@angular/core';
+import { CanActivateFn, Router } from '@angular/router';
+import { firstValueFrom } from 'rxjs';
+import { ApiConfiguration } from '../api/api-configuration';
+import type { Domain } from '../api/models/domain';
+
+/** Who is signed in, and the domains the app shows them. */
+export interface User {
+ id: string;
+ email: string;
+ name: string;
+ is_superuser: boolean;
+ domains: Domain[];
+}
+
+/** The web app's sign-in (the API's fastapi-users, a session cookie). It decides only what
+ * the app shows: the API answers without a session. */
+@Injectable({ providedIn: 'root' })
+export class Auth {
+ private readonly http = inject(HttpClient);
+ private readonly root = inject(ApiConfiguration).rootUrl;
+ /** undefined: not asked yet; null: nobody signed in. */
+ private readonly current = signal(undefined);
+ readonly user = this.current.asReadonly();
+ readonly signedIn = computed(() => !!this.current());
+
+ /** Whether the signed-in user may see the domain (an administrator sees every one). */
+ canSee(domain: string): boolean {
+ const u = this.current();
+ return !!u && (u.is_superuser || u.domains.includes(domain as Domain));
+ }
+
+ async load(): Promise {
+ try {
+ this.current.set(await firstValueFrom(this.http.get(`${this.root}/users/me`)));
+ } catch {
+ this.current.set(null);
+ }
+ return this.current() ?? null;
+ }
+
+ /** Signs in; a wrong user or password comes back as words for the form. */
+ async login(email: string, password: string): Promise {
+ const body = new HttpParams().set('username', email.trim()).set('password', password);
+ try {
+ await firstValueFrom(this.http.post(`${this.root}/auth/login`, body));
+ } catch (e) {
+ if (e instanceof HttpErrorResponse && e.status === 400) {
+ return 'Usuario o contraseña incorrectos.';
+ }
+ return 'No hay conexión con la plataforma. Intente de nuevo.';
+ }
+ await this.load();
+ return null;
+ }
+
+ async logout(): Promise {
+ try {
+ await firstValueFrom(this.http.post(`${this.root}/auth/logout`, null));
+ } finally {
+ this.current.set(null);
+ }
+ }
+}
+
+/** Pages show only to someone signed in; the others go to the sign-in page and come back. */
+export const signedIn: CanActivateFn = async (_route, state) => {
+ const auth = inject(Auth);
+ const user = auth.user() === undefined ? await auth.load() : auth.user();
+ return user
+ ? true
+ : inject(Router).createUrlTree(['/login'], { queryParams: { next: state.url } });
+};
+
+/** A domain's pages show only to whom may see it. */
+export const domainAllowed: CanActivateFn = (route) => {
+ const auth = inject(Auth);
+ const domain = route.paramMap.get('domain');
+ if (!domain || auth.canSee(domain)) return true;
+ const first = auth.user()?.domains[0];
+ return inject(Router).createUrlTree(first ? ['/indicadores', first] : ['/login']);
+};
diff --git a/src/app/auth/login.html b/src/app/auth/login.html
new file mode 100644
index 0000000..512e04c
--- /dev/null
+++ b/src/app/auth/login.html
@@ -0,0 +1,49 @@
+
+
+
+
Inicio de sesión
+
+
©{{ year }} Todos los derechos reservados.
+
+
diff --git a/src/app/auth/login.scss b/src/app/auth/login.scss
new file mode 100644
index 0000000..b99692c
--- /dev/null
+++ b/src/app/auth/login.scss
@@ -0,0 +1,141 @@
+:host {
+ display: flex;
+ flex: 1;
+ min-width: 0;
+ --login-background: #f8f9fa;
+ --login-border: #e9ecef;
+}
+
+.login {
+ align-items: center;
+ display: flex;
+ flex: 1;
+ justify-content: center;
+ padding: 72px 24px 56px;
+}
+
+.box {
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+ max-width: 340px;
+ width: 100%;
+}
+
+/* The brand opens the screen and is the biggest thing on it. */
+.logo {
+ align-self: center;
+ animation: logo-in 600ms ease-out both;
+ display: block;
+ width: 260px;
+}
+
+@keyframes logo-in {
+ from {
+ opacity: 0;
+ transform: translateY(-8px);
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .logo {
+ animation: none;
+ }
+}
+
+/* The title between two rules. */
+.title {
+ align-items: center;
+ color: var(--color-text);
+ display: flex;
+ font-family: var(--font-heading);
+ font-size: 1.375rem;
+ font-weight: 600;
+ gap: 16px;
+ margin: 0 0 8px;
+ white-space: nowrap;
+
+ &::before,
+ &::after {
+ background: var(--color-border);
+ content: '';
+ flex: 1;
+ height: 1px;
+ }
+}
+
+.form {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+}
+
+.field {
+ --mat-form-field-container-height: 44px;
+ --mat-form-field-container-vertical-padding: 12px;
+ width: 100%;
+}
+
+.eye {
+ color: var(--color-text-secondary);
+}
+
+.error {
+ color: var(--mat-sys-error);
+ font-size: 0.875rem;
+ margin: -4px 0 0;
+}
+
+/* One column with the fields; its border turns to the action color once the form is complete. */
+.enter {
+ align-items: center;
+ background: var(--login-background);
+ border: 1px solid var(--login-border);
+ border-radius: 10px;
+ color: var(--color-text-secondary);
+ cursor: default;
+ display: flex;
+ font: inherit;
+ font-size: 0.9375rem;
+ font-weight: 500;
+ justify-content: center;
+ margin-top: 8px;
+ min-height: 46px;
+ transition:
+ background-color 260ms ease,
+ border-color 260ms ease,
+ color 260ms ease;
+ width: 100%;
+
+ &:not(:disabled) {
+ border-color: var(--color-action);
+ color: var(--color-text);
+ cursor: pointer;
+ }
+
+ &:hover:not(:disabled) {
+ background: var(--color-action-hover);
+ }
+
+ &:focus-visible {
+ outline: 2px solid var(--color-action);
+ outline-offset: 2px;
+ }
+}
+
+.legal {
+ color: var(--color-text-secondary);
+ font-size: 0.8125rem;
+ margin: 16px 0 0;
+ text-align: center;
+}
+
+@media (max-width: 600px) {
+ .login {
+ padding: 48px 16px;
+ }
+
+ .logo {
+ width: 208px;
+ }
+}
diff --git a/src/app/auth/login.ts b/src/app/auth/login.ts
new file mode 100644
index 0000000..76f6ed8
--- /dev/null
+++ b/src/app/auth/login.ts
@@ -0,0 +1,42 @@
+import { Component, inject, input, signal } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { MatButtonModule } from '@angular/material/button';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatIconModule } from '@angular/material/icon';
+import { MatInputModule } from '@angular/material/input';
+import { Router } from '@angular/router';
+import { Auth } from './auth';
+
+/** "Inicio de sesión": the brand, two fields and one button. */
+@Component({
+ selector: 'app-login',
+ imports: [FormsModule, MatButtonModule, MatFormFieldModule, MatIconModule, MatInputModule],
+ templateUrl: './login.html',
+ styleUrl: './login.scss',
+})
+export class Login {
+ private readonly auth = inject(Auth);
+ private readonly router = inject(Router);
+ /** Where to go once signed in (the page that asked for it). */
+ readonly next = input('');
+ protected email = '';
+ protected password = '';
+ protected readonly show = signal(false);
+ protected readonly sending = signal(false);
+ protected readonly error = signal('');
+ protected readonly year = new Date().getFullYear();
+
+ protected async enter(): Promise {
+ if (!this.email.trim() || !this.password || this.sending()) return;
+ this.sending.set(true);
+ this.error.set('');
+ const problem = await this.auth.login(this.email, this.password);
+ this.sending.set(false);
+ if (problem) {
+ this.error.set(problem);
+ return;
+ }
+ const first = this.auth.user()?.domains[0] ?? 'cacu';
+ await this.router.navigateByUrl(this.next() || `/indicadores/${first}`);
+ }
+}
diff --git a/src/app/conectar/conectar.html b/src/app/conectar/conectar.html
index 3b922c8..876c82c 100644
--- a/src/app/conectar/conectar.html
+++ b/src/app/conectar/conectar.html
@@ -29,7 +29,9 @@
@if (pipelineId()) {
@for (k of kinds; track k[0]) {
- add {{ k[1] }}
+
+ add {{ k[1] }}
+
}
Guardar
@@ -70,6 +72,7 @@
delete
+ {{ help[d.kind ?? 'source'] }}
Id
@@ -86,12 +89,35 @@
} @else if (d.kind !== 'source') {
Una flecha desde otro nodo le da su entrada.
}
-
+ @if (guided(d); as g) {
+
+
+ check_circle
+ {{ d.label || d.id }}
+
+
+ edit Editar conexión
+
+
+
+ Avanzado (para personal técnico)
+
+ } @else if (d.kind === 'source') {
+
+ cable Conectar con ayuda
+
+ }
+ @if (!guided(d) || advanced()) {
+ @if (guided(d)) {
+ Si cambia algo aquí, la fuente deja de editarse con ayuda.
+ }
+
+ }
@if (conceptMap(d); as cm) {
}
diff --git a/src/app/conectar/conectar.scss b/src/app/conectar/conectar.scss
index 2b54587..83c9ff4 100644
--- a/src/app/conectar/conectar.scss
+++ b/src/app/conectar/conectar.scss
@@ -109,3 +109,34 @@ h2 {
width: auto;
}
}
+
+.help {
+ color: var(--color-text-secondary);
+ font-size: 13px;
+ margin: 0 0 var(--space-2);
+}
+
+.source-summary {
+ align-items: center;
+ background: var(--color-background, #f7f8f6);
+ border: 1px solid var(--color-border);
+ border-radius: 8px;
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-2);
+ justify-content: space-between;
+ margin-bottom: var(--space-2);
+ padding: var(--space-2);
+
+ p {
+ align-items: center;
+ display: flex;
+ font-weight: 500;
+ gap: 6px;
+ margin: 0;
+ }
+
+ p mat-icon {
+ color: var(--color-success, #2e7d32);
+ }
+}
diff --git a/src/app/conectar/conectar.ts b/src/app/conectar/conectar.ts
index 912e5ed..3b6f5db 100644
--- a/src/app/conectar/conectar.ts
+++ b/src/app/conectar/conectar.ts
@@ -6,7 +6,10 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
+import { MatDialog } from '@angular/material/dialog';
+import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatTableModule } from '@angular/material/table';
+import { MatTooltipModule } from '@angular/material/tooltip';
import { FormlyFieldConfig, FormlyForm, provideFormlyCore } from '@ngx-formly/core';
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import { withFormlyMaterial } from '@ngx-formly/material';
@@ -24,6 +27,7 @@ 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';
+import { SourceDialog, SourceDialogData, SourceDialogResult } from './source-dialog';
type Doc = Pipeline['nodes'][number];
type Kind = NonNullable;
@@ -47,16 +51,29 @@ function canvasNode(id: string, point: { x: number; y: number }, label: string):
};
}
+/** Each step's name and what it does, in the operator's words (the canvas and its panel). */
export const KINDS: Record = {
- source: 'Fuente',
- read: 'Leer',
- route: 'Filtrar',
- map: 'Mapear',
- extract: 'Extraer',
- fhir: 'FHIR',
- join: 'Unir',
- link: 'Vincular',
- target: 'Destino',
+ source: 'Fuente de datos',
+ read: 'Leer documentos',
+ route: 'Separar por tipo',
+ map: 'Traducir códigos',
+ extract: 'Sacar datos',
+ fhir: 'Leer FHIR',
+ join: 'Juntar',
+ link: 'Identificar a la persona',
+ target: 'Guardar en la plataforma',
+};
+export const HELP: Record = {
+ source: 'De dónde vienen los datos: una base de datos, una carpeta, la nube o una API.',
+ read: 'Saca el texto de cada documento (PDF, Word, escaneos con OCR).',
+ route:
+ 'Deja pasar solo los documentos o filas que cumplen una condición; por ejemplo, las citologías.',
+ map: 'Cambia los códigos del hospital por los de la plataforma, con una tabla de equivalencias.',
+ extract: 'Toma de cada documento los datos de un estudio: fechas, resultados, nombres.',
+ fhir: 'Lee paquetes FHIR que un sistema envió y saca de ellos los estudios.',
+ join: 'Junta dos entradas que hablan de lo mismo; por ejemplo, un resultado con su orden.',
+ link: 'Reconoce a qué paciente pertenece cada registro, aunque su nombre venga escrito distinto.',
+ target: 'Guarda los estudios ya revisados en la plataforma.',
};
const ID = /^[a-z][a-z0-9_]*$/;
@@ -73,7 +90,9 @@ const ID = /^[a-z][a-z0-9_]*$/;
MatIconModule,
MatInputModule,
MatListModule,
+ MatSlideToggleModule,
MatTableModule,
+ MatTooltipModule,
Vflow,
ConceptMapEditor,
],
@@ -85,7 +104,11 @@ const ID = /^[a-z][a-z0-9_]*$/;
export class Conectar {
private readonly api = inject(Api);
private readonly jsonschema = inject(FormlyJsonschema);
+ private readonly dialog = inject(MatDialog);
protected readonly kinds = Object.entries(KINDS) as [Kind, string][];
+ protected readonly help = HELP;
+ /** The raw form of a source drawn with the dialog ("Avanzado"). */
+ protected readonly advanced = signal(false);
protected readonly list = resource({ loader: () => this.api.invoke(pipelines) });
private readonly schema = resource({ loader: () => this.api.invoke(schema) });
@@ -158,10 +181,47 @@ export class Conectar {
}
protected add(kind: Kind): void {
+ if (kind === 'source') {
+ void this.connectSource();
+ return;
+ }
+ this.place(kind, {});
+ }
+
+ /** "Fuente de datos": the dialog walks the operator through it; editing reopens it. */
+ protected async connectSource(id?: string): Promise {
+ const doc = id ? (this.docs().find((d) => d.id === id) as Source | undefined) : undefined;
+ const data: SourceDialogData = {
+ pipeline: this.pipelineId(),
+ node: doc?.id,
+ guided: doc?.guided ?? null,
+ label: doc?.label ?? '',
+ };
+ const ref = this.dialog.open(SourceDialog, {
+ data,
+ width: '760px',
+ maxWidth: '96vw',
+ maxHeight: '92vh',
+ autoFocus: false,
+ });
+ const result = await new Promise((done) =>
+ ref.afterClosed().subscribe(done),
+ );
+ if (!result) return;
+ if (doc) {
+ this.update(doc.id, (d) => ({ ...d, guided: result.guided, label: result.label }) as Doc);
+ this.select(doc.id);
+ } else {
+ this.place('source', { guided: result.guided, label: result.label });
+ }
+ this.message.set('Fuente lista. Guarde la canalización para conservarla.');
+ }
+
+ private place(kind: Kind, fields: Record): void {
let n = 1;
while (this.docs().some((d) => d.id === `${kind}_${n}`)) n++;
const id = `${kind}_${n}`;
- const doc = { id, kind, inputs: [] } as unknown as Doc;
+ const doc = { id, kind, inputs: [], ...fields } as unknown as Doc;
this.docs.update((ds) => [...ds, doc]);
this.nodes.update((ns) => [
...ns,
@@ -204,6 +264,12 @@ export class Conectar {
);
this.form = new UntypedFormGroup({});
this.preview.set(undefined);
+ this.advanced.set(false);
+ }
+
+ /** A source the dialog drew (its answers make its dlt fields). */
+ protected guided(d: Doc): Source['guided'] {
+ return d.kind === 'source' ? ((d as Source).guided ?? undefined) : undefined;
}
/** The form's values into the selected node. */
@@ -213,6 +279,7 @@ export class Conectar {
const values = Object.fromEntries(
Object.entries(model).filter(([, v]) => v !== undefined && v !== null),
);
+ if (this.advanced()) delete values['guided']; // drawn by hand from here on
this.update(
id,
(d) => ({ ...values, id: d.id, kind: d.kind, inputs: d.inputs }) as unknown as Doc,
diff --git a/src/app/conectar/source-dialog.html b/src/app/conectar/source-dialog.html
new file mode 100644
index 0000000..cfa7156
--- /dev/null
+++ b/src/app/conectar/source-dialog.html
@@ -0,0 +1,369 @@
+@if (!type()) {
+ ¿Dónde están los datos?
+
+ @if (catalog.isLoading()) {
+
+ Cargando opciones…
+
+ }
+ @for (g of groups(); track g.id) {
+
+ {{ g.title }}
+ {{ g.description }}
+
+ @for (t of g.types; track t.id) {
+
+ {{ icon(t.icon) }}
+ {{ t.title }}
+ {{ t.description }}
+
+ }
+
+
+ }
+
+
+ Cancelar
+
+} @else {
+
+ {{ icon(type()!.icon) }} {{ type()!.title }}
+
+
+ {{ type()!.description }}
+
+
+ @switch (f.type === 'server_file' ? 'folder' : f.type) {
+ @case ('password') {
+
+ {{ f.label }}
+
+
+ {{ showPassword()[name] ? 'visibility_off' : 'visibility' }}
+
+ @if (f.help) {
+ {{ f.help }}
+ }
+
+ }
+ @case ('number') {
+
+ {{ f.label }}
+
+ @if (f.help) {
+ {{ f.help }}
+ }
+
+ }
+ @case ('select') {
+
+ {{ f.label }}
+
+ @for (o of f.options; track o.value) {
+ {{ o.label }}
+ }
+
+ @if (f.help) {
+ {{ f.help }}
+ }
+
+ }
+ @case ('format') {
+
+ {{ f.label }}
+
+ @for (o of formats(); track o.value) {
+ {{ o.label }}
+ }
+
+
+ }
+ @case ('table') {
+
+ {{ f.label }}
+ @if (tables().length) {
+
+ @for (t of tables(); track t) {
+ {{ t }}
+ }
+
+ } @else {
+
+ }
+ @if (f.help) {
+ {{ f.help }}
+ }
+
+ }
+ @case ('folder') {
+
+
+ {{ f.label }}
+
+ @if (f.help) {
+ {{ f.help }}
+ }
+
+
+ folder_open Examinar…
+
+
+ @if (browsing(); as b) {
+ @if (b.field === name) {
+
+
+ @if (b.at.path) {
+
+ arrow_upward
+
+ {{ b.at.path }}
+ } @else {
+ Carpetas habilitadas en el servidor
+ }
+
+
+ @for (e of b.at.entries; track e.path) {
+
+ @if (e.kind === 'folder') {
+
+ folder {{ e.name }}
+
+ } @else if (browsingFiles()) {
+
+ description {{ e.name }}
+
+ } @else {
+ description {{ e.name }}
+ }
+
+ } @empty {
+ Vacía.
+ }
+
+
+ Cerrar
+ @if (!browsingFiles()) {
+
+ Elegir esta carpeta
+
+ }
+
+
+ }
+ }
+ }
+ @case ('upload') {
+
+
cloud_upload
+
Arrastre aquí los archivos, o
+
+
+ Elegir archivos
+
+
+ Elegir una carpeta
+
+
+
+
+ @if (uploading(); as u) {
+ @if (u.field === name) {
+
+
Subiendo… {{ u.percent }} %
+ }
+ }
+ @if (uploaded()[name]?.length) {
+
+ check_circle {{ uploaded()[name].length }} archivos subidos
+
+ } @else if (text(name)) {
+
check_circle Archivos ya subidos
+ }
+
+ }
+ @case ('oauth') {
+
+ @if (account(name); as who) {
+
check_circle Conectado como {{ who }}
+
+ Usar otra cuenta
+
+ } @else {
+
+ login
+ Iniciar sesión con {{ catalog.value()?.providers?.[f.provider]?.title }}
+
+ }
+ @if (f.help) {
+
{{ f.help }}
+ }
+
+ }
+ @default {
+
+ {{ f.label }}
+
+ @if (f.help) {
+ {{ f.help }}
+ }
+
+ }
+ }
+
+
+
+ @for (e of fields(); track e[0]) {
+
+ }
+
+ @if (more().length) {
+
+ Más opciones
+
+ @for (e of more(); track e[0]) {
+
+ }
+
+
+ }
+
+
+ 0"
+ >
+ network_check Probar conexión
+
+ @if (testing()) {
+ Conectando…
+ } @else if (missing().length) {
+ Falta: {{ missing().join(', ') }}
+ }
+
+ @if (problem()) {
+ error {{ problem() }}
+ }
+ @if (tested(); as t) {
+
+
+ {{ t.ok ? 'check_circle' : 'error' }} {{ t.message }}
+
+ @if (t.detail) {
+
+ Lo que respondió el sistema
+ {{ t.detail }}
+
+ }
+ @if (t.tables?.length) {
+
Elija una tabla arriba para ver sus primeras filas.
+ }
+ @if (t.rows?.length) {
+
+ {{
+ t.rows!.length === 1
+ ? 'La primera fila:'
+ : 'Las primeras ' + t.rows!.length + ' filas:'
+ }}
+
+
+
+ @for (c of columns(); track c) {
+
+ {{ c }}
+ {{ cell(row[c]) }}
+
+ }
+
+
+
+
+ }
+
+ }
+
+
+ Nombre de esta fuente
+
+ Cómo se verá en el diagrama.
+
+
+
+ @if (!data.guided) {
+
+ arrow_back Otro tipo
+
+ }
+
+ Cancelar
+ Guardar
+
+}
diff --git a/src/app/conectar/source-dialog.scss b/src/app/conectar/source-dialog.scss
new file mode 100644
index 0000000..db5e7dd
--- /dev/null
+++ b/src/app/conectar/source-dialog.scss
@@ -0,0 +1,230 @@
+:host {
+ display: block;
+}
+
+.with-icon {
+ align-items: center;
+ display: flex;
+ gap: var(--space-2);
+}
+
+.hint {
+ color: var(--color-text-secondary);
+ font-size: 13px;
+ margin: 0 0 var(--space-2);
+}
+
+.loading,
+.test {
+ align-items: center;
+ display: flex;
+ gap: var(--space-2);
+ margin: var(--space-2) 0;
+}
+
+.group h3 {
+ font-size: 15px;
+ font-weight: 600;
+ margin: var(--space-3) 0 2px;
+}
+
+.types {
+ display: grid;
+ gap: var(--space-2);
+ grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
+}
+
+.type {
+ align-items: start;
+ background: var(--color-surface);
+ border: 1px solid var(--color-border);
+ border-radius: 10px;
+ cursor: pointer;
+ display: grid;
+ font: inherit;
+ gap: 2px 10px;
+ grid-template-columns: auto 1fr;
+ padding: 12px;
+ text-align: left;
+
+ &:hover,
+ &:focus-visible {
+ border-color: var(--color-primary);
+ box-shadow: 0 0 0 1px var(--color-primary);
+ }
+
+ mat-icon {
+ color: var(--color-primary);
+ grid-row: span 2;
+ }
+}
+
+.type-title {
+ font-weight: 600;
+}
+
+.type-text {
+ color: var(--color-text-secondary);
+ font-size: 12.5px;
+ line-height: 1.35;
+}
+
+.fields {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+}
+
+.full,
+.grow {
+ width: 100%;
+}
+
+.picker {
+ align-items: start;
+ display: flex;
+ gap: var(--space-2);
+
+ .grow {
+ flex: 1;
+ }
+
+ button {
+ margin-top: 10px;
+ }
+}
+
+.browser {
+ border: 1px solid var(--color-border);
+ border-radius: 8px;
+ padding: var(--space-2);
+
+ ul {
+ list-style: none;
+ margin: 0;
+ max-height: 220px;
+ overflow-y: auto;
+ padding: 0;
+ }
+}
+
+.browser-head,
+.browser-actions {
+ align-items: center;
+ display: flex;
+ gap: var(--space-2);
+}
+
+.browser-actions {
+ justify-content: flex-end;
+}
+
+.entry {
+ align-items: center;
+ background: none;
+ border: 0;
+ cursor: pointer;
+ display: flex;
+ font: inherit;
+ gap: 6px;
+ padding: 4px 2px;
+ text-align: left;
+ width: 100%;
+
+ &.file {
+ color: var(--color-text-secondary);
+ cursor: default;
+ }
+
+ &:not(.file):hover {
+ color: var(--color-primary);
+ }
+}
+
+.drop {
+ align-items: center;
+ border: 2px dashed var(--color-border);
+ border-radius: 10px;
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-1, 4px);
+ padding: var(--space-3);
+ text-align: center;
+
+ mat-progress-bar {
+ width: 100%;
+ }
+}
+
+.drop-buttons {
+ display: flex;
+ gap: var(--space-2);
+}
+
+.signin {
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-1, 4px);
+ align-items: flex-start;
+}
+
+.ok,
+.error,
+.result p {
+ align-items: center;
+ display: flex;
+ gap: 6px;
+ margin: var(--space-1, 4px) 0;
+}
+
+.ok mat-icon,
+.result mat-icon {
+ color: var(--color-success, #2e7d32);
+}
+
+.error,
+.result.bad p {
+ color: var(--color-error, #b3261e);
+
+ mat-icon {
+ color: inherit;
+ }
+}
+
+.result {
+ border: 1px solid var(--color-border);
+ border-radius: 8px;
+ margin-top: var(--space-2);
+ padding: var(--space-2);
+
+ pre {
+ font-size: 12px;
+ white-space: pre-wrap;
+ }
+}
+
+.rows {
+ max-height: 260px;
+ overflow: auto;
+
+ td,
+ th {
+ font-size: 12px;
+ max-width: 260px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+}
+
+.more {
+ margin: var(--space-2) 0;
+}
+
+.name {
+ margin-top: var(--space-3);
+}
+
+.spacer {
+ flex: 1;
+}
diff --git a/src/app/conectar/source-dialog.ts b/src/app/conectar/source-dialog.ts
new file mode 100644
index 0000000..a7a7b7e
--- /dev/null
+++ b/src/app/conectar/source-dialog.ts
@@ -0,0 +1,349 @@
+import { NgTemplateOutlet } from '@angular/common';
+import { HttpClient, HttpErrorResponse, HttpEventType } from '@angular/common/http';
+import { Component, computed, inject, resource, signal } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { MatButtonModule } from '@angular/material/button';
+import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
+import { MatExpansionModule } from '@angular/material/expansion';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatIconModule } from '@angular/material/icon';
+import { MatInputModule } from '@angular/material/input';
+import { MatProgressBarModule } from '@angular/material/progress-bar';
+import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
+import { MatSelectModule } from '@angular/material/select';
+import { MatSlideToggleModule } from '@angular/material/slide-toggle';
+import { MatTableModule } from '@angular/material/table';
+import { Api } from '../api/api';
+import { ApiConfiguration } from '../api/api-configuration';
+import { browse } from '../api/fn/ingest/browse';
+import { oauthStart } from '../api/fn/ingest/oauth-start';
+import { sourceTypes } from '../api/fn/ingest/source-types';
+import { testSource } from '../api/fn/ingest/test-source';
+import type { Browsed } from '../api/models/browsed';
+import type { FieldSpec } from '../api/models/field-spec';
+import type { Guided } from '../api/models/guided';
+import type { SourceType } from '../api/models/source-type';
+import type { Tested } from '../api/models/tested';
+import type { Uploaded } from '../api/models/uploaded';
+
+/** What the dialog is opened with: the source being edited, if any. */
+export interface SourceDialogData {
+ pipeline?: string;
+ node?: string;
+ guided?: Guided | null;
+ label?: string;
+}
+/** What it gives back: the dialog's answers (the node's dlt fields are made from them). */
+export interface SourceDialogResult {
+ guided: Guided;
+ label: string;
+}
+
+/** The catalog's generic icon words, as Material Symbols. */
+const ICONS: Record = {
+ database: 'database',
+ upload: 'upload_file',
+ folder: 'folder_open',
+ link: 'link',
+ 'folder-network': 'lan',
+ server: 'dns',
+ cloud: 'cloud',
+ onedrive: 'cloud',
+ sharepoint: 'groups',
+ 'google-drive': 'add_to_drive',
+ web: 'api',
+ fhir: 'local_hospital',
+};
+const MASK = '********';
+
+/** "Nueva fuente": the operator picks what kind of source the data is in, answers only what
+ * that kind needs (in plain words, with pickers and sign-in buttons), tests the connection,
+ * picks a table if there are several, sees the first rows, and saves. No dlt, no JSON. */
+@Component({
+ selector: 'app-source-dialog',
+ imports: [
+ FormsModule,
+ NgTemplateOutlet,
+ MatButtonModule,
+ MatDialogModule,
+ MatExpansionModule,
+ MatFormFieldModule,
+ MatIconModule,
+ MatInputModule,
+ MatProgressBarModule,
+ MatProgressSpinnerModule,
+ MatSelectModule,
+ MatSlideToggleModule,
+ MatTableModule,
+ ],
+ templateUrl: './source-dialog.html',
+ styleUrl: './source-dialog.scss',
+})
+export class SourceDialog {
+ private readonly api = inject(Api);
+ private readonly http = inject(HttpClient);
+ private readonly root = inject(ApiConfiguration).rootUrl;
+ private readonly ref = inject(MatDialogRef);
+ protected readonly data = inject(MAT_DIALOG_DATA, { optional: true }) ?? {};
+
+ protected readonly catalog = resource({ loader: () => this.api.invoke(sourceTypes) });
+ protected readonly groups = computed(() => {
+ const c = this.catalog.value();
+ if (!c) return [];
+ return Object.entries(c.groups).map(([id, g]) => ({
+ id,
+ ...g,
+ types: Object.entries(c.types)
+ .filter(([, t]) => t.group === id)
+ .map(([tid, t]) => ({ id: tid, ...t })),
+ }));
+ });
+
+ protected readonly typeId = signal(this.data.guided?.type);
+ protected readonly type = computed(() => {
+ const id = this.typeId();
+ return id ? this.catalog.value()?.types[id] : undefined;
+ });
+ protected readonly answers = signal>({
+ ...(this.data.guided?.answers ?? {}),
+ });
+ protected readonly label = signal(this.data.label ?? '');
+ protected readonly fields = computed(() => entries(this.type()).filter(([, f]) => !f.advanced));
+ protected readonly more = computed(() => entries(this.type()).filter(([, f]) => f.advanced));
+ protected readonly showPassword = signal>({});
+
+ protected readonly testing = signal(false);
+ /** The tables the last listing found: kept while one is picked and its rows shown. */
+ protected readonly tableList = signal([]);
+ protected readonly tested = signal(undefined);
+ protected readonly columns = computed(() => Object.keys(this.tested()?.rows?.[0] ?? {}));
+
+ protected readonly browsing = signal<{ field: string; at: Browsed } | undefined>(undefined);
+ protected readonly uploading = signal<{ field: string; percent: number } | undefined>(undefined);
+ protected readonly uploaded = signal>({});
+ protected readonly problem = signal('');
+
+ icon(name: string): string {
+ return ICONS[name] ?? 'input';
+ }
+
+ protected pick(id: string): void {
+ const t = this.catalog.value()!.types[id];
+ this.typeId.set(id);
+ this.answers.set(
+ Object.fromEntries(
+ Object.entries(t.fields)
+ .filter(([, f]) => f.default !== null && f.default !== undefined)
+ .map(([k, f]) => [k, f.default]),
+ ),
+ );
+ if (!this.label()) this.label.set(t.title);
+ this.tested.set(undefined);
+ this.problem.set('');
+ }
+
+ protected back(): void {
+ this.typeId.set(undefined);
+ this.tested.set(undefined);
+ this.problem.set('');
+ }
+
+ protected value(name: string): unknown {
+ return this.answers()[name];
+ }
+ protected text(name: string): string {
+ const v = this.answers()[name];
+ return v === null || v === undefined ? '' : String(v);
+ }
+ protected set(name: string, value: unknown): void {
+ this.answers.update((a) => ({ ...a, [name]: value }));
+ if (this.type()?.fields[name]?.type === 'table') return;
+ this.tested.set(undefined); // another connection: test again
+ this.tableList.set([]);
+ }
+ protected setNumber(name: string, value: string): void {
+ this.set(name, value === '' ? null : Number(value));
+ }
+ protected togglePassword(name: string): void {
+ this.showPassword.update((s) => ({ ...s, [name]: !s[name] }));
+ }
+ protected isMasked(name: string): boolean {
+ return this.answers()[name] === MASK;
+ }
+ protected formats() {
+ return this.catalog.value()?.formats ?? [];
+ }
+ protected account(name: string): string | undefined {
+ const a = this.answers()[name] as { user?: string } | undefined;
+ return a ? (a.user ?? 'cuenta conectada') : undefined;
+ }
+
+ /** "Probar conexión": what the source holds, in plain words. */
+ protected async test(): Promise {
+ const type = this.typeId();
+ if (!type) return;
+ this.testing.set(true);
+ this.problem.set('');
+ try {
+ const found = await this.api.invoke(testSource, {
+ limit: 20,
+ body: {
+ type,
+ answers: this.cleaned(),
+ pipeline: this.data.pipeline,
+ node: this.data.node,
+ },
+ });
+ this.tested.set(found);
+ if (found.tables?.length) this.tableList.set(found.tables);
+ } catch (e) {
+ this.problem.set(message(e));
+ } finally {
+ this.testing.set(false);
+ }
+ }
+
+ /** The tables a database listed, for its table field. */
+ protected tables(): string[] {
+ return this.tableList();
+ }
+
+ /** Server folders, under the roots the operator mounted. */
+ protected async openFolder(field: string, path?: string | null): Promise {
+ try {
+ const at = await this.api.invoke(browse, path ? { path } : {});
+ this.browsing.set({ field, at });
+ } catch (e) {
+ this.problem.set(message(e));
+ }
+ }
+ protected chooseFolder(): void {
+ const b = this.browsing();
+ if (b?.at.path) this.set(b.field, b.at.path);
+ this.browsing.set(undefined);
+ }
+ protected chooseFile(path: string): void {
+ const b = this.browsing();
+ if (b) this.set(b.field, path);
+ this.browsing.set(undefined);
+ }
+ /** Whether the field being browsed takes a file (else a folder). */
+ protected readonly browsingFiles = computed(() => {
+ const b = this.browsing();
+ return !!b && this.type()?.fields[b.field]?.type === 'server_file';
+ });
+
+ /** Files or a whole folder from this computer, sent with progress; a folder keeps its
+ * subfolders. More files can be added to the same set. */
+ protected upload(field: string, list: FileList | null): void {
+ if (!list?.length) return;
+ const body = new FormData();
+ for (const file of Array.from(list)) {
+ body.append('files', file, file.webkitRelativePath || file.name);
+ }
+ const folder = this.answers()[field];
+ if (typeof folder === 'string' && folder) body.append('folder', folder);
+ this.uploading.set({ field, percent: 0 });
+ this.problem.set('');
+ this.http
+ .post(`${this.root}/ingest/uploads`, body, {
+ reportProgress: true,
+ observe: 'events',
+ })
+ .subscribe({
+ next: (event) => {
+ if (event.type === HttpEventType.UploadProgress && event.total) {
+ this.uploading.set({ field, percent: Math.round((100 * event.loaded) / event.total) });
+ } else if (event.type === HttpEventType.Response && event.body) {
+ this.set(field, event.body.bucket_url);
+ this.uploaded.update((u) => ({
+ ...u,
+ [field]: [...(u[field] ?? []), ...event.body!.files],
+ }));
+ }
+ },
+ error: (e) => {
+ this.uploading.set(undefined);
+ this.problem.set(message(e));
+ },
+ complete: () => this.uploading.set(undefined),
+ });
+ }
+ protected dropped(field: string, event: DragEvent): void {
+ event.preventDefault();
+ this.upload(field, event.dataTransfer?.files ?? null);
+ }
+
+ /** "Iniciar sesión con …": the provider's page in a window; it hands the account back. */
+ protected async signIn(field: string, provider: string): Promise {
+ this.problem.set('');
+ let started;
+ try {
+ started = await this.api.invoke(oauthStart, { provider, origin: location.origin });
+ } catch (e) {
+ this.problem.set(message(e));
+ return;
+ }
+ const popup = window.open(started.url, 'isssteleon-oauth', 'width=520,height=680');
+ const listen = (event: MessageEvent) => {
+ const m = event.data as { type?: string; state?: string; account?: unknown; error?: string };
+ if (event.origin !== location.origin || m?.type !== 'isssteleon-oauth') return;
+ if (m.state !== started.state) return;
+ window.removeEventListener('message', listen);
+ if (m.error) this.problem.set(m.error);
+ else this.set(field, m.account);
+ popup?.close();
+ };
+ window.addEventListener('message', listen);
+ }
+
+ protected cell(v: unknown): string {
+ return typeof v === 'object' && v !== null ? JSON.stringify(v) : String(v ?? '');
+ }
+
+ /** Answers without empty ones (a default takes their place on the server). */
+ private cleaned(): Record {
+ return Object.fromEntries(
+ Object.entries(this.answers()).filter(([, v]) => v !== '' && v !== null && v !== undefined),
+ );
+ }
+
+ protected readonly missing = computed(() =>
+ entries(this.type())
+ .filter(([k, f]) => f.required && f.type !== 'table' && isEmpty(this.answers()[k]))
+ .filter(([, f]) => f.default === null || f.default === undefined)
+ .map(([, f]) => f.label),
+ );
+ protected readonly ready = computed(
+ () =>
+ !this.missing().length &&
+ entries(this.type())
+ .filter(([, f]) => f.type === 'table' && f.required)
+ .every(([k]) => !isEmpty(this.answers()[k])),
+ );
+
+ protected save(): void {
+ const type = this.typeId();
+ if (!type || !this.ready()) return;
+ this.ref.close({
+ guided: { type, answers: this.cleaned() },
+ label: this.label() || this.type()!.title,
+ });
+ }
+}
+
+function entries(t: SourceType | undefined): [string, FieldSpec][] {
+ return Object.entries(t?.fields ?? {});
+}
+function isEmpty(v: unknown): boolean {
+ return v === '' || v === null || v === undefined;
+}
+function message(e: unknown): string {
+ if (e instanceof HttpErrorResponse) {
+ const d = e.error?.detail;
+ if (typeof d === 'string') return d;
+ if (e.status === 0) return 'No hay conexión con la plataforma. Intente de nuevo.';
+ return JSON.stringify(d ?? e.message);
+ }
+ return String(e);
+}
diff --git a/src/app/gobernanza/figures.ts b/src/app/gobernanza/figures.ts
index ae8741c..504f7af 100644
--- a/src/app/gobernanza/figures.ts
+++ b/src/app/gobernanza/figures.ts
@@ -211,8 +211,8 @@ export function interpretabilityFigures(
}
/** One clinical scenario: Kaplan-Meier with its band, the classic and fractional Weibull,
- * and the model's points with their bootstrap band. */
-function scenarioFigure(
+ * and the model's points with their bootstrap band (also a patient's, in her record). */
+export function scenarioFigure(
title: string,
e: any,
horizons: number[],
diff --git a/src/app/gobernanza/gobernanza.html b/src/app/gobernanza/gobernanza.html
index fcd4cd7..79fa5b6 100644
--- a/src/app/gobernanza/gobernanza.html
+++ b/src/app/gobernanza/gobernanza.html
@@ -31,7 +31,7 @@
}
@if (models.isLoading()) {
- Cargando modelos…
+
} @else if (!models.value()?.length) {
Este dominio todavía no tiene modelos entrenados.
}
diff --git a/src/app/gobernanza/gobernanza.ts b/src/app/gobernanza/gobernanza.ts
index 3e0289f..d6e21a3 100644
--- a/src/app/gobernanza/gobernanza.ts
+++ b/src/app/gobernanza/gobernanza.ts
@@ -25,6 +25,7 @@ import type { Version } from '../api/models/version';
import { DOMAINS } from '../app';
import { Plot } from '../plot';
import { interpretabilityFigures } from './figures';
+import { Loading } from '../loading';
const REPORTS: Record = {
technical_validation: 'Validación técnica',
@@ -38,6 +39,7 @@ const REPORTS: Record = {
@Component({
selector: 'app-gobernanza',
imports: [
+ Loading,
DatePipe,
DecimalPipe,
FormsModule,
diff --git a/src/app/indicadores/indicadores.ts b/src/app/indicadores/indicadores.ts
index 10cd4cb..0f51870 100644
--- a/src/app/indicadores/indicadores.ts
+++ b/src/app/indicadores/indicadores.ts
@@ -8,11 +8,13 @@ import { TabIndicadores } from './tab-indicadores';
import { TabRiesgos } from './tab-riesgos';
import { TabSeguimiento } from './tab-seguimiento';
import { TabTrazabilidad } from './tab-trazabilidad';
+import { Loading } from '../loading';
/** A domain's indicator page: four tabs over its FHIR measures and patients. */
@Component({
selector: 'app-indicadores',
imports: [
+ Loading,
MatTabsModule,
TabIndicadores,
TabTrazabilidad,
@@ -27,7 +29,7 @@ import { TabTrazabilidad } from './tab-trazabilidad';
Indicadores de calidad y oportunidad del tamizaje, a partir de los datos cargados.
@if (measures.isLoading()) {
- Cargando indicadores…
+
} @else if (measures.error()) {
No se pudieron leer los indicadores.
} @else if (!measures.value()?.length) {
diff --git a/src/app/indicadores/tab-indicadores.html b/src/app/indicadores/tab-indicadores.html
index f0aea1f..017a9da 100644
--- a/src/app/indicadores/tab-indicadores.html
+++ b/src/app/indicadores/tab-indicadores.html
@@ -31,7 +31,7 @@
@if (reports.isLoading()) {
- Calculando…
+
}
@if (kpis().length) {
diff --git a/src/app/indicadores/tab-indicadores.ts b/src/app/indicadores/tab-indicadores.ts
index 730fc6a..c36d9c0 100644
--- a/src/app/indicadores/tab-indicadores.ts
+++ b/src/app/indicadores/tab-indicadores.ts
@@ -23,12 +23,14 @@ import {
STRATA,
strataBars,
} from './measures';
+import { Loading } from '../loading';
/** The period's indicators: the timeliness KPIs, the screening route, and a card per
* clinical measure with its figures. */
@Component({
selector: 'app-tab-indicadores',
imports: [
+ Loading,
FormsModule,
MatButtonModule,
MatButtonToggleModule,
diff --git a/src/app/indicadores/tab-trazabilidad.ts b/src/app/indicadores/tab-trazabilidad.ts
index b4d8a39..ae703c1 100644
--- a/src/app/indicadores/tab-trazabilidad.ts
+++ b/src/app/indicadores/tab-trazabilidad.ts
@@ -5,11 +5,12 @@ import type { Measure, MeasureReport } from 'fhir/r4';
import { Fhir, resources } from '../fhir';
import { Figure, Plot } from '../plot';
import { history, periods, PeriodType, periodTypes, reading } from './measures';
+import { Loading } from '../loading';
/** Each measure over time: every period of the chosen kind, oldest first. */
@Component({
selector: 'app-tab-trazabilidad',
- imports: [MatButtonToggleModule, MatCardModule, Plot],
+ imports: [Loading, MatButtonToggleModule, MatCardModule, Plot],
template: `
@if (series.isLoading()) {
- Calculando…
+
}
@for (item of figures(); track item.measure.id) {
diff --git a/src/app/loading.ts b/src/app/loading.ts
new file mode 100644
index 0000000..820974f
--- /dev/null
+++ b/src/app/loading.ts
@@ -0,0 +1,46 @@
+import { Component, input } from '@angular/core';
+import { MatProgressBarModule } from '@angular/material/progress-bar';
+
+/** What a page or a figure shows while its data comes, as the old app did: a progress bar
+ * named for what loads, "Cargando …" in words, and for a figure the place it will take. */
+@Component({
+ selector: 'app-loading',
+ imports: [MatProgressBarModule],
+ template: `
+
+
{{ text() || 'Cargando ' + what() + '…' }}
+ @if (figure()) {
+
+ }
+ `,
+ styles: `
+ :host {
+ display: flex;
+ flex-direction: column;
+ }
+ :host(.figure) {
+ min-height: 12rem;
+ }
+ .state {
+ color: var(--color-text-secondary);
+ font-size: 0.875rem;
+ margin: 8px 0;
+ }
+ .skeleton {
+ background: var(--color-border);
+ border-radius: 10px;
+ flex: 1;
+ min-height: 10rem;
+ opacity: 0.35;
+ }
+ `,
+ host: { '[class.figure]': 'figure()' },
+})
+export class Loading {
+ /** What is loading, in words: "los indicadores", "la figura". */
+ readonly what = input.required
();
+ /** The whole line instead ("Calculando los indicadores…"). */
+ readonly text = input('');
+ /** A figure's skeleton under the bar. */
+ readonly figure = input(false);
+}
diff --git a/src/app/paciente/paciente.html b/src/app/paciente/paciente.html
index 904dfd1..ed5fc49 100644
--- a/src/app/paciente/paciente.html
+++ b/src/app/paciente/paciente.html
@@ -146,8 +146,38 @@
}
+
+ @if (models().some((m) => m.scenarios.length)) {
+
+ Análisis de supervivencia
+
+ @if (survival.isLoading()) {
+
+ } @else if (survival.value(); as s) {
+ Escenario clínico de la paciente
+
+ @for (name of s.scenarios; track name) {
+ {{ name }}
+ }
+
+ @for (f of s.figures; track f.title) {
+ {{ f.title }}
+
+ } @empty {
+
+ Sus escenarios tienen menos fallecimientos de los necesarios para trazar curvas.
+
+ }
+ } @else if (survival.error()) {
+ No se pudo leer el informe del modelo.
+ }
+
+
+ }
} @else if (loading()) {
- Cargando…
+
}
diff --git a/src/app/paciente/paciente.scss b/src/app/paciente/paciente.scss
index ab298fc..79c9f08 100644
--- a/src/app/paciente/paciente.scss
+++ b/src/app/paciente/paciente.scss
@@ -33,3 +33,20 @@
mat-card-content {
overflow-x: auto;
}
+
+.scenarios {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px 8px;
+ list-style: none;
+ margin: 0 0 12px;
+ padding: 0;
+
+ li {
+ background: var(--color-action-hover, #f1f6f6);
+ border: 1px solid var(--color-border);
+ border-radius: 999px;
+ font-size: 13px;
+ padding: 2px 10px;
+ }
+}
diff --git a/src/app/paciente/paciente.ts b/src/app/paciente/paciente.ts
index 65688e6..cf89d55 100644
--- a/src/app/paciente/paciente.ts
+++ b/src/app/paciente/paciente.ts
@@ -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();
readonly id = input.required();
@@ -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(undefined);
protected readonly curve = computed(() => {
const models = this.models().filter((m) => m.predictions.length > 1);