@andes/fhir 1.13.0-beta.4 → 1.13.0-beta.6

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,6 @@
1
+ export declare const FhirIdentifierSystems: {
2
+ readonly DNI: "http://www.renaper.gob.ar/dni";
3
+ readonly CUIL: "http://www.renaper.gob.ar/cuil";
4
+ readonly PASSPORT: "http://andes.gob.ar/sid/passport";
5
+ readonly FOREIGN_ID: "http://andes.gob.ar/sid/foreign-id";
6
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FhirIdentifierSystems = void 0;
4
+ exports.FhirIdentifierSystems = {
5
+ DNI: 'http://www.renaper.gob.ar/dni',
6
+ CUIL: 'http://www.renaper.gob.ar/cuil',
7
+ PASSPORT: 'http://andes.gob.ar/sid/passport',
8
+ FOREIGN_ID: 'http://andes.gob.ar/sid/foreign-id',
9
+ };
@@ -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', () => {
@@ -124,8 +124,8 @@ function encode(practitioner) {
124
124
  unaMatricula.code = {
125
125
  coding: [{
126
126
  system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
127
- code: String(datosPosgrado.especialidad.codigo ?? ''),
128
- display: String(datosPosgrado.especialidad.tipo ?? '')
127
+ code: String(datosPosgrado.especialidad.codigo.sisa ?? ''),
128
+ display: String(datosPosgrado.especialidad.nombre ?? '')
129
129
  }],
130
130
  text: String(ultima.matriculaNumero ?? '')
131
131
  };
@@ -43,8 +43,9 @@ export interface AndesProfesion {
43
43
  }
44
44
  export interface AndesEspecialidad {
45
45
  nombre?: string;
46
- codigo?: string;
47
- tipo?: string;
46
+ codigo: {
47
+ sisa: string;
48
+ };
48
49
  }
49
50
  export interface AndesFormacionGrado {
50
51
  profesion: AndesProfesion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andes/fhir",
3
- "version": "1.13.0-beta.4",
3
+ "version": "1.13.0-beta.6",
4
4
  "engines": {
5
5
  "node": ">=18.0.0"
6
6
  },