@andes/fhir 1.12.0 → 1.12.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/README.md +2 -2
- package/{src → dist}/data/patient.json +192 -192
- package/dist/helpers/patientFactory.d.ts +26 -0
- package/dist/{src/helpers → helpers}/patientFactory.js +35 -31
- package/dist/index.d.ts +15 -0
- package/dist/index.js +55 -52
- package/dist/lib/allergyIntolerance.d.ts +29 -0
- package/dist/{src/lib → lib}/allergyIntolerance.js +39 -40
- package/dist/lib/bundle.d.ts +14 -0
- package/dist/{src/lib → lib}/bundle.js +25 -26
- package/dist/lib/composition.d.ts +47 -0
- package/dist/{src/lib → lib}/composition.js +152 -152
- package/dist/lib/condition.d.ts +53 -0
- package/dist/{src/lib → lib}/condition.js +79 -80
- package/dist/lib/config.d.ts +9 -0
- package/dist/{src/lib → lib}/config.js +27 -21
- package/dist/lib/config.test.d.ts +1 -0
- package/dist/lib/config.test.js +19 -0
- package/dist/lib/device.d.ts +22 -0
- package/dist/{src/lib → lib}/device.js +38 -39
- package/dist/lib/device.test.d.ts +1 -0
- package/dist/lib/device.test.js +9 -0
- package/dist/lib/document-reference.d.ts +71 -0
- package/dist/{src/lib → lib}/document-reference.js +106 -107
- package/dist/lib/immunization.d.ts +44 -0
- package/dist/{src/lib → lib}/immunization.js +67 -68
- package/dist/lib/medication.d.ts +25 -0
- package/{src/lib/medication.ts → dist/lib/medication.js} +64 -61
- package/dist/lib/medicationRequest.d.ts +42 -0
- package/{src/lib/medicationRequest.ts → dist/lib/medicationRequest.js} +103 -100
- package/dist/lib/medicationStatement.d.ts +47 -0
- package/dist/{src/lib → lib}/medicationStatement.js +55 -56
- package/dist/lib/organization.d.ts +6 -0
- package/dist/lib/organization.js +93 -0
- package/dist/lib/patient.d.ts +14 -0
- package/dist/lib/patient.js +465 -0
- package/dist/lib/patient.test.d.ts +1 -0
- package/dist/{src/lib → lib}/patient.test.js +132 -113
- package/dist/lib/practitioner.d.ts +6 -0
- package/dist/lib/practitioner.js +186 -0
- package/dist/types/andes/organization.types.d.ts +39 -0
- package/dist/types/andes/organization.types.js +2 -0
- package/dist/types/andes/patient.types.d.ts +57 -0
- package/dist/types/andes/patient.types.js +2 -0
- package/dist/types/andes/practitioner.types.d.ts +72 -0
- package/dist/types/andes/practitioner.types.js +3 -0
- package/package.json +56 -45
- package/.circleci/config.yml +0 -72
- package/.editorconfig +0 -14
- package/.env.example +0 -2
- package/.gitattributes +0 -1
- package/.github/CODEOWNERS +0 -1
- package/.github/labeler.yml +0 -11
- package/.github/pull_request_template.md +0 -28
- package/.github/workflows/build_test.yml +0 -14
- package/.github/workflows/has_conflicts.yml +0 -13
- package/.vscode/settings.json +0 -2
- package/CHANGELOG.md +0 -351
- package/coverage/clover.xml +0 -209
- package/coverage/coverage-final.json +0 -5
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/config.ts.html +0 -136
- package/coverage/lcov-report/device.ts.html +0 -193
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/index.html +0 -116
- package/coverage/lcov-report/helpers/patientFactory.ts.html +0 -124
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/lib/config.ts.html +0 -136
- package/coverage/lcov-report/lib/device.ts.html +0 -193
- package/coverage/lcov-report/lib/index.html +0 -146
- package/coverage/lcov-report/lib/patient.ts.html +0 -1318
- package/coverage/lcov-report/patient.ts.html +0 -1207
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -425
- package/dist/index.js.map +0 -1
- package/dist/src/data/patient.json +0 -192
- package/dist/src/helpers/patientFactory.js.map +0 -1
- package/dist/src/lib/allergyIntolerance.js.map +0 -1
- package/dist/src/lib/bundle.js.map +0 -1
- package/dist/src/lib/composition.js.map +0 -1
- package/dist/src/lib/condition.js.map +0 -1
- package/dist/src/lib/config.js.map +0 -1
- package/dist/src/lib/config.test.js +0 -13
- package/dist/src/lib/config.test.js.map +0 -1
- package/dist/src/lib/device.js.map +0 -1
- package/dist/src/lib/device.test.js +0 -10
- package/dist/src/lib/device.test.js.map +0 -1
- package/dist/src/lib/document-reference.js.map +0 -1
- package/dist/src/lib/immunization.js.map +0 -1
- package/dist/src/lib/medication.js +0 -65
- package/dist/src/lib/medication.js.map +0 -1
- package/dist/src/lib/medicationRequest.js +0 -103
- package/dist/src/lib/medicationRequest.js.map +0 -1
- package/dist/src/lib/medicationStatement.js.map +0 -1
- package/dist/src/lib/organization.js +0 -91
- package/dist/src/lib/organization.js.map +0 -1
- package/dist/src/lib/patient.js +0 -397
- package/dist/src/lib/patient.js.map +0 -1
- package/dist/src/lib/patient.test.js.map +0 -1
- package/dist/src/lib/practitioner.js +0 -161
- package/dist/src/lib/practitioner.js.map +0 -1
- package/index.ts +0 -30
- package/jest.config.js +0 -12
- package/release.config.js +0 -74
- package/src/helpers/patientFactory.ts +0 -13
- package/src/lib/allergyIntolerance.ts +0 -36
- package/src/lib/bundle.ts +0 -19
- package/src/lib/composition.ts +0 -153
- package/src/lib/condition.ts +0 -80
- package/src/lib/config.test.ts +0 -13
- package/src/lib/config.ts +0 -17
- package/src/lib/device.test.ts +0 -9
- package/src/lib/device.ts +0 -36
- package/src/lib/document-reference.ts +0 -102
- package/src/lib/immunization.ts +0 -64
- package/src/lib/medicationStatement.ts +0 -52
- package/src/lib/organization.ts +0 -89
- package/src/lib/patient.test.ts +0 -101
- package/src/lib/patient.ts +0 -411
- package/src/lib/practitioner.ts +0 -157
- package/tsconfig.test.json +0 -18
- package/tslint.json +0 -139
|
@@ -1,113 +1,132 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
expect(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
expect(
|
|
36
|
-
expect(
|
|
37
|
-
expect(pacienteFhir.
|
|
38
|
-
expect(pacienteFhir.name
|
|
39
|
-
expect(pacienteFhir.name[0].
|
|
40
|
-
expect(pacienteFhir.
|
|
41
|
-
expect(pacienteFhir.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
expect(pacienteFhir.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
expect(pacienteFhir.
|
|
50
|
-
expect(pacienteFhir.
|
|
51
|
-
expect(pacienteFhir.
|
|
52
|
-
|
|
53
|
-
expect(pacienteFhir.address
|
|
54
|
-
expect(pacienteFhir.address[0].
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
expect(pacienteFhir.
|
|
58
|
-
expect(pacienteFhir.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
expect(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
it('Verifica dni extranjero', () => {
|
|
98
|
-
const paciente = patientFactory_1.createPatient({ tipoIdentificacion: 'dni extranjero', numeroIdentificacion: 'ABC123' });
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
expect(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
expect(
|
|
109
|
-
|
|
110
|
-
expect(
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const patient = __importStar(require("../data/patient.json"));
|
|
27
|
+
const patient_1 = require("./patient");
|
|
28
|
+
const patientFactory_1 = require("../helpers/patientFactory");
|
|
29
|
+
const pacienteFhir = (0, patient_1.encode)(patient);
|
|
30
|
+
describe('encode patient from ANDES to FHIR R4', () => {
|
|
31
|
+
test('Verify basic data', () => {
|
|
32
|
+
expect(pacienteFhir.resourceType).toBe('Patient');
|
|
33
|
+
const ident = pacienteFhir.identifier;
|
|
34
|
+
const id = ident?.find(t => t.system === 'http://www.renaper.gob.ar/dni');
|
|
35
|
+
expect(id?.value).toBe('42910660');
|
|
36
|
+
expect(id?.system).toBe('http://www.renaper.gob.ar/dni');
|
|
37
|
+
expect(pacienteFhir.active).toBe(true);
|
|
38
|
+
expect(pacienteFhir.name).toBeDefined();
|
|
39
|
+
expect(pacienteFhir.name[0].use).toBe('official');
|
|
40
|
+
expect(pacienteFhir.name[0].family).toContain('PERINGA');
|
|
41
|
+
expect(pacienteFhir.name[0].family).toContain('PONCE');
|
|
42
|
+
expect(pacienteFhir.name[0].given).toContain('AGUSTIN');
|
|
43
|
+
expect(pacienteFhir.name[0].text).toBe('HUGO AGUSTIN PERINGA PONCE');
|
|
44
|
+
expect(pacienteFhir.gender).toBe('male');
|
|
45
|
+
expect(pacienteFhir.birthDate).toBe('1979-11-14');
|
|
46
|
+
});
|
|
47
|
+
test('Verify patient with contact information', () => {
|
|
48
|
+
// Phone;
|
|
49
|
+
expect(pacienteFhir.telecom).toBeDefined();
|
|
50
|
+
expect(pacienteFhir.telecom[0].value).toBe('4462221');
|
|
51
|
+
expect(pacienteFhir.telecom[0].system).toBe('phone');
|
|
52
|
+
// Address;
|
|
53
|
+
expect(pacienteFhir.address).toBeDefined();
|
|
54
|
+
expect(pacienteFhir.address[0].postalCode).toBe('8300');
|
|
55
|
+
expect(pacienteFhir.address[0].line).toContain('Enrique Santos Discepolo 1856');
|
|
56
|
+
expect(pacienteFhir.address[0].city).toBe('NEUQUEN');
|
|
57
|
+
expect(pacienteFhir.address[0].state).toBe('Neuquén');
|
|
58
|
+
expect(pacienteFhir.address[0].country).toBe('Argentina');
|
|
59
|
+
});
|
|
60
|
+
test('Verify patient with relationships', () => {
|
|
61
|
+
// Validar que exista contact y al menos un elemento
|
|
62
|
+
expect(pacienteFhir.contact).toBeDefined();
|
|
63
|
+
expect(pacienteFhir.contact.length).toBeGreaterThan(0);
|
|
64
|
+
const contacto0 = pacienteFhir.contact[0];
|
|
65
|
+
// Validar que tenga relationship y name estructurados
|
|
66
|
+
expect(contacto0.relationship).toBeDefined();
|
|
67
|
+
expect(contacto0.relationship.length).toBeGreaterThan(0);
|
|
68
|
+
expect(contacto0.name).toBeDefined();
|
|
69
|
+
// Ahora sí: acceder sin que TS marque error
|
|
70
|
+
expect(contacto0.relationship[0].text).toBe('hijo/a');
|
|
71
|
+
expect(contacto0.name.family).toContain('PERINGA');
|
|
72
|
+
expect(contacto0.name.given).toContain('JOSEFINA');
|
|
73
|
+
});
|
|
74
|
+
test('Maneja paciente con estado validado', () => {
|
|
75
|
+
const paciente = (0, patientFactory_1.createPatient)({ estado: 'validado' });
|
|
76
|
+
const fhir = (0, patient_1.encode)(paciente);
|
|
77
|
+
expect(fhir).not.toBeNull();
|
|
78
|
+
expect(fhir.extension?.some(t => t.valueCode === 'validado')).toBeTruthy();
|
|
79
|
+
});
|
|
80
|
+
test('Maneja paciente con estado temporal', () => {
|
|
81
|
+
const paciente = (0, patientFactory_1.createPatient)({ estado: 'temporal' });
|
|
82
|
+
const fhir = (0, patient_1.encode)(paciente);
|
|
83
|
+
expect(fhir).not.toBeNull();
|
|
84
|
+
expect(fhir.extension?.some(t => t.valueCode === 'temporal')).toBeTruthy();
|
|
85
|
+
});
|
|
86
|
+
test('Maneja paciente con estado nulo', () => {
|
|
87
|
+
const paciente = (0, patientFactory_1.createPatient)({ estado: null });
|
|
88
|
+
const fhir = (0, patient_1.encode)(paciente);
|
|
89
|
+
expect(fhir).not.toBeNull();
|
|
90
|
+
expect(fhir.extension?.some(t => t.valueCode === 'temporal')).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
it('Verifica organización que crea paciente', () => {
|
|
93
|
+
const fhir = pacienteFhir;
|
|
94
|
+
expect(fhir.managingOrganization).toBeDefined();
|
|
95
|
+
expect(fhir.managingOrganization.display).toContain('LABORATORIO');
|
|
96
|
+
});
|
|
97
|
+
it('Verifica dni extranjero', () => {
|
|
98
|
+
const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'dni extranjero', numeroIdentificacion: 'ABC123' });
|
|
99
|
+
const fhir = (0, patient_1.encode)(paciente);
|
|
100
|
+
expect(fhir).not.toBeNull();
|
|
101
|
+
const id = fhir.identifier?.find(t => t.system === 'andes.gob.ar/sid/foreign-id');
|
|
102
|
+
expect(id?.value).toBe('ABC123');
|
|
103
|
+
expect(id?.system).toBe('andes.gob.ar/sid/foreign-id');
|
|
104
|
+
});
|
|
105
|
+
it('Verifica pasaporte', () => {
|
|
106
|
+
const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'pasaporte', numeroIdentificacion: 'ABC123CD' });
|
|
107
|
+
const fhir = (0, patient_1.encode)(paciente);
|
|
108
|
+
expect(fhir).not.toBeNull();
|
|
109
|
+
const id = fhir.identifier?.find(t => t.system === 'andes.gob.ar/sid/passport');
|
|
110
|
+
expect(id?.value).toBe('ABC123CD');
|
|
111
|
+
expect(id?.system).toBe('andes.gob.ar/sid/passport');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
describe('decode patient from FHIR R4 to ANDES', () => {
|
|
115
|
+
it('Verifica dni extranjero', () => {
|
|
116
|
+
const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'dni extranjero', numeroIdentificacion: 'ABC123' });
|
|
117
|
+
const fhirEncode = (0, patient_1.encode)(paciente);
|
|
118
|
+
expect(fhirEncode).not.toBeNull();
|
|
119
|
+
const fhirDecode = (0, patient_1.decode)(fhirEncode);
|
|
120
|
+
expect(fhirDecode?.tipoIdentificacion).toBe('dni extranjero');
|
|
121
|
+
expect(fhirDecode?.numeroIdentificacion).toBe('ABC123');
|
|
122
|
+
});
|
|
123
|
+
it('Verifica pasaporte', () => {
|
|
124
|
+
const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'pasaporte', numeroIdentificacion: 'ABC123CD' });
|
|
125
|
+
const fhirEncode = (0, patient_1.encode)(paciente);
|
|
126
|
+
expect(fhirEncode).not.toBeNull();
|
|
127
|
+
const fhirDecode = (0, patient_1.decode)(fhirEncode);
|
|
128
|
+
expect(fhirDecode?.tipoIdentificacion).toBe('pasaporte');
|
|
129
|
+
expect(fhirDecode?.numeroIdentificacion).toBe('ABC123CD');
|
|
130
|
+
expect(fhirDecode?.estado).toBe('temporal');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Practitioner } from 'fhir/r4';
|
|
2
|
+
import { AndesPractitioner } from '../types/andes/practitioner.types';
|
|
3
|
+
/**
|
|
4
|
+
* Encode a practitioner from ANDES to FHIR
|
|
5
|
+
*/
|
|
6
|
+
export declare function encode(practitioner: AndesPractitioner | null | undefined): Practitioner | null;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encode = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
/**
|
|
6
|
+
* Encode a practitioner from ANDES to FHIR
|
|
7
|
+
*/
|
|
8
|
+
function encode(practitioner) {
|
|
9
|
+
const data = practitioner;
|
|
10
|
+
if (!data) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
// -----------------------------
|
|
14
|
+
// Identificadores
|
|
15
|
+
// -----------------------------
|
|
16
|
+
const identificadores = [];
|
|
17
|
+
if (data.documento) {
|
|
18
|
+
identificadores.push({
|
|
19
|
+
system: 'http://www.renaper.gob.ar/dni',
|
|
20
|
+
value: data.documento
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (data.cuit) {
|
|
24
|
+
identificadores.push({
|
|
25
|
+
system: 'https://seti.afip.gob.ar/padron-puc-constancia-internet/ConsultaConstanciaAction.do',
|
|
26
|
+
value: data.cuit
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
identificadores.push({
|
|
30
|
+
system: (0, config_1.getDominio)(),
|
|
31
|
+
value: data._id
|
|
32
|
+
});
|
|
33
|
+
// -----------------------------
|
|
34
|
+
// Contactos → telecom
|
|
35
|
+
// -----------------------------
|
|
36
|
+
const contactos = (data.contacto ?? []).map((unContacto) => {
|
|
37
|
+
const cont = {
|
|
38
|
+
value: unContacto.valor,
|
|
39
|
+
rank: unContacto.ranking
|
|
40
|
+
};
|
|
41
|
+
switch (unContacto.tipo) {
|
|
42
|
+
case 'fijo':
|
|
43
|
+
case 'celular':
|
|
44
|
+
cont.system = 'phone';
|
|
45
|
+
break;
|
|
46
|
+
case 'email':
|
|
47
|
+
cont.system = 'email';
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return cont;
|
|
51
|
+
});
|
|
52
|
+
// -----------------------------
|
|
53
|
+
// Direcciones → address
|
|
54
|
+
// -----------------------------
|
|
55
|
+
const direcciones = (data.domicilios ?? []).map((unDomicilio) => {
|
|
56
|
+
return {
|
|
57
|
+
postalCode: unDomicilio.codigoPostal ?? '',
|
|
58
|
+
line: [unDomicilio.valor],
|
|
59
|
+
city: unDomicilio.ubicacion?.localidad?.nombre ?? '',
|
|
60
|
+
state: unDomicilio.ubicacion?.provincia?.nombre ?? '',
|
|
61
|
+
country: unDomicilio.ubicacion?.pais?.nombre ?? ''
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
// -----------------------------
|
|
65
|
+
// Relaciones (hoy no se usan en Practitioner)
|
|
66
|
+
// Si en algún momento van a Communication o a otro resource, ya está tipado.
|
|
67
|
+
// -----------------------------
|
|
68
|
+
const relaciones = data.relaciones ?? [];
|
|
69
|
+
// -----------------------------
|
|
70
|
+
// Matriculación de grado
|
|
71
|
+
// -----------------------------
|
|
72
|
+
const matriculas = (data.formacionGrado ?? []).map((datosGrado) => {
|
|
73
|
+
const cantMatriculaciones = datosGrado.matriculacion?.length ?? 0;
|
|
74
|
+
const ultima = cantMatriculaciones > 0
|
|
75
|
+
? datosGrado.matriculacion[cantMatriculaciones - 1]
|
|
76
|
+
: undefined;
|
|
77
|
+
const unaMatricula = {
|
|
78
|
+
identifier: datosGrado.profesion.nombre
|
|
79
|
+
? [{
|
|
80
|
+
system: 'https://www.saludneuquen.gob.ar/matriculacionGrado',
|
|
81
|
+
value: datosGrado.profesion.nombre
|
|
82
|
+
}]
|
|
83
|
+
: []
|
|
84
|
+
};
|
|
85
|
+
if (ultima) {
|
|
86
|
+
unaMatricula.code = {
|
|
87
|
+
coding: [{
|
|
88
|
+
system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
|
|
89
|
+
code: datosGrado.profesion.codigo,
|
|
90
|
+
display: datosGrado.profesion.tipoDeFormacion
|
|
91
|
+
}],
|
|
92
|
+
text: ultima.matriculaNumero
|
|
93
|
+
};
|
|
94
|
+
unaMatricula.period = {
|
|
95
|
+
start: ultima.inicio ?? null,
|
|
96
|
+
end: ultima.fin ?? null
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return unaMatricula;
|
|
100
|
+
});
|
|
101
|
+
// -----------------------------
|
|
102
|
+
// Matriculación de posgrado / especialidad
|
|
103
|
+
// -----------------------------
|
|
104
|
+
const matriculasEspecialidad = (data.formacionPosgrado ?? []).map((datosPosgrado) => {
|
|
105
|
+
const cantMatriculacionesEsp = datosPosgrado.matriculacion?.length ?? 0;
|
|
106
|
+
const ultima = cantMatriculacionesEsp > 0
|
|
107
|
+
? datosPosgrado.matriculacion[cantMatriculacionesEsp - 1]
|
|
108
|
+
: undefined;
|
|
109
|
+
const unaMatricula = {
|
|
110
|
+
identifier: datosPosgrado.especialidad.nombre
|
|
111
|
+
? [{
|
|
112
|
+
system: 'https://www.saludneuquen.gob.ar/matriculacionEspecialidad/',
|
|
113
|
+
value: datosPosgrado.especialidad.nombre
|
|
114
|
+
}]
|
|
115
|
+
: []
|
|
116
|
+
};
|
|
117
|
+
if (ultima) {
|
|
118
|
+
unaMatricula.code = {
|
|
119
|
+
coding: [{
|
|
120
|
+
system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
|
|
121
|
+
code: datosPosgrado.especialidad.codigo,
|
|
122
|
+
display: datosPosgrado.especialidad.tipo
|
|
123
|
+
}],
|
|
124
|
+
text: ultima.matriculaNumero
|
|
125
|
+
};
|
|
126
|
+
unaMatricula.period = {
|
|
127
|
+
start: ultima.inicio ?? null,
|
|
128
|
+
end: ultima.fin ?? null
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return unaMatricula;
|
|
132
|
+
});
|
|
133
|
+
// -----------------------------
|
|
134
|
+
// Género
|
|
135
|
+
// -----------------------------
|
|
136
|
+
let genero;
|
|
137
|
+
if (data.sexo) {
|
|
138
|
+
switch (data.sexo.toLowerCase()) {
|
|
139
|
+
case 'femenino':
|
|
140
|
+
genero = 'female';
|
|
141
|
+
break;
|
|
142
|
+
case 'masculino':
|
|
143
|
+
genero = 'male';
|
|
144
|
+
break;
|
|
145
|
+
case 'otro':
|
|
146
|
+
genero = 'other';
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
genero = undefined;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// -----------------------------
|
|
154
|
+
// Practitioner FHIR
|
|
155
|
+
// -----------------------------
|
|
156
|
+
const profesionalFHIR = {
|
|
157
|
+
resourceType: 'Practitioner',
|
|
158
|
+
identifier: identificadores,
|
|
159
|
+
active: data.habilitado ?? undefined,
|
|
160
|
+
name: [{
|
|
161
|
+
family: data.apellido,
|
|
162
|
+
given: data.nombre?.split(' ') ?? []
|
|
163
|
+
}],
|
|
164
|
+
gender: genero,
|
|
165
|
+
birthDate: data.fechaNacimiento,
|
|
166
|
+
};
|
|
167
|
+
if (contactos.length > 0) {
|
|
168
|
+
profesionalFHIR.telecom = contactos;
|
|
169
|
+
}
|
|
170
|
+
if (direcciones.length > 0) {
|
|
171
|
+
profesionalFHIR.address = direcciones;
|
|
172
|
+
}
|
|
173
|
+
const todasLasMatriculas = [...matriculas, ...matriculasEspecialidad].filter(m => m);
|
|
174
|
+
if (todasLasMatriculas.length > 0) {
|
|
175
|
+
// usamos any porque la definición de qualification en fhir/r4
|
|
176
|
+
// es más estricta que lo que trae Andes (code requerido, etc.)
|
|
177
|
+
profesionalFHIR.qualification = todasLasMatriculas;
|
|
178
|
+
}
|
|
179
|
+
if (data.foto) {
|
|
180
|
+
profesionalFHIR.photo = [{
|
|
181
|
+
data: data.foto
|
|
182
|
+
}];
|
|
183
|
+
}
|
|
184
|
+
return profesionalFHIR;
|
|
185
|
+
}
|
|
186
|
+
exports.encode = encode;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface AndesCodigoOrg {
|
|
2
|
+
sisa?: string;
|
|
3
|
+
cuie?: string;
|
|
4
|
+
remediar?: string;
|
|
5
|
+
sips?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AndesUbicacionOrg {
|
|
8
|
+
localidad?: {
|
|
9
|
+
nombre: string;
|
|
10
|
+
};
|
|
11
|
+
provincia?: {
|
|
12
|
+
nombre: string;
|
|
13
|
+
};
|
|
14
|
+
pais?: {
|
|
15
|
+
nombre: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface AndesDireccionOrg {
|
|
19
|
+
valor: string;
|
|
20
|
+
codigoPostal?: string;
|
|
21
|
+
ubicacion: AndesUbicacionOrg;
|
|
22
|
+
}
|
|
23
|
+
export interface AndesContactoOrg {
|
|
24
|
+
tipo: 'fijo' | 'celular' | 'email' | string;
|
|
25
|
+
valor: string;
|
|
26
|
+
ranking?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface AndesOrganization {
|
|
29
|
+
_id?: string;
|
|
30
|
+
id?: string;
|
|
31
|
+
nombre?: string;
|
|
32
|
+
activo?: boolean;
|
|
33
|
+
tipoEstablecimiento?: {
|
|
34
|
+
nombre: string;
|
|
35
|
+
};
|
|
36
|
+
codigo: AndesCodigoOrg;
|
|
37
|
+
direccion?: AndesDireccionOrg;
|
|
38
|
+
contacto?: AndesContactoOrg[];
|
|
39
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type AndesSexo = 'femenino' | 'masculino' | 'otro' | string;
|
|
2
|
+
export type AndesGenero = 'mujer' | 'mujer trans' | 'varon' | 'varon trans' | 'no binario' | 'travesti' | 'masculinidad trans' | 'femenino' | 'masculino' | 'otro' | string;
|
|
3
|
+
export interface AndesContacto {
|
|
4
|
+
tipo: 'fijo' | 'celular' | 'email' | string;
|
|
5
|
+
valor: string;
|
|
6
|
+
ranking?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface AndesUbicacionNombre {
|
|
9
|
+
nombre: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AndesUbicacion {
|
|
12
|
+
localidad?: AndesUbicacionNombre | string;
|
|
13
|
+
provincia?: AndesUbicacionNombre | string;
|
|
14
|
+
pais?: AndesUbicacionNombre | string;
|
|
15
|
+
}
|
|
16
|
+
export interface AndesDireccion {
|
|
17
|
+
activo?: boolean;
|
|
18
|
+
valor: string;
|
|
19
|
+
codigoPostal?: string;
|
|
20
|
+
ubicacion: AndesUbicacion;
|
|
21
|
+
}
|
|
22
|
+
export interface AndesRelacion {
|
|
23
|
+
relacion: {
|
|
24
|
+
nombre: string;
|
|
25
|
+
};
|
|
26
|
+
nombre: string;
|
|
27
|
+
apellido: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AndesCreatedByOrganizacion {
|
|
30
|
+
id: string;
|
|
31
|
+
nombre: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AndesCreatedBy {
|
|
34
|
+
organizacion: AndesCreatedByOrganizacion;
|
|
35
|
+
}
|
|
36
|
+
export interface AndesPatient {
|
|
37
|
+
_id?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
documento?: string;
|
|
40
|
+
cuil?: string;
|
|
41
|
+
tipoIdentificacion?: string | null;
|
|
42
|
+
numeroIdentificacion?: string | null;
|
|
43
|
+
nombre: string;
|
|
44
|
+
apellido: string;
|
|
45
|
+
fechaNacimiento?: string | Date;
|
|
46
|
+
fechaFallecimiento?: string | Date | null;
|
|
47
|
+
genero?: AndesGenero;
|
|
48
|
+
sexo?: AndesSexo;
|
|
49
|
+
estado?: string | null;
|
|
50
|
+
activo?: boolean;
|
|
51
|
+
estadoCivil?: string | null;
|
|
52
|
+
contacto?: AndesContacto[];
|
|
53
|
+
direccion?: AndesDireccion[];
|
|
54
|
+
relaciones?: AndesRelacion[];
|
|
55
|
+
foto?: string | null;
|
|
56
|
+
createdBy?: AndesCreatedBy;
|
|
57
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type AndesSexo = 'masculino' | 'femenino' | 'otro' | string;
|
|
2
|
+
export interface AndesContacto {
|
|
3
|
+
tipo: 'fijo' | 'celular' | 'email' | string;
|
|
4
|
+
valor: string;
|
|
5
|
+
ranking?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface AndesUbicacionLocalidad {
|
|
8
|
+
nombre: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AndesUbicacionProvincia {
|
|
11
|
+
nombre: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AndesUbicacionPais {
|
|
14
|
+
nombre: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AndesUbicacion {
|
|
17
|
+
localidad?: AndesUbicacionLocalidad;
|
|
18
|
+
provincia?: AndesUbicacionProvincia;
|
|
19
|
+
pais?: AndesUbicacionPais;
|
|
20
|
+
}
|
|
21
|
+
export interface AndesDomicilio {
|
|
22
|
+
valor: string;
|
|
23
|
+
codigoPostal?: string;
|
|
24
|
+
ubicacion?: AndesUbicacion;
|
|
25
|
+
}
|
|
26
|
+
export interface AndesRelacionTipo {
|
|
27
|
+
nombre: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AndesRelacion {
|
|
30
|
+
relacion: AndesRelacionTipo;
|
|
31
|
+
apellido: string;
|
|
32
|
+
nombre: string;
|
|
33
|
+
}
|
|
34
|
+
export interface AndesMatriculaItem {
|
|
35
|
+
matriculaNumero?: string;
|
|
36
|
+
inicio?: string;
|
|
37
|
+
fin?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AndesProfesion {
|
|
40
|
+
nombre?: string;
|
|
41
|
+
codigo?: string;
|
|
42
|
+
tipoDeFormacion?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface AndesEspecialidad {
|
|
45
|
+
nombre?: string;
|
|
46
|
+
codigo?: string;
|
|
47
|
+
tipo?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface AndesFormacionGrado {
|
|
50
|
+
profesion: AndesProfesion;
|
|
51
|
+
matriculacion?: AndesMatriculaItem[];
|
|
52
|
+
}
|
|
53
|
+
export interface AndesFormacionPosgrado {
|
|
54
|
+
especialidad: AndesEspecialidad;
|
|
55
|
+
matriculacion?: AndesMatriculaItem[];
|
|
56
|
+
}
|
|
57
|
+
export interface AndesPractitioner {
|
|
58
|
+
_id: string;
|
|
59
|
+
documento?: string;
|
|
60
|
+
cuit?: string;
|
|
61
|
+
nombre: string;
|
|
62
|
+
apellido: string;
|
|
63
|
+
sexo?: AndesSexo;
|
|
64
|
+
fechaNacimiento?: string;
|
|
65
|
+
contacto?: AndesContacto[];
|
|
66
|
+
domicilios?: AndesDomicilio[];
|
|
67
|
+
relaciones?: AndesRelacion[];
|
|
68
|
+
formacionGrado?: AndesFormacionGrado[];
|
|
69
|
+
formacionPosgrado?: AndesFormacionPosgrado[];
|
|
70
|
+
habilitado?: boolean;
|
|
71
|
+
foto?: string;
|
|
72
|
+
}
|