Compare commits

..

No commits in common. "c5b0d1c4805bc425b3558d6c5a090f99931c86ba" and "7e1b0585e7d92fba581994216983b732d58b5bd0" have entirely different histories.

5 changed files with 22 additions and 31 deletions

View File

@ -20,7 +20,7 @@ El componente actúa exclusivamente como gateway: no contiene lógica de negocio
| ITI-65 | `POST` | `/fhir/MeOWDocument` | Provide Document Bundle (MeOW - Medication Overview): variante document. |
| ITI-65 | `POST` | `/fhir/ITTransaction` | Provide Document Bundle (IT - Consultation Note / respuesta de interconsulta): variante transacción. |
| ITI-65 | `POST` | `/fhir/ITDocument` | Provide Document Bundle (IT - Consultation Note): variante document. |
| ITI-67 | `GET` | `/fhir/DocumentReference` | Find Document References: busca el paciente por ID local en el MPI para obtener su ID nacional y consulta los DocumentReferences en el Document Registry. Admite filtrar por tipo de documento con el parámetro opcional `type`, un token FHIR `system\|code` (ej. `http://loinc.org\|60591-5` para IPS, `http://loinc.org\|56445-0` para MeOW, `http://loinc.org\|57133-1` para IT). |
| ITI-67 | `GET` | `/fhir/DocumentReference` | Find Document References: busca el paciente por ID local en el MPI para obtener su ID nacional y consulta los DocumentReferences en el Document Registry. Admite filtrar por tipo de documento con el parámetro opcional `type` (`IPS`, `MeOW`, `IT`, o un token FHIR `system\|code`). |
| ITI-78 | `GET` | `/fhir/Patient` | Patient Demographics Query: búsqueda de pacientes en el MPI. |
| ITI-78 | `GET` | `/fhir/Patient/:id` | Patient Demographics Query: obtención de un paciente por ID en el MPI. |
| ITI-104 | `POST` | `/fhir/Patient` | Patient Identity Feed: alta de paciente en el MPI. |

View File

@ -3,6 +3,7 @@ const config = require('../config');
const { getBusToken } = require('../utils/busAuth');
const { findPatient } = require('../services/patient');
const { findDocumentReferenceByPatient } = require('../services/documentReference');
const { DOCUMENT_TYPES } = require('../constants/documentTypes');
const NATIONAL_ID_SYSTEM = 'https://federador.msal.gob.ar/patient-id';
@ -14,6 +15,20 @@ function extractNationalIdentifier(patient) {
return identifiers.find(id => id.system === NATIONAL_ID_SYSTEM) || null;
}
/**
* Resuelve el parámetro de búsqueda `type` a un token FHIR (`system|code`).
* Acepta tanto las etiquetas conocidas (IPS, MeOW, IT case-insensitive)
* como un token FHIR ya armado (`system|code` o `code`), que se pasa tal cual
* para no acoplar la búsqueda a los tipos de documento ya conocidos.
*/
function resolveDocumentType(rawType) {
if (!rawType) return undefined;
const knownType = Object.values(DOCUMENT_TYPES).find(
t => t.label.toLowerCase() === rawType.toLowerCase()
);
return knownType ? `${knownType.system}|${knownType.code}` : rawType;
}
/**
@ -34,11 +49,9 @@ function extractNationalIdentifier(patient) {
* patient.identifier same semantics, alternate FHIR parameter name.
*
* Optional query parameter:
* type token FHIR de DocumentReference.type (`system|code`, `|code` o `code`),
* ej: `http://loinc.org|60591-5` (IPS), `http://loinc.org|56445-0` (MeOW),
* `http://loinc.org|57133-1` (IT). Se pasa tal cual al Bus, sin traducir
* alias propios, para no apartarse de la semántica estándar de búsqueda
* por token de FHIR. Si se omite, devuelve documentos de cualquier tipo.
* type tipo de documento a buscar. Acepta las etiquetas conocidas
* (IPS, MeOW, IT) o un token FHIR (`system|code`, ej: `http://loinc.org|60591-5`).
* Si se omite, devuelve documentos de cualquier tipo.
*/
async function listDocumentReference(req, res, next) {
try {
@ -46,7 +59,7 @@ async function listDocumentReference(req, res, next) {
if (!localPatientIdentifier) {
throw createError(400, 'Missing required query parameter: subject or patient.identifier');
}
const documentType = req.query.type;
const documentType = resolveDocumentType(req.query.type);
const token = await getBusToken(
config.bus.url,
config.bus.jwtSecret,

View File

@ -8,9 +8,9 @@ sequenceDiagram
participant IndiceNacion as Indice Documentos
end
participant NodoDominio2 as Nodo B
Note over HIS_A,FederadorNacion: Tipos soportados (LOINC): 60591-5 IPS, 56445-0 MeOW, 57133-1 IT (parámetro opcional type=system|code)
Note over HIS_A,FederadorNacion: Tipos soportados: IPS, MeOW, IT (parámetro opcional type)
Note over HIS_A,FederadorNacion: 1. Busqueda y resolución de Identidad
HIS_A->>NodoDominio: ITI67: Solicita los documentos asociados al paciente por su identificador local, opcionalmente filtrando por tipo <br /> [GET /DocumentReference?patient.identifier=<ID_Local>&type=<system|code>]
HIS_A->>NodoDominio: ITI67: Solicita los documentos asociados al paciente por su identificador local, opcionalmente filtrando por tipo <br /> [GET /DocumentReference?patient.identifier=<ID_Local>&type=<IPS|MeOW|IT>]
NodoDominio->>FederadorNacion: Busca el paciente por su identificador local <br /> [GET /Patient?identifier=<ID_Local>]
FederadorNacion-->>NodoDominio: 200 OK (Patient Searchset)
Note over NodoDominio,IndiceNacion: 2. Busqueda de Metadatos

View File

@ -96,17 +96,6 @@ http {
proxy_read_timeout 90s;
}
# Transformaciones de bundle (nodo nacional, via bus-gateway/bundleSigner):
# /fhir/Bundle/:id/$ddcc, $dvc, $icvp2, $meow
location ~ ^/fhir/Bundle/[^/]+/\$(ddcc|dvc|icvp2|meow)$ {
proxy_pass http://bus_gateway;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90s;
}
# Resto de /fhir/* va a hapi-fhir
location /fhir/ {
proxy_pass http://hapi_fhir;

View File

@ -112,17 +112,6 @@ http {
proxy_read_timeout 90s;
}
# Transformaciones de bundle (nodo nacional, via bus-gateway/bundleSigner):
# /fhir/Bundle/:id/$ddcc, $dvc, $icvp2, $meow
location ~ ^/fhir/Bundle/[^/]+/\$(ddcc|dvc|icvp2|meow)$ {
proxy_pass http://bus_gateway;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90s;
}
# Resto de /fhir/* va a hapi-fhir
location /fhir/ {
proxy_pass http://hapi_fhir;