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

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.
@@ -1,8 +1,8 @@
1
1
  export declare const FhirIdentifierSystems: {
2
2
  readonly ANDES_ID: "http://andes.gob.ar";
3
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";
4
+ readonly DNI: "https://www.renaper.gob.ar/dni";
5
+ readonly CUIL: "https://www.anses.org.ar/cuil";
6
6
  readonly PASSPORT: "http://andes.gob.ar/sid/passport";
7
7
  readonly FOREIGN_ID: "http://andes.gob.ar/sid/foreign-id";
8
8
  readonly PRESCRIPTIONS: "http://app.andes.gob.ar/prescriptions";
@@ -4,8 +4,8 @@ exports.FhirIdentifierSystems = void 0;
4
4
  exports.FhirIdentifierSystems = {
5
5
  ANDES_ID: 'http://andes.gob.ar',
6
6
  MATRICULACIONES: 'http://andes.gob.ar/matriculaciones',
7
- DNI: 'http://www.renaper.gob.ar/dni',
8
- CUIL: 'http://www.renaper.gob.ar/cuil',
7
+ DNI: 'https://www.renaper.gob.ar/dni',
8
+ CUIL: 'https://www.anses.org.ar/cuil',
9
9
  PASSPORT: 'http://andes.gob.ar/sid/passport',
10
10
  FOREIGN_ID: 'http://andes.gob.ar/sid/foreign-id',
11
11
  PRESCRIPTIONS: 'http://app.andes.gob.ar/prescriptions',
package/dist/index.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.AllergyIntolerance = exports.MedicationRequest = exports.MedicationStatement = exports.Medication = exports.Device = exports.DocumentReference = exports.Bundle = exports.Composition = exports.Condition = exports.Immunization = exports.Organization = exports.Practitioner = exports.Patient = exports.initialize = exports.getDominio = void 0;
27
37
  const AllergyIntolerance = __importStar(require("./lib/allergyIntolerance"));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  /**
5
5
  * Encode de Alergias e Intolerancias from ANDES to FHIR
6
6
  * @param {} AllergyIntolerance
@@ -36,4 +36,3 @@ function encode(patientReference, alergiaIntolerancia) {
36
36
  onsetDateTime: alergiaIntolerancia.valor.fechaInicio
37
37
  };
38
38
  }
39
- exports.encode = encode;
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.encode = void 0;
7
- const moment_1 = __importDefault(require("moment"));
3
+ exports.encode = encode;
8
4
  const config_1 = require("./config");
9
5
  function encode(ID, resources) {
10
6
  return {
11
7
  resourceType: 'Bundle',
12
8
  id: ID,
13
9
  meta: {
14
- lastUpdated: (0, moment_1.default)().format()
10
+ lastUpdated: new Date().toISOString()
15
11
  },
16
12
  language: 'es-AR',
17
13
  entry: resources,
@@ -22,4 +18,3 @@ function encode(ID, resources) {
22
18
  }
23
19
  };
24
20
  }
25
- exports.encode = encode;
@@ -1,4 +1,3 @@
1
- import moment from 'moment';
2
1
  export declare function encode(ID: any, patientReference: any, custodianReference: any, deviceReference: any, medicationStatementReference: any, ImmunizationReferences: any, AllergyIntoleranceReferences: any, ConditionReferences: any): {
3
2
  id: any;
4
3
  subject: {
@@ -25,7 +24,7 @@ export declare function encode(ID: any, patientReference: any, custodianReferenc
25
24
  system: string;
26
25
  value: any;
27
26
  };
28
- date: moment.Moment;
27
+ date: string;
29
28
  text: {
30
29
  status: string;
31
30
  div: string;
@@ -38,7 +37,7 @@ export declare function encode(ID: any, patientReference: any, custodianReferenc
38
37
  };
39
38
  attester: {
40
39
  mode: string;
41
- time: moment.Moment;
40
+ time: string;
42
41
  party: {
43
42
  reference: any;
44
43
  };
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
3
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.encode = void 0;
8
- const moment_1 = __importDefault(require("moment"));
4
+ exports.encode = encode;
9
5
  const config_1 = require("./config");
10
6
  function getReference(url) {
11
7
  return {
@@ -13,7 +9,8 @@ function getReference(url) {
13
9
  };
14
10
  }
15
11
  function encode(ID, patientReference, custodianReference, deviceReference, medicationStatementReference, ImmunizationReferences, AllergyIntoleranceReferences, ConditionReferences) {
16
- const now = (0, moment_1.default)();
12
+ const now = new Date();
13
+ const nowIso = now.toISOString();
17
14
  let Immunization = [];
18
15
  let conditions = [];
19
16
  let medications = [];
@@ -116,12 +113,12 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
116
113
  }
117
114
  ]
118
115
  },
119
- title: 'Resumen del paciente al ' + now.format('DD/MM/YYYY, HH:mm'),
116
+ title: 'Resumen del paciente al ' + now.toLocaleDateString('es-AR') + ', ' + now.toLocaleTimeString('es-AR', { hour: '2-digit', minute: '2-digit' }),
120
117
  identifier: {
121
118
  system: (0, config_1.makeUrl)('Composition'),
122
119
  value: ID
123
120
  },
124
- date: now,
121
+ date: nowIso,
125
122
  // meta: {
126
123
  // profile: [
127
124
  // 'http:\/\/hl7.org\/fhir\/uv\/ips\/StructureDefinition\/composition-uv-ips'
@@ -140,7 +137,7 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
140
137
  attester: [
141
138
  {
142
139
  mode: 'legal',
143
- time: now,
140
+ time: nowIso,
144
141
  party: {
145
142
  reference: custodianReference
146
143
  }
@@ -149,4 +146,3 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
149
146
  status: 'final'
150
147
  };
151
148
  }
152
- exports.encode = encode;
@@ -4,7 +4,7 @@
4
4
  * @param registro Registro RUP a transformar a FHIR
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.encode = void 0;
7
+ exports.encode = encode;
8
8
  function encode(patientReference, registro) {
9
9
  return {
10
10
  id: registro._id,
@@ -76,4 +76,3 @@ function encode(patientReference, registro) {
76
76
  }
77
77
  };
78
78
  }
79
- exports.encode = encode;
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__reset = exports.makeUrl = exports.getDominio = exports.initialize = void 0;
3
+ exports.initialize = initialize;
4
+ exports.getDominio = getDominio;
5
+ exports.makeUrl = makeUrl;
6
+ exports.__reset = __reset;
4
7
  const identifier_systems_1 = require("../constants/identifier-systems");
5
8
  let DOMINIO = identifier_systems_1.FhirIdentifierSystems.ANDES_ID;
6
9
  function initialize(config) {
7
10
  DOMINIO = config.dominio;
8
11
  }
9
- exports.initialize = initialize;
10
12
  function getDominio() {
11
13
  return DOMINIO;
12
14
  }
13
- exports.getDominio = getDominio;
14
15
  function makeUrl(resource, id) {
15
16
  let url = `${DOMINIO}/${resource}`;
16
17
  if (id) {
@@ -18,11 +19,9 @@ function makeUrl(resource, id) {
18
19
  }
19
20
  return url;
20
21
  }
21
- exports.makeUrl = makeUrl;
22
22
  /**
23
23
  * Reseteo explícito para tests
24
24
  */
25
25
  function __reset() {
26
26
  DOMINIO = identifier_systems_1.FhirIdentifierSystems.ANDES_ID;
27
27
  }
28
- exports.__reset = __reset;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  const config_1 = require("./config");
5
5
  function encode() {
6
6
  /**
@@ -35,4 +35,3 @@ function encode() {
35
35
  ]
36
36
  };
37
37
  }
38
- exports.encode = encode;
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.encode = void 0;
7
- const moment_1 = __importDefault(require("moment"));
3
+ exports.encode = encode;
8
4
  const config_1 = require("./config");
9
5
  function encode(ID, author, organization, patient, binaryURL) {
10
6
  return {
11
7
  resourceType: 'DocumentReference',
12
8
  id: ID,
13
9
  meta: {
14
- lastUpdated: (0, moment_1.default)().format()
10
+ lastUpdated: new Date().toISOString()
15
11
  },
16
12
  contained: [
17
13
  {
@@ -103,4 +99,3 @@ function encode(ID, author, organization, patient, binaryURL) {
103
99
  }
104
100
  };
105
101
  }
106
- exports.encode = encode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  /**
5
5
  * Encode de Vacunas Nomivac from ANDES to FHIR
6
6
  * @param {} nomivac
@@ -64,4 +64,3 @@ function encode(patientReference, nomivac) {
64
64
  ]
65
65
  };
66
66
  }
67
- exports.encode = encode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  /**
5
5
  * Encode de Medicamentos from ANDES to FHIR
6
6
  * @param {} medication
@@ -61,4 +61,3 @@ function encode(medication) {
61
61
  }
62
62
  };
63
63
  }
64
- exports.encode = encode;
@@ -25,7 +25,7 @@ export declare function encode(patientReference: any, practitionerReference: any
25
25
  subject: {
26
26
  reference: any;
27
27
  };
28
- authoredOn: string;
28
+ authoredOn: string | undefined;
29
29
  requester: {
30
30
  reference: any;
31
31
  };
@@ -3,12 +3,8 @@
3
3
  * Encode medicationRequest from ANDES to FHIR
4
4
  * @param {} medicationRequest
5
5
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.encode = void 0;
11
- const moment_1 = __importDefault(require("moment"));
7
+ exports.encode = encode;
12
8
  const identifier_systems_1 = require("../constants/identifier-systems");
13
9
  // Muy incompleto hay que mejorarlo mucho todavía
14
10
  function encode(patientReference, practitionerReference, medicationFHIR, data) {
@@ -54,7 +50,7 @@ function encode(patientReference, practitionerReference, medicationFHIR, data) {
54
50
  reference: patientReference // podría ser una reference a un group también
55
51
  },
56
52
  // encounter: Por ahora lo dejo pendiente. Podría ponerse una referencia a otra prestación o al informe del encuentro.
57
- authoredOn: (0, moment_1.default)(data.registro.createdAt).format('YYYY-MM-DD'),
53
+ authoredOn: data.registro?.createdAt ? new Date(data.registro.createdAt).toISOString().slice(0, 10) : undefined,
58
54
  // requester & performer: pueden ser Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)
59
55
  // por el momento vamos a tomar al profesional porque no tenemos otra info en la prestación
60
56
  requester: {
@@ -101,4 +97,3 @@ function encode(patientReference, practitionerReference, medicationFHIR, data) {
101
97
  eventHistory: null // [{ Reference(Provenance) }]
102
98
  };
103
99
  }
104
- exports.encode = encode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  /**
5
5
  * Encode de Medicamentos from ANDES to FHIR
6
6
  * @param {} medicationStatement
@@ -52,4 +52,3 @@ function encode(patientReference, medicationReference, prestacionMedicamento) {
52
52
  }
53
53
  };
54
54
  }
55
- exports.encode = encode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  const config_1 = require("./config");
5
5
  const rankingMapping_1 = require("../utils/rankingMapping");
6
6
  const identifier_systems_1 = require("../constants/identifier-systems");
@@ -92,4 +92,3 @@ function encode(organization) {
92
92
  }
93
93
  return organizacionFHIR;
94
94
  }
95
- exports.encode = encode;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verify = exports.decode = exports.encode = void 0;
3
+ exports.encode = encode;
4
+ exports.decode = decode;
5
+ exports.verify = verify;
4
6
  const config_1 = require("./config");
5
7
  const rankingMapping_1 = require("../utils/rankingMapping");
6
8
  const identifier_systems_1 = require("../constants/identifier-systems");
@@ -249,7 +251,6 @@ function encode(patient) {
249
251
  }
250
252
  return pacienteFHIR;
251
253
  }
252
- exports.encode = encode;
253
254
  /**
254
255
  * Decode a patient from FHIR to ANDES
255
256
  */
@@ -372,7 +373,6 @@ function decode(patient) {
372
373
  }
373
374
  return pacienteAndes;
374
375
  }
375
- exports.decode = decode;
376
376
  /**
377
377
  * Verify if a patient has a FHIR format
378
378
  */
@@ -441,7 +441,6 @@ function verify(patient) {
441
441
  }
442
442
  return respuesta;
443
443
  }
444
- exports.verify = verify;
445
444
  /**
446
445
  * Verify helpers
447
446
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
3
+ exports.encode = encode;
4
4
  const config_1 = require("./config");
5
5
  const fhirDate_1 = require("../utils/fhirDate");
6
6
  const rankingMapping_1 = require("../utils/rankingMapping");
@@ -197,4 +197,3 @@ function encode(practitioner) {
197
197
  }
198
198
  return profesionalFHIR;
199
199
  }
200
- exports.encode = encode;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatFHIRDate = exports.formatFHIRDateTime = exports.isValidFHIRDateTime = void 0;
3
+ exports.isValidFHIRDateTime = isValidFHIRDateTime;
4
+ exports.formatFHIRDateTime = formatFHIRDateTime;
5
+ exports.formatFHIRDate = formatFHIRDate;
4
6
  function isValidFHIRDateTime(date) {
5
7
  if (date === null || date === undefined || date === 0 || date === '0' || date === '') {
6
8
  return false;
@@ -8,18 +10,15 @@ function isValidFHIRDateTime(date) {
8
10
  const d = new Date(date);
9
11
  return !isNaN(d.getTime());
10
12
  }
11
- exports.isValidFHIRDateTime = isValidFHIRDateTime;
12
13
  function formatFHIRDateTime(date) {
13
14
  if (isValidFHIRDateTime(date)) {
14
15
  return new Date(date).toISOString();
15
16
  }
16
17
  return undefined;
17
18
  }
18
- exports.formatFHIRDateTime = formatFHIRDateTime;
19
19
  function formatFHIRDate(date) {
20
20
  if (isValidFHIRDateTime(date)) {
21
21
  return new Date(date).toISOString().split('T')[0];
22
22
  }
23
23
  return undefined;
24
24
  }
25
- exports.formatFHIRDate = formatFHIRDate;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapFhirRankToAndesRanking = exports.mapAndesRankingToFhirRank = void 0;
3
+ exports.mapAndesRankingToFhirRank = mapAndesRankingToFhirRank;
4
+ exports.mapFhirRankToAndesRanking = mapFhirRankToAndesRanking;
4
5
  /**
5
6
  * Mapea ANDES ranking base 1 a FHIR rank base 1
6
7
  */
@@ -9,7 +10,6 @@ function mapAndesRankingToFhirRank(andesRanking) {
9
10
  ? andesRanking + 1
10
11
  : 1;
11
12
  }
12
- exports.mapAndesRankingToFhirRank = mapAndesRankingToFhirRank;
13
13
  /**
14
14
  * Mapea FHIR rank base 1 a ANDES ranking base 0
15
15
  */
@@ -18,4 +18,3 @@ function mapFhirRankToAndesRanking(fhirRank) {
18
18
  ? fhirRank - 1
19
19
  : 0;
20
20
  }
21
- exports.mapFhirRankToAndesRanking = mapFhirRankToAndesRanking;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@andes/fhir",
3
- "version": "1.13.0-beta.7",
3
+ "version": "1.13.0-beta.8",
4
4
  "engines": {
5
- "node": ">=18.0.0"
5
+ "node": ">=24.0.0"
6
6
  },
7
7
  "engineStrict": true,
8
8
  "main": "dist/index.js",
@@ -21,22 +21,20 @@
21
21
  "release:prod:dry": "dotenv -e .env -- semantic-release --no-ci --branches master --dry-run"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/jest": "29.5.14",
25
- "@types/node": "^18.19.0",
26
- "@typescript-eslint/eslint-plugin": "^6.21.0",
27
- "@typescript-eslint/parser": "^6.21.0",
24
+ "@types/jest": "^29.5.14",
25
+ "@types/node": "^24.0.0",
26
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
27
+ "@typescript-eslint/parser": "^8.26.0",
28
28
  "dotenv-cli": "^11.0.0",
29
- "eslint": "^8.57.0",
30
- "jest": "29.7.0",
29
+ "eslint": "^9.21.0",
30
+ "jest": "^29.7.0",
31
31
  "rimraf": "^5.0.7",
32
32
  "semantic-release": "^20.1.0",
33
- "ts-jest": "29.2.5",
34
- "ts-node": "^10.9.2",
35
- "typescript": "5.3.3"
33
+ "ts-jest": "^29.2.5",
34
+ "typescript": "^5.8.2"
36
35
  },
