@andes/fhir 1.12.1-beta.7 → 1.13.0-beta.2
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.
- package/dist/lib/organization.js +6 -5
- package/dist/lib/patient.js +3 -12
- package/dist/lib/practitioner.d.ts +0 -3
- package/dist/lib/practitioner.js +28 -16
- package/dist/utils/fhirDate.d.ts +3 -0
- package/dist/utils/fhirDate.js +25 -0
- package/dist/utils/rankingMapping.d.ts +8 -0
- package/dist/utils/rankingMapping.js +21 -0
- package/package.json +1 -1
package/dist/lib/organization.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.encode = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
|
+
const rankingMapping_1 = require("../utils/rankingMapping");
|
|
5
6
|
/**
|
|
6
7
|
* Encode an ANDES Organization to FHIR Organization
|
|
7
8
|
*/
|
|
@@ -13,25 +14,25 @@ function encode(organization) {
|
|
|
13
14
|
const identificadores = [];
|
|
14
15
|
if (data.codigo?.sisa) {
|
|
15
16
|
identificadores.push({
|
|
16
|
-
system: 'andes.gob.ar/sisa',
|
|
17
|
+
system: 'https://andes.gob.ar/sisa',
|
|
17
18
|
value: data.codigo.sisa
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
if (data.codigo?.cuie) {
|
|
21
22
|
identificadores.push({
|
|
22
|
-
system: 'andes.gob.ar/cuie',
|
|
23
|
+
system: 'https://andes.gob.ar/cuie',
|
|
23
24
|
value: data.codigo.cuie
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
if (data.codigo?.remediar) {
|
|
27
28
|
identificadores.push({
|
|
28
|
-
system: 'andes.gob.ar/remediar',
|
|
29
|
+
system: 'https://andes.gob.ar/remediar',
|
|
29
30
|
value: data.codigo.remediar
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
if (data.codigo?.sips) {
|
|
33
34
|
identificadores.push({
|
|
34
|
-
system: 'andes.gob.ar/sips',
|
|
35
|
+
system: 'https://andes.gob.ar/sips',
|
|
35
36
|
value: data.codigo.sips
|
|
36
37
|
});
|
|
37
38
|
}
|
|
@@ -44,7 +45,7 @@ function encode(organization) {
|
|
|
44
45
|
.map((item) => {
|
|
45
46
|
const cp = {
|
|
46
47
|
value: item.valor,
|
|
47
|
-
rank: item.ranking
|
|
48
|
+
rank: (0, rankingMapping_1.mapAndesRankingToFhirRank)(item.ranking)
|
|
48
49
|
};
|
|
49
50
|
switch (item.tipo) {
|
|
50
51
|
case 'fijo':
|
package/dist/lib/patient.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verify = exports.decode = exports.encode = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
|
+
const rankingMapping_1 = require("../utils/rankingMapping");
|
|
5
6
|
/**
|
|
6
7
|
* Helpers
|
|
7
8
|
*/
|
|
@@ -99,16 +100,6 @@ function mapEstadoCivilFHIRToAndes(estadoCivil) {
|
|
|
99
100
|
return 'otro';
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
|
-
function mapAndesRankingToFhirRank(andesRanking) {
|
|
103
|
-
return typeof andesRanking === 'number' && Number.isInteger(andesRanking) && andesRanking >= 0
|
|
104
|
-
? andesRanking + 1
|
|
105
|
-
: 1;
|
|
106
|
-
}
|
|
107
|
-
function mapFhirRankToAndesRanking(fhirRank) {
|
|
108
|
-
return typeof fhirRank === 'number' && Number.isInteger(fhirRank) && fhirRank > 0
|
|
109
|
-
? fhirRank - 1
|
|
110
|
-
: 0;
|
|
111
|
-
}
|
|
112
103
|
/**
|
|
113
104
|
* Encode a patient from ANDES to FHIR
|
|
114
105
|
*/
|
|
@@ -155,7 +146,7 @@ function encode(patient) {
|
|
|
155
146
|
.map((unContacto) => {
|
|
156
147
|
const cont = {
|
|
157
148
|
value: unContacto.valor,
|
|
158
|
-
rank: mapAndesRankingToFhirRank(unContacto.ranking)
|
|
149
|
+
rank: (0, rankingMapping_1.mapAndesRankingToFhirRank)(unContacto.ranking)
|
|
159
150
|
};
|
|
160
151
|
switch (unContacto.tipo) {
|
|
161
152
|
case 'fijo':
|
|
@@ -309,7 +300,7 @@ function decode(patient) {
|
|
|
309
300
|
? patient.telecom.map((unContacto) => {
|
|
310
301
|
const cont = {
|
|
311
302
|
valor: unContacto.value,
|
|
312
|
-
ranking: mapFhirRankToAndesRanking(unContacto.rank)
|
|
303
|
+
ranking: (0, rankingMapping_1.mapFhirRankToAndesRanking)(unContacto.rank)
|
|
313
304
|
};
|
|
314
305
|
switch (unContacto.system) {
|
|
315
306
|
case 'phone':
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { Practitioner } from 'fhir/r4';
|
|
2
2
|
import { AndesPractitioner } from '../types/andes/practitioner.types';
|
|
3
|
-
/**
|
|
4
|
-
* Encode a practitioner from ANDES to FHIR
|
|
5
|
-
*/
|
|
6
3
|
export declare function encode(practitioner: AndesPractitioner | null | undefined): Practitioner | null;
|
package/dist/lib/practitioner.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.encode = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
|
-
|
|
6
|
-
* Encode a practitioner from ANDES to FHIR
|
|
7
|
-
*/
|
|
5
|
+
const fhirDate_1 = require("../utils/fhirDate");
|
|
8
6
|
function encode(practitioner) {
|
|
9
7
|
const data = practitioner;
|
|
10
8
|
if (!data) {
|
|
@@ -86,15 +84,22 @@ function encode(practitioner) {
|
|
|
86
84
|
unaMatricula.code = {
|
|
87
85
|
coding: [{
|
|
88
86
|
system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
|
|
89
|
-
code: datosGrado.profesion.codigo,
|
|
87
|
+
code: String(datosGrado.profesion.codigo ?? ''),
|
|
90
88
|
display: datosGrado.profesion.tipoDeFormacion
|
|
91
89
|
}],
|
|
92
|
-
text: ultima.matriculaNumero
|
|
93
|
-
};
|
|
94
|
-
unaMatricula.period = {
|
|
95
|
-
start: ultima.inicio ?? null,
|
|
96
|
-
end: ultima.fin ?? null
|
|
90
|
+
text: String(ultima.matriculaNumero ?? '')
|
|
97
91
|
};
|
|
92
|
+
const start = (0, fhirDate_1.formatFHIRDateTime)(ultima.inicio);
|
|
93
|
+
const end = (0, fhirDate_1.formatFHIRDateTime)(ultima.fin);
|
|
94
|
+
if (start || end) {
|
|
95
|
+
unaMatricula.period = {};
|
|
96
|
+
if (start) {
|
|
97
|
+
unaMatricula.period.start = start;
|
|
98
|
+
}
|
|
99
|
+
if (end) {
|
|
100
|
+
unaMatricula.period.end = end;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
98
103
|
}
|
|
99
104
|
return unaMatricula;
|
|
100
105
|
});
|
|
@@ -118,15 +123,22 @@ function encode(practitioner) {
|
|
|
118
123
|
unaMatricula.code = {
|
|
119
124
|
coding: [{
|
|
120
125
|
system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
|
|
121
|
-
code: datosPosgrado.especialidad.codigo,
|
|
126
|
+
code: String(datosPosgrado.especialidad.codigo ?? ''),
|
|
122
127
|
display: datosPosgrado.especialidad.tipo
|
|
123
128
|
}],
|
|
124
|
-
text: ultima.matriculaNumero
|
|
125
|
-
};
|
|
126
|
-
unaMatricula.period = {
|
|
127
|
-
start: ultima.inicio ?? null,
|
|
128
|
-
end: ultima.fin ?? null
|
|
129
|
+
text: String(ultima.matriculaNumero ?? '')
|
|
129
130
|
};
|
|
131
|
+
const start = (0, fhirDate_1.formatFHIRDateTime)(ultima.inicio);
|
|
132
|
+
const end = (0, fhirDate_1.formatFHIRDateTime)(ultima.fin);
|
|
133
|
+
if (start || end) {
|
|
134
|
+
unaMatricula.period = {};
|
|
135
|
+
if (start) {
|
|
136
|
+
unaMatricula.period.start = start;
|
|
137
|
+
}
|
|
138
|
+
if (end) {
|
|
139
|
+
unaMatricula.period.end = end;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
130
142
|
}
|
|
131
143
|
return unaMatricula;
|
|
132
144
|
});
|
|
@@ -162,7 +174,7 @@ function encode(practitioner) {
|
|
|
162
174
|
given: data.nombre?.split(' ') ?? []
|
|
163
175
|
}],
|
|
164
176
|
gender: genero,
|
|
165
|
-
birthDate: data.fechaNacimiento,
|
|
177
|
+
birthDate: (0, fhirDate_1.formatFHIRDate)(data.fechaNacimiento),
|
|
166
178
|
};
|
|
167
179
|
if (contactos.length > 0) {
|
|
168
180
|
profesionalFHIR.telecom = contactos;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatFHIRDate = exports.formatFHIRDateTime = exports.isValidFHIRDateTime = void 0;
|
|
4
|
+
function isValidFHIRDateTime(date) {
|
|
5
|
+
if (date === null || date === undefined || date === 0 || date === '0' || date === '') {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const d = new Date(date);
|
|
9
|
+
return !isNaN(d.getTime());
|
|
10
|
+
}
|
|
11
|
+
exports.isValidFHIRDateTime = isValidFHIRDateTime;
|
|
12
|
+
function formatFHIRDateTime(date) {
|
|
13
|
+
if (isValidFHIRDateTime(date)) {
|
|
14
|
+
return new Date(date).toISOString();
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
exports.formatFHIRDateTime = formatFHIRDateTime;
|
|
19
|
+
function formatFHIRDate(date) {
|
|
20
|
+
if (isValidFHIRDateTime(date)) {
|
|
21
|
+
return new Date(date).toISOString().split('T')[0];
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
exports.formatFHIRDate = formatFHIRDate;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapea ANDES ranking base 1 a FHIR rank base 1
|
|
3
|
+
*/
|
|
4
|
+
export declare function mapAndesRankingToFhirRank(andesRanking?: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Mapea FHIR rank base 1 a ANDES ranking base 0
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapFhirRankToAndesRanking(fhirRank?: number): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapFhirRankToAndesRanking = exports.mapAndesRankingToFhirRank = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Mapea ANDES ranking base 1 a FHIR rank base 1
|
|
6
|
+
*/
|
|
7
|
+
function mapAndesRankingToFhirRank(andesRanking) {
|
|
8
|
+
return typeof andesRanking === 'number' && Number.isInteger(andesRanking) && andesRanking >= 0
|
|
9
|
+
? andesRanking + 1
|
|
10
|
+
: 1;
|
|
11
|
+
}
|
|
12
|
+
exports.mapAndesRankingToFhirRank = mapAndesRankingToFhirRank;
|
|
13
|
+
/**
|
|
14
|
+
* Mapea FHIR rank base 1 a ANDES ranking base 0
|
|
15
|
+
*/
|
|
16
|
+
function mapFhirRankToAndesRanking(fhirRank) {
|
|
17
|
+
return typeof fhirRank === 'number' && Number.isInteger(fhirRank) && fhirRank > 0
|
|
18
|
+
? fhirRank - 1
|
|
19
|
+
: 0;
|
|
20
|
+
}
|
|
21
|
+
exports.mapFhirRankToAndesRanking = mapFhirRankToAndesRanking;
|