@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
@@ -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: "https://www.renaper.gob.ar/dni";
5
+ readonly CUIL: "https://www.anses.org.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: 'https://www.renaper.gob.ar/dni',
8
+ CUIL: 'https://www.anses.org.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
+ };
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"));
@@ -19,6 +19,18 @@ export declare function encode(patientReference: any, alergiaIntolerancia: any):
19
19
  meta: {
20
20
  profile: string[];
21
21
  };
22
+ clinicalStatus: {
23
+ coding: {
24
+ system: string;
25
+ code: string;
26
+ }[];
27
+ };
28
+ verificationStatus: {
29
+ coding: {
30
+ system: string;
31
+ code: string;
32
+ }[];
33
+ };
22
34
  text: {
23
35
  status: string;
24
36
  div: string;
@@ -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
@@ -25,7 +25,23 @@ function encode(patientReference, alergiaIntolerancia) {
25
25
  ]
26
26
  },
27
27
  meta: {
28
- profile: ['http://hl7.org/fhir/uv/ips/StructureDefinition/allergyintolerance-uv-ips']
28
+ profile: ['http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips']
29
+ },
30
+ clinicalStatus: {
31
+ coding: [
32
+ {
33
+ system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',
34
+ code: 'active'
35
+ }
36
+ ]
37
+ },
38
+ verificationStatus: {
39
+ coding: [
40
+ {
41
+ system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',
42
+ code: 'confirmed'
43
+ }
44
+ ]
29
45
  },
30
46
  text: {
31
47
  status: 'generated',
@@ -36,4 +52,3 @@ function encode(patientReference, alergiaIntolerancia) {
36
52
  onsetDateTime: alergiaIntolerancia.valor.fechaInicio
37
53
  };
38
54
  }