37
36
  "dependencies": {
38
- "@types/fhir": "^0.0.41",
39
- "moment": "2.29.4"
37
+ "@types/fhir": "^0.0.41"
40
38
  },
41
39
  "files": [
42
40
  "dist/**/*"
@@ -1,192 +0,0 @@
1
- {
2
- "_id": "58d30d6fgbb1a96b254d9877",
3
- "entidadesValidadoras": [
4
- "RENAPER",
5
- "Sisa"
6
- ],
7
- "documento": "42910660",
8
- "apellido": "PERINGA PONCE",
9
- "nombre": "HUGO AGUSTIN",
10
- "sexo": "masculino",
11
- "fechaNacimiento": "1979-11-14T03:00:00.000-03:00",
12
- "estado": "validado",
13
- "genero": "masculino",
14
- "financiador": [
15
- {
16
- "codigoPuco": 921001,
17
- "nombre": "O.S.P. NEUQUEN",
18
- "financiador": "O.S.P. NEUQUEN"
19
- },
20
- {
21
- "codigoPuco": 921001,
22
- "nombre": "O.S.P. NEUQUEN",
23
- "financiador": "O.S.P. NEUQUEN"
24
- }
25
- ],
26
- "relaciones": [
27
- {
28
- "_id": "5b92dec9646d99436065cbfc",
29
- "relacion": {
30
- "_id": "59247c391ebf0273353b23c0",
31
- "nombre": "hijo/a",
32
- "opuesto": "progenitor/a"
33
- },
34
- "referencia": "5b92de583173b053ae88f2d0",
35
- "nombre": "JOSEFINA",
36
- "apellido": "PERINGA PONCE",
37
- "documento": "333333333",
38
- "fotoId": "5f9072d00254f253d9c7dd54"
39
- },
40
- {
41
- "_id": "5b92dec9646d99436065cbfa",
42
- "relacion": {
43
- "_id": "59247c391ebf0273353b23c0",
44
- "nombre": "hijo/a",
45
- "opuesto": "progenitor/a"
46
- },
47
- "referencia": "5b9287f10394a225c25a150b",
48
- "nombre": "IGNACIO",
49
- "apellido": "PERINGA PONCE",
50
- "documento": "222222222",
51
- "fotoId": "5f9072d00254f253d9c7dd2c"
52
- },
53
- {
54
- "_id": "5f00d31e044ef317c36fd4f8",
55
- "relacion": {
56
- "_id": "59247c391ebf0273353b23c0",
57
- "nombre": "hijo/a",
58
- "opuesto": "progenitor/a"
59
- },
60
- "referencia": "5f00d2f7acfe3a7e46a88227",
61
- "nombre": "JUAN CRUZ",
62
- "apellido": "PERINGA PONCE",
63
- "documento": "11111111",
64
- "fotoId": "5f9078ff0254f253d9dc7212"
65
- },
66
- {
67
- "_id": "5f09f00d5cec191aa5908457",
68
- "relacion": {
69
- "_id": "59247e1c1ebf0273353b23c5",
70
- "nombre": "otro",
71
- "opuesto": "otro"
72
- },
73
- "referencia": "59cb176acd21ce293061b67b",
74
- "nombre": "FLORENCIA INES",
75
- "apellido": "YAMIL",
76
- "documento": "15365478",
77
- "fotoId": "5f9072b40254f253d9c79556"
78
- }
79
- ],
80
- "direccion": [
81
- {
82
- "geoReferencia": [
83
- -38.9305707,
84
- -68.0839758
85
- ],
86
- "activo": true,
87
- "_id": "58d90d6f0bb1a96b254d9878",
88
- "valor": "Enrique Santos Discepolo 1856",
89
- "codigoPostal": "8300",
90
- "ubicacion": {
91
- "_id": "58d90d6f0bb1a96b254d9879",
92
- "pais": {
93
- "_id": "57f3b5c469fe79a598e6281f",
94
- "nombre": "Argentina"
95
- },
96
- "provincia": {
97
- "_id": "57f3f3aacebd681cc2014c53",
98
- "nombre": "Neuquén"
99
- },
100
- "localidad": {
101
- "_id": "57f538a472325875a199a82d",
102
- "nombre": "NEUQUEN"
103
- },
104
- "barrio": null
105
- },
106
- "ranking": 0,
107
- "ultimaActualizacion": "2017-03-27T10:02:16.809-03:00"
108
- },
109
- {
110
- "geoReferencia": null,
111
- "activo": true,
112
- "_id": "6046105ba4e2d85f81ad60f7",
113
- "valor": "NORDENSTROM 1898 0 0",
114
- "codigoPostal": "8300",
115
- "ranking": 1,
116
- "ubicacion": {
117
- "_id": "6046105ba4e2d85f81ad60f8",
118
- "pais": {
119
- "_id": "57f3b5c469fe79a598e6281f",
120
- "nombre": "Argentina"
121
- },
122
- "provincia": {
123
- "_id": "57f3f3aacebd681cc2014c53",
124
- "nombre": "Neuquén"
125
- },
126
- "localidad": {
127
- "_id": "57f538a472325875a199a82d",
128
- "nombre": "Neuquén"
129
- },
130
- "barrio": null
131
- },
132
- "ultimaActualizacion": "2021-03-08T08:54:04.089-03:00"
133
- }
134
- ],
135
- "contacto": [
136
- {
137
- "activo": true,
138
- "_id": "5cabf8cc129519c9cd5bf6f2",
139
- "tipo": "celular",
140
- "valor": "4462221"
141
- },
142
- {
143
- "activo": true,
144
- "_id": "5cabf8cc129519c9cd5bf6f1",
145
- "tipo": "email",
146
- "valor": "hugoperingaponce@gmail.com"
147
- }
148
- ],
149
- "identificadores": [
150
- {
151
- "entidad": "RENAPER",
152
- "valor": "241654536"
153
- }
154
- ],
155
- "estadoCivil": "soltero",
156
- "reportarError": false,
157
- "scan": "27381849",
158
- "carpetaEfectores": [
159
- {
160
- "_id": "5992e06a0e3f6446112e9bd5",
161
- "organizacion": {
162
- "_id": "59650203d03019f919ea31ed",
163
- "nombre": "CENTRO DE SALUD PARQUE INDUSTRIAL"
164
- },
165
- "nroCarpeta": ""
166
- },
167
- {
168
- "_id": "5b57565dc0202168d3d5762d",
169
- "organizacion": {
170
- "_id": "57e9670e52df311059bc8964",
171
- "nombre": "HOSPITAL PROVINCIAL NEUQUEN - DR. EDUARDO CASTRO RENDON"
172
- },
173
- "nroCarpeta": "PDR27381849"
174
- }
175
- ],
176
- "notas": [],
177
- "cuil": "23273818499",
178
- "foto": null,
179
- "activo": true,
180
- "notaError": "",
181
- "tipoIdentificacion": null,
182
- "numeroIdentificacion": null,
183
- "fotoId": "6046105c18944f849e9fe315",
184
- "documentos": [],
185
- "fechaFallecimiento": null,
186
- "createdBy": {
187
- "organizacion": {
188
- "id": "50580352367779",
189
- "nombre": "LABORATORIO RAÑA - SERVICIOS MEDICOS"
190
- }
191
- }
192
- }
@@ -1,26 +0,0 @@
1
- import { AndesPatient } from '../types/andes/patient.types';
2
- export type PartialDeep<T> = {
3
- [K in keyof T]?: T[K] extends object ? PartialDeep<T[K]> : T[K];
4
- };
5
- export declare const createPatient: (overrides?: PartialDeep<AndesPatient>) => {
6
- _id?: string | undefined;
7
- id?: string | undefined;
8
- documento?: string | undefined;
9
- cuil?: string | undefined;
10
- tipoIdentificacion?: string | null | undefined;
11
- numeroIdentificacion?: string | null | undefined;
12
- nombre: string;
13
- apellido: string;
14
- fechaNacimiento?: string | Date | undefined;
15
- fechaFallecimiento?: string | Date | null | undefined;
16
- genero?: string | undefined;
17
- sexo?: string | undefined;
18
- estado?: string | null | undefined;
19
- activo?: boolean | undefined;
20
- estadoCivil?: string | null | undefined;
21
- contacto?: import("../types/andes/patient.types").AndesContacto[] | undefined;
22
- direccion?: import("../types/andes/patient.types").AndesDireccion[] | undefined;
23
- relaciones?: import("../types/andes/patient.types").AndesRelacion[] | undefined;
24
- foto?: string | null | undefined;
25
- createdBy?: import("../types/andes/patient.types").AndesCreatedBy | undefined;
26
- };
@@ -1,35 +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
- exports.createPatient = void 0;
27
- const basePatient = __importStar(require("../data/patient.json"));
28
- const createPatient = (overrides = {}) => {
29
- const clone = JSON.parse(JSON.stringify(basePatient));
30
- return {
31
- ...clone,
32
- ...overrides,
33
- };
34
- };
35
- exports.createPatient = createPatient;
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("./config");
4
- beforeEach(() => {
5
- (0, config_1.__reset)(); // Resetea el dominio antes de cada test
6
- });
7
- test('Get default domain', () => {
8
- expect((0, config_1.getDominio)()).toBe('http://andes.gob.ar');
9
- });
10
- test('Get default URL without id', () => {
11
- expect((0, config_1.makeUrl)('patient')).toBe('http://andes.gob.ar/patient');
12
- });
13
- test('Get default URL with id', () => {
14
- expect((0, config_1.makeUrl)('patient', '123456')).toBe('http://andes.gob.ar/patient/123456');
15
- });
16
- test('Initialize domain modifies getDominio', () => {
17
- (0, config_1.initialize)({ dominio: 'http://nuevo-dominio.com' });
18
- expect((0, config_1.getDominio)()).toBe('http://nuevo-dominio.com');
19
- });
@@ -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,133 +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 identifier_systems_1 = require("../constants/identifier-systems");
30
- const pacienteFhir = (0, patient_1.encode)(patient);
31
- describe('encode patient from ANDES to FHIR R4', () => {
32
- test('Verify basic data', () => {
33
- expect(pacienteFhir.resourceType).toBe('Patient');
34
- const ident = pacienteFhir.identifier;
35
- const id = ident?.find(t => t.system === 'http://www.renaper.gob.ar/dni');
36
- expect(id?.value).toBe('42910660');
37
- expect(id?.system).toBe('http://www.renaper.gob.ar/dni');
38
- expect(pacienteFhir.active).toBe(true);
39
- expect(pacienteFhir.name).toBeDefined();
40
- expect(pacienteFhir.name[0].use).toBe('official');
41
- expect(pacienteFhir.name[0].family).toContain('PERINGA');
42
- expect(pacienteFhir.name[0].family).toContain('PONCE');
43
- expect(pacienteFhir.name[0].given).toContain('AGUSTIN');
44
- expect(pacienteFhir.name[0].text).toBe('HUGO AGUSTIN PERINGA PONCE');
45
- expect(pacienteFhir.gender).toBe('male');
46
- expect(pacienteFhir.birthDate).toBe('1979-11-14');
47
- });
48
- test('Verify patient with contact information', () => {
49
- // Phone;
50
- expect(pacienteFhir.telecom).toBeDefined();
51
- expect(pacienteFhir.telecom[0].value).toBe('4462221');
52
- expect(pacienteFhir.telecom[0].system).toBe('phone');
53
- // Address;
54
- expect(pacienteFhir.address).toBeDefined();
55
- expect(pacienteFhir.address[0].postalCode).toBe('8300');
56
- expect(pacienteFhir.address[0].line).toContain('Enrique Santos Discepolo 1856');
57
- expect(pacienteFhir.address[0].city).toBe('NEUQUEN');
58
- expect(pacienteFhir.address[0].state).toBe('Neuquén');
59
- expect(pacienteFhir.address[0].country).toBe('Argentina');
60
- });
61
- test('Verify patient with relationships', () => {
62
- // Validar que exista contact y al menos un elemento
63
- expect(pacienteFhir.contact).toBeDefined();
64
- expect(pacienteFhir.contact.length).toBeGreaterThan(0);
65
- const contacto0 = pacienteFhir.contact[0];
66
- // Validar que tenga relationship y name estructurados
67
- expect(contacto0.relationship).toBeDefined();
68
- expect(contacto0.relationship.length).toBeGreaterThan(0);
69
- expect(contacto0.name).toBeDefined();
70
- // Ahora sí: acceder sin que TS marque error
71
- expect(contacto0.relationship[0].text).toBe('hijo/a');
72
- expect(contacto0.name.family).toContain('PERINGA');
73
- expect(contacto0.name.given).toContain('JOSEFINA');
74
- });
75
- test('Maneja paciente con estado validado', () => {
76
- const paciente = (0, patientFactory_1.createPatient)({ estado: 'validado' });
77
- const fhir = (0, patient_1.encode)(paciente);
78
- expect(fhir).not.toBeNull();
79
- expect(fhir.extension?.some(t => t.valueCode === 'validado')).toBeTruthy();
80
- });
81
- test('Maneja paciente con estado temporal', () => {
82
- const paciente = (0, patientFactory_1.createPatient)({ estado: 'temporal' });
83
- const fhir = (0, patient_1.encode)(paciente);
84
- expect(fhir).not.toBeNull();
85
- expect(fhir.extension?.some(t => t.valueCode === 'temporal')).toBeTruthy();
86
- });
87
- test('Maneja paciente con estado nulo', () => {
88
- const paciente = (0, patientFactory_1.createPatient)({ estado: null });
89
- const fhir = (0, patient_1.encode)(paciente);
90
- expect(fhir).not.toBeNull();
91
- expect(fhir.extension?.some(t => t.valueCode === 'temporal')).toBeTruthy();
92
- });
93
- it('Verifica organización que crea paciente', () => {
94
- const fhir = pacienteFhir;
95
- expect(fhir.managingOrganization).toBeDefined();
96
- expect(fhir.managingOrganization.display).toContain('LABORATORIO');
97
- });
98
- it('Verifica dni extranjero', () => {
99
- const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'dni extranjero', numeroIdentificacion: 'ABC123' });
100
- const fhir = (0, patient_1.encode)(paciente);
101
- expect(fhir).not.toBeNull();
102
- const id = fhir.identifier?.find(t => t.system === identifier_systems_1.FhirIdentifierSystems.FOREIGN_ID);
103
- expect(id?.value).toBe('ABC123');
104
- expect(id?.system).toBe('http://andes.gob.ar/sid/foreign-id');
105
- });
106
- it('Verifica pasaporte', () => {
107
- const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'pasaporte', numeroIdentificacion: 'ABC123CD' });
108
- const fhir = (0, patient_1.encode)(paciente);
109
- expect(fhir).not.toBeNull();
110
- const id = fhir.identifier?.find(t => t.system === identifier_systems_1.FhirIdentifierSystems.PASSPORT);
111
- expect(id?.value).toBe('ABC123CD');
112
- expect(id?.system).toBe('http://andes.gob.ar/sid/passport');
113
- });
114
- });
115
- describe('decode patient from FHIR R4 to ANDES', () => {
116
- it('Verifica dni extranjero', () => {
117
- const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'dni extranjero', numeroIdentificacion: 'ABC123' });
118
- const fhirEncode = (0, patient_1.encode)(paciente);
119
- expect(fhirEncode).not.toBeNull();
120
- const fhirDecode = (0, patient_1.decode)(fhirEncode);
121
- expect(fhirDecode?.tipoIdentificacion).toBe('dni extranjero');
122
- expect(fhirDecode?.numeroIdentificacion).toBe('ABC123');
123
- });
124
- it('Verifica pasaporte', () => {
125
- const paciente = (0, patientFactory_1.createPatient)({ tipoIdentificacion: 'pasaporte', numeroIdentificacion: 'ABC123CD' });
126
- const fhirEncode = (0, patient_1.encode)(paciente);
127
- expect(fhirEncode).not.toBeNull();
128
- const fhirDecode = (0, patient_1.decode)(fhirEncode);
129
- expect(fhirDecode?.tipoIdentificacion).toBe('pasaporte');
130
- expect(fhirDecode?.numeroIdentificacion).toBe('ABC123CD');
131
- expect(fhirDecode?.estado).toBe('temporal');
132
- });
133
- });