@andes/fhir 1.13.0-beta.5 → 1.13.0-beta.7

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.
@@ -0,0 +1,13 @@
1
+ export declare const FhirIdentifierSystems: {
2
+ readonly ANDES_ID: "http://andes.gob.ar";
3
+ readonly MATRICULACIONES: "http://andes.gob.ar/matriculaciones";
4
+ readonly DNI: "http://www.renaper.gob.ar/dni";
5
+ readonly CUIL: "http://www.renaper.gob.ar/cuil";
6
+ readonly PASSPORT: "http://andes.gob.ar/sid/passport";
7
+ readonly FOREIGN_ID: "http://andes.gob.ar/sid/foreign-id";
8
+ readonly PRESCRIPTIONS: "http://app.andes.gob.ar/prescriptions";
9
+ readonly SISA: "https://andes.gob.ar/sisa";
10
+ readonly CUIE: "https://andes.gob.ar/cuie";
11
+ readonly REMEDIAR: "https://andes.gob.ar/remediar";
12
+ readonly SIPS: "https://andes.gob.ar/sips";
13
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FhirIdentifierSystems = void 0;
4
+ exports.FhirIdentifierSystems = {
5
+ ANDES_ID: 'http://andes.gob.ar',
6
+ MATRICULACIONES: 'http://andes.gob.ar/matriculaciones',
7
+ DNI: 'http://www.renaper.gob.ar/dni',
8
+ CUIL: 'http://www.renaper.gob.ar/cuil',
9
+ PASSPORT: 'http://andes.gob.ar/sid/passport',
10
+ FOREIGN_ID: 'http://andes.gob.ar/sid/foreign-id',
11
+ PRESCRIPTIONS: 'http://app.andes.gob.ar/prescriptions',
12
+ SISA: 'https://andes.gob.ar/sisa',
13
+ CUIE: 'https://andes.gob.ar/cuie',
14
+ REMEDIAR: 'https://andes.gob.ar/remediar',
15
+ SIPS: 'https://andes.gob.ar/sips',
16
+ };
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.__reset = exports.makeUrl = exports.getDominio = exports.initialize = void 0;
4
- let DOMINIO = 'andes.gob.ar';
4
+ const identifier_systems_1 = require("../constants/identifier-systems");
5
+ let DOMINIO = identifier_systems_1.FhirIdentifierSystems.ANDES_ID;
5
6
  function initialize(config) {
6
7
  DOMINIO = config.dominio;
7
8
  }
@@ -22,6 +23,6 @@ exports.makeUrl = makeUrl;
22
23
  * Reseteo explícito para tests
23
24
  */
24
25
  function __reset() {
25
- DOMINIO = 'andes.gob.ar';
26
+ DOMINIO = identifier_systems_1.FhirIdentifierSystems.ANDES_ID;
26
27
  }
27
28
  exports.__reset = __reset;
@@ -5,15 +5,15 @@ beforeEach(() => {
5
5
  (0, config_1.__reset)(); // Resetea el dominio antes de cada test
6
6
  });
7
7
  test('Get default domain', () => {
8
- expect((0, config_1.getDominio)()).toBe('andes.gob.ar');
8
+ expect((0, config_1.getDominio)()).toBe('http://andes.gob.ar');
9
9
  });
10
10
  test('Get default URL without id', () => {
11
- expect((0, config_1.makeUrl)('patient')).toBe('andes.gob.ar/patient');
11
+ expect((0, config_1.makeUrl)('patient')).toBe('http://andes.gob.ar/patient');
12
12
  });
13
13
  test('Get default URL with id', () => {
14
- expect((0, config_1.makeUrl)('patient', '123456')).toBe('andes.gob.ar/patient/123456');
14
+ expect((0, config_1.makeUrl)('patient', '123456')).toBe('http://andes.gob.ar/patient/123456');
15
15
  });
16
16
  test('Initialize domain modifies getDominio', () => {
17
- (0, config_1.initialize)({ dominio: 'nuevo-dominio.com' });
18
- expect((0, config_1.getDominio)()).toBe('nuevo-dominio.com');
17
+ (0, config_1.initialize)({ dominio: 'http://nuevo-dominio.com' });
18
+ expect((0, config_1.getDominio)()).toBe('http://nuevo-dominio.com');
19
19
  });
@@ -11,7 +11,7 @@ export declare function encode(patientReference: any, practitionerReference: any
11
11
  contained: any[];
12
12
  identifier: {
13
13
  use: string;
14
- system: string;
14
+ system: "http://app.andes.gob.ar/prescriptions";
15
15
  value: any;
16
16
  }[];
17
17
  status: string;
@@ -9,6 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.encode = void 0;
11
11
  const moment_1 = __importDefault(require("moment"));
12
+ const identifier_systems_1 = require("../constants/identifier-systems");
12
13
  // Muy incompleto hay que mejorarlo mucho todavía
13
14
  function encode(patientReference, practitionerReference, medicationFHIR, data) {
14
15
  return {
@@ -24,7 +25,7 @@ function encode(patientReference, practitionerReference, medicationFHIR, data) {
24
25
  identifier: [
25
26
  {
26
27
  use: 'official',
27
- system: 'http://app.andes.gob.ar/prescriptions', // Es el id de la prestación completa
28
+ system: identifier_systems_1.FhirIdentifierSystems.PRESCRIPTIONS, // Es el id de la prestación completa
28
29
  value: data.registro.id
29
30
  }
30
31
  ],
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.encode = void 0;
4
4
  const config_1 = require("./config");
5
5
  const rankingMapping_1 = require("../utils/rankingMapping");
6
+ const identifier_systems_1 = require("../constants/identifier-systems");
6
7
  /**
7
8
  * Encode an ANDES Organization to FHIR Organization
8
9
  */
@@ -14,25 +15,25 @@ function encode(organization) {
14
15
  const identificadores = [];
15
16
  if (data.codigo?.sisa) {
16
17
  identificadores.push({
17
- system: 'https://andes.gob.ar/sisa',
18
+ system: identifier_systems_1.FhirIdentifierSystems.SISA,
18
19
  value: data.codigo.sisa
19
20
  });
20
21
  }
21
22
  if (data.codigo?.cuie) {
22
23
  identificadores.push({
23
- system: 'https://andes.gob.ar/cuie',
24
+ system: identifier_systems_1.FhirIdentifierSystems.CUIE,
24
25
  value: data.codigo.cuie
25
26
  });
26
27
  }
27
28
  if (data.codigo?.remediar) {
28
29
  identificadores.push({
29
- system: 'https://andes.gob.ar/remediar',
30
+ system: identifier_systems_1.FhirIdentifierSystems.REMEDIAR,
30
31
  value: data.codigo.remediar
31
32
  });
32
33
  }
33
34
  if (data.codigo?.sips) {
34
35
  identificadores.push({
35
- system: 'https://andes.gob.ar/sips',
36
+ system: identifier_systems_1.FhirIdentifierSystems.SIPS,
36
37
  value: data.codigo.sips
37
38
  });
38
39
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.verify = exports.decode = exports.encode = void 0;
4
4
  const config_1 = require("./config");
5
5
  const rankingMapping_1 = require("../utils/rankingMapping");
6
+ const identifier_systems_1 = require("../constants/identifier-systems");
6
7
  /**
7
8
  * Helpers
8
9
  */
@@ -116,26 +117,26 @@ function encode(patient) {
116
117
  });
117
118
  if (patient.documento) {
118
119
  identificadores.push({
119
- system: 'http://www.renaper.gob.ar/dni',
120
+ system: identifier_systems_1.FhirIdentifierSystems.DNI,
120
121
  value: patient.documento
121
122
  });
122
123
  }
123
124
  if (patient.cuil) {
124
125
  identificadores.push({
125
- system: 'http://www.renaper.gob.ar/cuil',
126
+ system: identifier_systems_1.FhirIdentifierSystems.CUIL,
126
127
  value: patient.cuil
127
128
  });
128
129
  }
129
130
  if (patient.numeroIdentificacion) {
130
131
  if (patient.tipoIdentificacion === 'dni extranjero') {
131
132
  identificadores.push({
132
- system: 'andes.gob.ar/sid/foreign-id',
133
+ system: identifier_systems_1.FhirIdentifierSystems.FOREIGN_ID,
133
134
  value: patient.numeroIdentificacion
134
135
  });
135
136
  }
136
137
  if (patient.tipoIdentificacion === 'pasaporte') {
137
138
  identificadores.push({
138
- system: 'andes.gob.ar/sid/passport',
139
+ system: identifier_systems_1.FhirIdentifierSystems.PASSPORT,
139
140
  value: patient.numeroIdentificacion
140
141
  });
141
142
  }
@@ -264,7 +265,7 @@ function decode(patient) {
264
265
  const element = items.find(el => el.system === key);
265
266
  return element?.value;
266
267
  }
267
- const tiposIdentificacion = ['andes.gob.ar/sid/foreign-id', 'andes.gob.ar/sid/passport'];
268
+ const tiposIdentificacion = [identifier_systems_1.FhirIdentifierSystems.FOREIGN_ID, identifier_systems_1.FhirIdentifierSystems.PASSPORT];
268
269
  const tipoAndes = ['dni extranjero', 'pasaporte'];
269
270
  let tipoIdentificacion;
270
271
  let numeroIdentificacion;
@@ -286,7 +287,7 @@ function decode(patient) {
286
287
  : '';
287
288
  const pacienteAndes = {
288
289
  id: getValue(patient.identifier, (0, config_1.makeUrl)('Patient')) ?? patient.id,
289
- documento: getValue(patient.identifier, 'http://www.renaper.gob.ar/dni'),
290
+ documento: getValue(patient.identifier, identifier_systems_1.FhirIdentifierSystems.DNI),
290
291
  tipoIdentificacion,
291
292
  numeroIdentificacion,
292
293
  nombre,
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const patient = __importStar(require("../data/patient.json"));
27
27
  const patient_1 = require("./patient");
28
28
  const patientFactory_1 = require("../helpers/patientFactory");
29
+ const identifier_systems_1 = require("../constants/identifier-systems");
29
30
  const pacienteFhir = (0, patient_1.encode)(patient);
30
31
  describe('encode patient from ANDES to FHIR R4', () => {
31
32
  test('Verify basic data', () => {
@@ -98,17 +99,17 @@ describe('encode patient from ANDES to FHIR R4', () => {
98
99
  const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'dni extranjero', numeroIdentificacion: 'ABC123' });
99
100
  const fhir = (0, patient_1.encode)(paciente);
100
101
  expect(fhir).not.toBeNull();
101
- const id = fhir.identifier?.find(t => t.system === 'andes.gob.ar/sid/foreign-id');
102
+ const id = fhir.identifier?.find(t => t.system === identifier_systems_1.FhirIdentifierSystems.FOREIGN_ID);
102
103
  expect(id?.value).toBe('ABC123');
103
- expect(id?.system).toBe('andes.gob.ar/sid/foreign-id');
104
+ expect(id?.system).toBe('http://andes.gob.ar/sid/foreign-id');
104
105
  });
105
106
  it('Verifica pasaporte', () => {
106
107
  const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'pasaporte', numeroIdentificacion: 'ABC123CD' });
107
108
  const fhir = (0, patient_1.encode)(paciente);
108
109
  expect(fhir).not.toBeNull();
109
- const id = fhir.identifier?.find(t => t.system === 'andes.gob.ar/sid/passport');
110
+ const id = fhir.identifier?.find(t => t.system === identifier_systems_1.FhirIdentifierSystems.PASSPORT);
110
111
  expect(id?.value).toBe('ABC123CD');
111
- expect(id?.system).toBe('andes.gob.ar/sid/passport');
112
+ expect(id?.system).toBe('http://andes.gob.ar/sid/passport');
112
113
  });
113
114
  });
114
115
  describe('decode patient from FHIR R4 to ANDES', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andes/fhir",
3
- "version": "1.13.0-beta.5",
3
+ "version": "1.13.0-beta.7",
4
4
  "engines": {
5
5
  "node": ">=18.0.0"
6
6
  },