39
- exports.encode = encode;
@@ -4,9 +4,9 @@ export declare function encode(ID: any, resources: any): {
4
4
  meta: {
5
5
  lastUpdated: string;
6
6
  };
7
- language: string;
8
7
  entry: any;
9
8
  type: string;
9
+ timestamp: string;
10
10
  identifier: {
11
11
  system: string;
12
12
  value: any;
@@ -1,25 +1,21 @@
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) {
6
+ const now = new Date().toISOString();
10
7
  return {
11
8
  resourceType: 'Bundle',
12
9
  id: ID,
13
10
  meta: {
14
- lastUpdated: (0, moment_1.default)().format()
11
+ lastUpdated: now
15
12
  },
16
- language: 'es-AR',
17
13
  entry: resources,
18
14
  type: 'document',
15
+ timestamp: now,
19
16
  identifier: {
20
17
  system: (0, config_1.makeUrl)('Bundle'),
21
18
  value: ID
22
19
  }
23
20
  };
24
21
  }
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: {
@@ -7,16 +6,12 @@ export declare function encode(ID: any, patientReference: any, custodianReferenc
7
6
  section: any[];
8
7
  resourceType: string;
9
8
  author: {
10
- identifier: {
11
- system: string;
12
- value: any;
13
- };
9
+ reference: any;
14
10
  }[];
15
11
  confidentiality: string;
16
12
  type: {
17
13
  coding: {
18
14
  system: string;
19
- display: string;
20
15
  code: string;
21
16
  }[];
22
17
  };
@@ -25,20 +20,20 @@ export declare function encode(ID: any, patientReference: any, custodianReferenc
25
20
  system: string;
26
21
  value: any;
27
22
  };
28
- date: moment.Moment;
23
+ date: string;
24
+ meta: {
25
+ profile: string[];
26
+ };
29
27
  text: {
30
28
  status: string;
31
29
  div: string;
32
30
  };
33
31
  custodian: {
34
- identifier: {
35
- system: string;
36
- value: any;
37
- };
32
+ reference: any;
38
33
  };
39
34
  attester: {
40
35
  mode: string;
41
- time: moment.Moment;
36
+ time: string;
42
37
  party: {
43
38
  reference: any;
44
39
  };
@@ -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,79 +9,188 @@ 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 = [];
20
17
  let allergyIntolerance = [];
21
- Immunization = [{
22
- title: 'Vacunas',
23
- text: {
24
- status: 'generated',
25
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Sección referida a la vacunación del paciente </div>'
26
- },
27
- code: {
28
- coding: [
29
- {
30
- system: 'http://loinc.org',
31
- display: 'Immunization record',
32
- code: '60484-3'
33
- }
34
- ]
35
- },
36
- entry: ImmunizationReferences ? ImmunizationReferences.map(getReference) : []
37
- }];
38
- medications = [{
39
- title: 'Medicamentos',
40
- text: {
41
- status: 'generated',
42
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de medicamentos</div>'
43
- },
44
- code: {
45
- coding: [
46
- {
47
- system: 'http://loinc.org',
48
- display: 'Medication use',
49
- code: '10160-0'
50
- }
51
- ]
52
- },
53
- entry: medicationStatementReference ? medicationStatementReference.map(getReference) : [],
54
- }];
55
- allergyIntolerance = [{
56
- title: 'Alergias o Intolerancias',
57
- text: {
58
- status: 'generated',
59
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de Alergias</div>'
60
- },
61
- code: {
62
- coding: [
63
- {
64
- system: 'http://loinc.org',
65
- display: 'Allergies and/or adverse reactions',
66
- code: '48765-2'
67
- }
68
- ]
69
- },
70
- entry: AllergyIntoleranceReferences ? AllergyIntoleranceReferences.map(getReference) : [],
71
- }];
72
- conditions = [{
73
- code: {
74
- coding: [
75
- {
76
- system: 'http://loinc.org',
77
- display: 'Problem list',
78
- code: '11450-4'
79
- }
80
- ]
81
- },
82
- entry: ConditionReferences ? ConditionReferences.map(getReference) : [],
83
- title: 'Problemas activos',
84
- text: {
85
- status: 'generated',
86
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Lista de problemas activos (trastornos)</div>'
87
- }
88
- }];
18
+ if (ImmunizationReferences && ImmunizationReferences.length > 0) {
19
+ Immunization = [{
20
+ title: 'Vacunas',
21
+ text: {
22
+ status: 'generated',
23
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Sección referida a la vacunación del paciente </div>'
24
+ },
25
+ code: {
26
+ coding: [
27
+ {
28
+ system: 'http://loinc.org',
29
+ code: '60484-3'
30
+ }
31
+ ]
32
+ },
33
+ entry: ImmunizationReferences.map(getReference)
34
+ }];
35
+ }
36
+ else {
37
+ Immunization = [{
38
+ title: 'Vacunas',
39
+ text: {
40
+ status: 'generated',
41
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay vacunas registradas</div>'
42
+ },
43
+ code: {
44
+ coding: [
45
+ {
46
+ system: 'http://loinc.org',
47
+ code: '60484-3'
48
+ }
49
+ ]
50
+ },
51
+ emptyReason: {
52
+ coding: [
53
+ {
54
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
55
+ code: 'nilknown',
56
+ display: 'Nil Known'
57
+ }
58
+ ]
59
+ }
60
+ }];
61
+ }
62
+ if (medicationStatementReference && medicationStatementReference.length > 0) {
63
+ medications = [{
64
+ title: 'Medicamentos',
65
+ text: {
66
+ status: 'generated',
67
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de medicamentos</div>'
68
+ },
69
+ code: {
70
+ coding: [
71
+ {
72
+ system: 'http://loinc.org',
73
+ code: '10160-0'
74
+ }
75
+ ]
76
+ },
77
+ entry: medicationStatementReference.map(getReference)
78
+ }];
79
+ }
80
+ else {
81
+ medications = [{
82
+ title: 'Medicamentos',
83
+ text: {
84
+ status: 'generated',
85
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay medicamentos registrados</div>'
86
+ },
87
+ code: {
88
+ coding: [
89
+ {
90
+ system: 'http://loinc.org',
91
+ code: '10160-0'
92
+ }
93
+ ]
94
+ },
95
+ emptyReason: {
96
+ coding: [
97
+ {
98
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
99
+ code: 'nilknown',
100
+ display: 'Nil Known'
101
+ }
102
+ ]
103
+ }
104
+ }];
105
+ }
106
+ if (AllergyIntoleranceReferences && AllergyIntoleranceReferences.length > 0) {
107
+ allergyIntolerance = [{
108
+ title: 'Alergias o Intolerancias',
109
+ text: {
110
+ status: 'generated',
111
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de Alergias</div>'
112
+ },
113
+ code: {
114
+ coding: [
115
+ {
116
+ system: 'http://loinc.org',
117
+ code: '48765-2'
118
+ }
119
+ ]
120
+ },
121
+ entry: AllergyIntoleranceReferences.map(getReference)
122
+ }];
123
+ }
124
+ else {
125
+ allergyIntolerance = [{
126
+ title: 'Alergias o Intolerancias',
127
+ text: {
128
+ status: 'generated',
129
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay registro de alergias</div>'
130
+ },
131
+ code: {
132
+ coding: [
133
+ {
134
+ system: 'http://loinc.org',
135
+ code: '48765-2'
136
+ }
137
+ ]
138
+ },
139
+ emptyReason: {
140
+ coding: [
141
+ {
142
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
143
+ code: 'nilknown',
144
+ display: 'Nil Known'
145
+ }
146
+ ]
147
+ }
148
+ }];
149
+ }
150
+ if (ConditionReferences && ConditionReferences.length > 0) {
151
+ conditions = [{
152
+ code: {
153
+ coding: [
154
+ {
155
+ system: 'http://loinc.org',
156
+ code: '11450-4'
157
+ }
158
+ ]
159
+ },
160
+ entry: ConditionReferences.map(getReference),
161
+ title: 'Problemas activos',
162
+ text: {
163
+ status: 'generated',
164
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Lista de problemas activos (trastornos)</div>'
165
+ }
166
+ }];
167
+ }
168
+ else {
169
+ conditions = [{
170
+ code: {
171
+ coding: [
172
+ {
173
+ system: 'http://loinc.org',
174
+ code: '11450-4'
175
+ }
176
+ ]
177
+ },
178
+ title: 'Problemas activos',
179
+ text: {
180
+ status: 'generated',
181
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay problemas activos registrados</div>'
182
+ },
183
+ emptyReason: {
184
+ coding: [
185
+ {
186
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
187
+ code: 'nilknown',
188
+ display: 'Nil Known'
189
+ }
190
+ ]
191
+ }
192
+ }];
193
+ }
89
194
  return {
90
195
  id: ID,
91
196
  subject: {
@@ -100,10 +205,7 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
100
205
  resourceType: 'Composition',
101
206
  author: [
102
207
  {
103
- identifier: {
104
- system: 'https://federador.msal.gob.ar/uri',
105
- value: deviceReference
106
- }
208
+ reference: deviceReference
107
209
  }
108
210
  ],
109
211
  confidentiality: 'N',
@@ -111,36 +213,32 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
111
213
  coding: [
112
214
  {
113
215
  system: 'http://loinc.org',
114
- display: 'Patient Summary',
115
216
  code: '60591-5'
116
217
  }
117
218
  ]
118
219
  },
119
- title: 'Resumen del paciente al ' + now.format('DD/MM/YYYY, HH:mm'),
220
+ title: 'Resumen del paciente al ' + now.toLocaleDateString('es-AR') + ', ' + now.toLocaleTimeString('es-AR', { hour: '2-digit', minute: '2-digit' }),
120
221
  identifier: {
121
222
  system: (0, config_1.makeUrl)('Composition'),
122
223
  value: ID
123
224
  },
124
- date: now,
125
- // meta: {
126
- // profile: [
127
- // 'http:\/\/hl7.org\/fhir\/uv\/ips\/StructureDefinition\/composition-uv-ips'
128
- // ]
129
- // },
225
+ date: nowIso,
226
+ meta: {
227
+ profile: [
228
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips'
229
+ ]
230
+ },
130
231
  text: {
131
232
  status: 'generated',
132
233
  div: '<div xmlns="http://www.w3.org/1999/xhtml">IPS Neuquen</div>'
133
234
  },
134
235
  custodian: {
135
- identifier: {
136
- system: 'https://federador.msal.gob.ar/uri',
137
- value: custodianReference
138
- }
236
+ reference: custodianReference
139
237
  },
140
238
  attester: [
141
239
  {
142
240
  mode: 'legal',
143
- time: now,
241
+ time: nowIso,
144
242
  party: {
145
243
  reference: custodianReference
146
244
  }
@@ -149,4 +247,3 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
149
247
  status: 'final'
150
248
  };
151
249
  }
152
- exports.encode = encode;
@@ -2,52 +2,4 @@
2
2
  *
3
3
  * @param registro Registro RUP a transformar a FHIR
4
4
  */
5
- export declare function encode(patientReference: any, registro: any): {
6
- id: any;
7
- category: {
8
- coding: {
9
- system: string;
10
- display: string;
11
- code: string;
12
- }[];
13
- }[];
14
- subject: {
15
- reference: any;
16
- };
17
- onsetDateTime: any;
18
- resourceType: string;
19
- verificationStatus: {
20
- coding: {
21
- system: string;
22
- code: string;
23
- }[];
24
- };
25
- code: {
26
- coding: {
27
- code: any;
28
- system: string;
29
- display: any;
30
- }[];
31
- };
32
- recordedDate: any;
33
- meta: {
34
- profile: string[];
35
- };
36
- text: {
37
- status: string;
38
- div: string;
39
- };
40
- severity: {
41
- coding: {
42
- system: string;
43
- display: string;
44
- code: string;
45
- }[];
46
- };
47
- clinicalStatus: {
48
- coding: {
49
- system: string;
50
- code: any;
51
- }[];
52
- };
53
- };
5
+ export declare function encode(patientReference: any, registro: any): any;