@andes/fhir 1.13.0-beta.1 → 1.13.0-beta.11

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.
Files changed (39) hide show
  1. package/dist/constants/identifier-systems.d.ts +13 -0
  2. package/dist/constants/identifier-systems.js +16 -0
  3. package/dist/index.js +17 -7
  4. package/dist/lib/allergyIntolerance.d.ts +12 -0
  5. package/dist/lib/allergyIntolerance.js +18 -3
  6. package/dist/lib/bundle.d.ts +1 -1
  7. package/dist/lib/bundle.js +4 -8
  8. package/dist/lib/composition.d.ts +7 -12
  9. package/dist/lib/composition.js +189 -92
  10. package/dist/lib/condition.d.ts +1 -49
  11. package/dist/lib/condition.js +43 -39
  12. package/dist/lib/config.js +7 -7
  13. package/dist/lib/device.d.ts +5 -1
  14. package/dist/lib/device.js +8 -5
  15. package/dist/lib/document-reference.js +2 -7
  16. package/dist/lib/immunization.d.ts +1 -38
  17. package/dist/lib/immunization.js +54 -42
  18. package/dist/lib/medication.js +1 -2
  19. package/dist/lib/medicationRequest.d.ts +2 -2
  20. package/dist/lib/medicationRequest.js +4 -8
  21. package/dist/lib/medicationStatement.js +2 -3
  22. package/dist/lib/organization.js +30 -13
  23. package/dist/lib/patient.js +31 -17
  24. package/dist/lib/practitioner.d.ts +0 -3
  25. package/dist/lib/practitioner.js +56 -30
  26. package/dist/types/andes/practitioner.types.d.ts +3 -2
  27. package/dist/utils/fhirDate.d.ts +3 -0
  28. package/dist/utils/fhirDate.js +24 -0
  29. package/dist/utils/rankingMapping.js +2 -3
  30. package/package.json +11 -13
  31. package/dist/data/patient.json +0 -192
  32. package/dist/helpers/patientFactory.d.ts +0 -26
  33. package/dist/helpers/patientFactory.js +0 -35
  34. package/dist/lib/config.test.d.ts +0 -1
  35. package/dist/lib/config.test.js +0 -19
  36. package/dist/lib/device.test.d.ts +0 -1
  37. package/dist/lib/device.test.js +0 -9
  38. package/dist/lib/patient.test.d.ts +0 -1
  39. package/dist/lib/patient.test.js +0 -132
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const device_1 = require("./device");
4
- test('Device type 1', () => {
5
- expect((0, device_1.encode)().id).toBe('device-01');
6
- });
7
- test('Device Name', () => {
8
- expect((0, device_1.encode)().deviceName[0].name).toBe('Sistema de Aplicaciones Neuquinas de Salud (ANDES)');
9
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,132 +0,0 @@
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
- });