@andes/fhir 1.11.1

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 (71) hide show
  1. package/.circleci/config.yml +69 -0
  2. package/.editorconfig +14 -0
  3. package/.gitattributes +1 -0
  4. package/.github/CODEOWNERS +1 -0
  5. package/.github/labeler.yml +11 -0
  6. package/.github/pull_request_template.md +28 -0
  7. package/.github/workflows/build_test.yml +14 -0
  8. package/.github/workflows/has_conflicts.yml +13 -0
  9. package/CHANGELOG.md +306 -0
  10. package/LICENSE +674 -0
  11. package/README.md +2 -0
  12. package/dist/index.js +33 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/src/data/patient.json +185 -0
  15. package/dist/src/lib/allergyIntolerance.js +40 -0
  16. package/dist/src/lib/allergyIntolerance.js.map +1 -0
  17. package/dist/src/lib/bundle.js +23 -0
  18. package/dist/src/lib/bundle.js.map +1 -0
  19. package/dist/src/lib/composition.js +151 -0
  20. package/dist/src/lib/composition.js.map +1 -0
  21. package/dist/src/lib/condition.js +80 -0
  22. package/dist/src/lib/condition.js.map +1 -0
  23. package/dist/src/lib/config.js +23 -0
  24. package/dist/src/lib/config.js.map +1 -0
  25. package/dist/src/lib/config.test.js +13 -0
  26. package/dist/src/lib/config.test.js.map +1 -0
  27. package/dist/src/lib/device.js +39 -0
  28. package/dist/src/lib/device.js.map +1 -0
  29. package/dist/src/lib/device.test.js +10 -0
  30. package/dist/src/lib/device.test.js.map +1 -0
  31. package/dist/src/lib/document-reference.js +104 -0
  32. package/dist/src/lib/document-reference.js.map +1 -0
  33. package/dist/src/lib/immunization.js +68 -0
  34. package/dist/src/lib/immunization.js.map +1 -0
  35. package/dist/src/lib/medication.js +65 -0
  36. package/dist/src/lib/medication.js.map +1 -0
  37. package/dist/src/lib/medicationRequest.js +100 -0
  38. package/dist/src/lib/medicationRequest.js.map +1 -0
  39. package/dist/src/lib/medicationStatement.js +56 -0
  40. package/dist/src/lib/medicationStatement.js.map +1 -0
  41. package/dist/src/lib/organization.js +91 -0
  42. package/dist/src/lib/organization.js.map +1 -0
  43. package/dist/src/lib/patient.js +361 -0
  44. package/dist/src/lib/patient.js.map +1 -0
  45. package/dist/src/lib/patient.test.js +40 -0
  46. package/dist/src/lib/patient.test.js.map +1 -0
  47. package/dist/src/lib/practitioner.js +161 -0
  48. package/dist/src/lib/practitioner.js.map +1 -0
  49. package/index.ts +31 -0
  50. package/jest.config.js +12 -0
  51. package/package.json +54 -0
  52. package/src/data/patient.json +185 -0
  53. package/src/lib/allergyIntolerance.ts +36 -0
  54. package/src/lib/bundle.ts +19 -0
  55. package/src/lib/composition.ts +153 -0
  56. package/src/lib/condition.ts +80 -0
  57. package/src/lib/config.test.ts +13 -0
  58. package/src/lib/config.ts +17 -0
  59. package/src/lib/device.test.ts +9 -0
  60. package/src/lib/device.ts +36 -0
  61. package/src/lib/document-reference.ts +102 -0
  62. package/src/lib/immunization.ts +64 -0
  63. package/src/lib/medication.ts +61 -0
  64. package/src/lib/medicationRequest.ts +100 -0
  65. package/src/lib/medicationStatement.ts +52 -0
  66. package/src/lib/organization.ts +89 -0
  67. package/src/lib/patient.test.ts +38 -0
  68. package/src/lib/patient.ts +374 -0
  69. package/src/lib/practitioner.ts +157 -0
  70. package/tsconfig.test.json +18 -0
  71. package/tslint.json +139 -0
@@ -0,0 +1,374 @@
1
+
2
+ import { getDominio, makeUrl } from './config';
3
+
4
+ /**
5
+ * Encode a patient from ANDES to FHIR
6
+ * @param {} patient
7
+ */
8
+ export function encode(patient) {
9
+ if (patient) {
10
+ const identificadores: any = [];
11
+ if (patient.documento) {
12
+ identificadores.push({
13
+ system: 'http://www.renaper.gob.ar/dni',
14
+ value: patient.documento
15
+ });
16
+ }
17
+ if (patient.cuil) {
18
+ identificadores.push({
19
+ system: 'http://www.renaper.gob.ar/cuil',
20
+ value: patient.cuil
21
+ });
22
+ }
23
+ identificadores.push({
24
+ system: getDominio(),
25
+ value: patient._id
26
+ });
27
+ // Parsea contactos
28
+ let contactos = patient.contacto ? patient.contacto.filter(c => c.valor).map(unContacto => {
29
+ let cont = {
30
+ resourceType: 'ContactPoint',
31
+ value: unContacto.valor,
32
+ rank: unContacto.ranking,
33
+ };
34
+ switch (unContacto.tipo) {
35
+ case 'fijo':
36
+ cont['system'] = 'phone';
37
+ break;
38
+ case 'celular':
39
+ cont['system'] = 'phone';
40
+ break;
41
+ case 'email':
42
+ cont['system'] = 'email';
43
+ break;
44
+ }
45
+ return cont;
46
+ }) : [];
47
+ // Parsea direcciones
48
+ let direcciones = patient.direccion ? patient.direccion.filter(dir => dir.ubicacion.localidad).map(unaDireccion => {
49
+ let direc = {
50
+ resourceType: 'Address',
51
+ postalCode: unaDireccion.codigoPostal ? unaDireccion.codigoPostal : '',
52
+ line: [unaDireccion.valor],
53
+ city: unaDireccion.ubicacion.localidad ? unaDireccion.ubicacion.localidad.nombre : '',
54
+ state: unaDireccion.ubicacion.provincia ? unaDireccion.ubicacion.provincia.nombre : '',
55
+ country: unaDireccion.ubicacion.pais ? unaDireccion.ubicacion.pais.nombre : '',
56
+ };
57
+ return direc;
58
+ }) : [];
59
+ // Parsea relaciones
60
+ let relaciones = patient.relaciones ? patient.relaciones.filter(r => !!r.relacion).map(unaRelacion => {
61
+ let relacion = {
62
+ relationship: [{
63
+ text: unaRelacion.relacion.nombre
64
+ }], // The kind of relationship
65
+ name: {
66
+ resourceType: 'HumanName',
67
+ family: unaRelacion.apellido.split(' '), // Family name (often called 'Surname')
68
+ given: unaRelacion.nombre.split(' '), // Given names (not always 'first'). Includes middle names
69
+ }
70
+ };
71
+ return relacion;
72
+ }) : [];
73
+ let genero;
74
+ switch (patient.genero) {
75
+ case 'femenino':
76
+ genero = 'female';
77
+ break;
78
+ case 'masculino':
79
+ genero = 'male';
80
+ break;
81
+ case 'otro':
82
+ genero = 'other';
83
+ break;
84
+ }
85
+ let pacienteFHIR: any = {
86
+ id: patient.id,
87
+ resourceType: 'Patient',
88
+ identifier: identificadores,
89
+ active: patient.activo ? patient.activo : null, // Whether this patient's record is in active use
90
+ name: [{
91
+ use: 'official',
92
+ resourceType: 'HumanName',
93
+ family: patient.apellido.split(' '),
94
+ given: patient.nombre.split(' '),
95
+ text: `${patient.nombre} ${patient.apellido}`,
96
+ _family: [{
97
+ extension: [
98
+ {
99
+ url: 'http://hl7.org/fhir/StructureDefinition/humanname-fathers-family',
100
+ valueString: patient.apellido
101
+ },
102
+ ]
103
+ }],
104
+ }],
105
+ gender: genero, // male | female | other | unknown
106
+ birthDate: patient.fechaNacimiento ? typeof patient.fechaNacimiento === 'string' ? new Date(patient.fechaNacimiento).toISOString().slice(0, 10) : patient.fechaNacimiento.toISOString().slice(0, 10) : null
107
+ };
108
+ if (patient.fechaFallecimiento) {
109
+ pacienteFHIR.deceasedDateTime = typeof patient.fechaFallecimiento === 'string' ? new Date(patient.fechaFallecimiento.toISOString().slice(0, 10)) : patient.fechaFallecimiento.toISOString().slice(0, 10);
110
+ }
111
+ if (patient.estadoCivil) {
112
+ let estadoCivil;
113
+ switch (patient.estadoCivil) {
114
+ case 'casado':
115
+ estadoCivil = 'Married';
116
+ break;
117
+ case 'divorciado':
118
+ estadoCivil = 'Divorced';
119
+ break;
120
+ case 'viudo':
121
+ estadoCivil = 'Widowed';
122
+ break;
123
+ case 'soltero':
124
+ estadoCivil = 'unmarried';
125
+ break;
126
+ default:
127
+ estadoCivil = 'unknown';
128
+ break;
129
+ }
130
+ pacienteFHIR['maritalStatus'] = {
131
+ text: estadoCivil
132
+ };
133
+ }
134
+ if (patient.foto) {
135
+ pacienteFHIR['photo'] = [{
136
+ patient: patient.foto
137
+ }];
138
+ }
139
+ if (contactos.length > 0) { // A contact detail for the individual
140
+ pacienteFHIR['telecom'] = contactos;
141
+ }
142
+ if (direcciones.length > 0) { // Addresses for the individual
143
+ pacienteFHIR['address'] = direcciones;
144
+ }
145
+ if (relaciones.length > 0) { // A contact party (e.g. guardian, partner, friend) for the patient
146
+ pacienteFHIR['contact'] = relaciones;
147
+ }
148
+ return pacienteFHIR;
149
+ } else {
150
+ return null;
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Decode a patient from FHIR to ANDES
156
+ * @param {} patient
157
+ */
158
+ export function decode(patient) {
159
+ let genero;
160
+ let sexo;
161
+ // Cuando el paciente viene por FHIR suponemos el valor del genero tanto para nuestro field genero como sexo
162
+ switch (patient.gender) {
163
+ case 'female':
164
+ genero = 'femenino';
165
+ sexo = 'femenino';
166
+ break;
167
+ case 'male':
168
+ genero = 'masculino';
169
+ sexo = 'masculino';
170
+ break;
171
+ case 'other':
172
+ genero = 'otro';
173
+ sexo = 'otro';
174
+ break;
175
+ }
176
+ function getValue(items, key) {
177
+ const element = items.find(el => el.system === key);
178
+ if (element) {
179
+ return element.value;
180
+ }
181
+ }
182
+ let pacienteAndes = {
183
+ id: getValue(patient.identifier, makeUrl('Patient')),
184
+ documento: getValue(patient.identifier, 'http://www.renaper.gob.ar/dni'),
185
+ nombre: patient.name[0].given.join().replace(',', ' '),
186
+ apellido: Array.isArray(patient.name[0].family) ? patient.name[0].family.join().replace(',', ' ') : patient.name[0].family,
187
+ fechaNacimiento: patient.birthDate,
188
+ genero,
189
+ sexo,
190
+ estado: 'temporal' // Todos los pacientes que recibimos por Fhir son considerados temporales en su conversión.
191
+ };
192
+ let contactos = patient.telecom ? patient.telecom.map(unContacto => {
193
+ let cont = {
194
+ valor: unContacto.value,
195
+ ranking: unContacto.rank
196
+ };
197
+ switch (unContacto.system) {
198
+ case 'phone':
199
+ cont['tipo'] = 'celular';
200
+ break;
201
+ case 'email':
202
+ cont['tipo'] = 'email';
203
+ break;
204
+ }
205
+ return cont;
206
+ }) : [];
207
+
208
+ let relaciones = patient.contact ? patient.contact.map(aContact => {
209
+ let relacion = {
210
+ relacion: {
211
+ nombre: aContact.relationship[0].text
212
+ },
213
+ nombre: aContact.name.given.join().replace(',', ' '),
214
+ apellido: aContact.name.family
215
+ };
216
+ return relacion;
217
+ }) : [];
218
+
219
+ if (patient.maritalStatus) {
220
+ let estadoCivil;
221
+ switch (patient.maritalStatus['text']) {
222
+ case 'Married':
223
+ estadoCivil = 'casado';
224
+ break;
225
+ case 'Divorced':
226
+ estadoCivil = 'divorciado';
227
+ break;
228
+ case 'Widowed':
229
+ estadoCivil = 'viudo';
230
+ break;
231
+ case 'unmarried':
232
+ estadoCivil = 'soltero';
233
+ break;
234
+ default:
235
+ estadoCivil = 'otro';
236
+ break;
237
+ }
238
+ pacienteAndes['estadoCivil'] = estadoCivil;
239
+ }
240
+
241
+ let direcciones = patient.address ? patient.address.map(unaDireccion => {
242
+ let dir = {
243
+ activo: true,
244
+ valor: unaDireccion.line,
245
+ codigoPostal: unaDireccion.postalCode,
246
+ // TODO: En un MATETIME ver si la información de pais, provincia, localidad
247
+ // se delega en el insert o update. Y este decoder sólo guarda la info tal cual viene.
248
+ ubicacion: {
249
+ pais: unaDireccion.country,
250
+ provincia: unaDireccion.state,
251
+ localidad: unaDireccion.city
252
+ }
253
+ };
254
+ return dir;
255
+ }) : [];
256
+
257
+ pacienteAndes['direccion'] = direcciones;
258
+
259
+ if (patient.active) {
260
+ pacienteAndes['activo'] = patient.active;
261
+ }
262
+ if (contactos.length > 0) {
263
+ pacienteAndes['contacto'] = contactos;
264
+ }
265
+ if (patient.photo) { // Image of the patient
266
+ pacienteAndes['foto'] = patient.photo[0].data;
267
+ }
268
+
269
+ if (patient.contact) {
270
+ pacienteAndes['relaciones'] = relaciones;
271
+ }
272
+
273
+ return pacienteAndes;
274
+ }
275
+ /**
276
+ * Verify if a patient has a FHIR format
277
+ * @param {*} patient
278
+ */
279
+ export function verify(patient) {
280
+ let respuesta = true;
281
+ let fieldVerified = Object.keys(patient).every(pacienteFHIRFields);
282
+ // Verificamos que las key esten contenidas en los conjuntos mínimos pacienteFHIRField
283
+ if (fieldVerified) {
284
+ respuesta = ('resourceType' in patient) && patient.resourceType === 'Patient';
285
+ respuesta = respuesta && ('identifier' in patient);
286
+ if (patient.identifier.length > 0) {
287
+ patient.identifier.forEach(anIdentifier => respuesta = respuesta && Object.keys(anIdentifier).every(identifierFields));
288
+
289
+ }
290
+ patient.name.forEach(aName => respuesta = respuesta && validName(aName));
291
+ if (patient.active) {
292
+ respuesta = respuesta && (typeof patient.active === 'boolean');
293
+ }
294
+ if (patient.telecom) {
295
+ patient.telecom.forEach(aTelecom => respuesta = respuesta && Object.keys(aTelecom).every(telecomFields));
296
+ }
297
+ if (patient.gender) {
298
+ respuesta = respuesta && patient.gender.match('male|female|other|unknown') != null;
299
+ }
300
+ if (patient.birthDate) {
301
+ respuesta = respuesta && typeof patient.birthDate === 'string'; // TODO: Algun control de que tenga formato Date
302
+ }
303
+ if (patient.deceasedDateTime) {
304
+ respuesta = respuesta && typeof patient.deceasedDateTime === 'string'; // TODO: Algun control de que tenga formato DateTime
305
+ }
306
+ if (patient.address) {
307
+ patient.address.forEach(anAddress => respuesta = respuesta && Object.keys(anAddress).every(addressFields));
308
+ }
309
+ if (patient.maritalStatus && patient.maritalStatus.text) {
310
+ respuesta = respuesta && Object.keys(patient.maritalStatus).every(codingFields)
311
+ && typeof patient.maritalStatus.text === 'string'
312
+ && patient.maritalStatus.text.match('Married|Divorced|Widowed|unmarried|unknown') != null;
313
+ }
314
+ if (patient.photo) {
315
+ patient.photo.forEach(aPhoto => respuesta = respuesta && Object.keys(aPhoto).every(photoFields));
316
+ }
317
+ if (patient.contact) {
318
+ patient.contact.forEach(aContact => {
319
+ if (aContact.relationship) {
320
+ aContact.relationship.forEach(aRelation => respuesta = respuesta && Object.keys(aRelation).every(codingFields));
321
+ }
322
+ if (aContact.name) {
323
+ respuesta = respuesta && validName(aContact.name);
324
+ }
325
+ });
326
+ }
327
+ } else {
328
+ respuesta = fieldVerified; // No cumple con los campos estandar de FHIR
329
+ }
330
+ return respuesta;
331
+ }
332
+
333
+ function pacienteFHIRFields(elem) {
334
+ return elem.match('resourceType|identifier|active|name|telecom|gender|birthDate|deceasedBoolean|deceasedDateTime|address|maritalStatus|photo|contact') != null;
335
+ }
336
+
337
+ function identifierFields(elem) {
338
+ return elem.match('use|type|system|value|period|assigner') != null;
339
+ }
340
+
341
+ function nameFields(elem) {
342
+ return elem.match('resourceType|family|given') != null;
343
+ }
344
+
345
+ function telecomFields(elem) {
346
+ return elem.match('resourceType|system|value|use|rank|period') != null;
347
+ }
348
+
349
+ function addressFields(elem) {
350
+ return elem.match('resourceType|use|type|text|line|city|district|state|postalCode|country|period') != null;
351
+ }
352
+
353
+ function codingFields(elem) {
354
+ return elem.match('coding|text') != null;
355
+ }
356
+
357
+ function photoFields(elem) {
358
+ return elem.match('contentType|language|data|url|size|hash|title|creation') != null;
359
+ }
360
+
361
+ function contactFields(elem) {
362
+ return elem.match('relationship|name|telecom|address|gender|organization|period') != null;
363
+ }
364
+
365
+ function validName(aName) {
366
+ return Object.keys(aName).every(nameFields) && ('resourceType' in aName) && aName.resourceType === 'HumanName' &&
367
+ ('family' in aName) && Array.isArray(aName.family) && aName.family.every(areStrings) &&
368
+ ('given' in aName) && Array.isArray(aName.given) && aName.given.every(areStrings);
369
+ }
370
+
371
+ function areStrings(elem) {
372
+ return typeof elem === 'string';
373
+ }
374
+
@@ -0,0 +1,157 @@
1
+ import { getDominio, makeUrl } from './config';
2
+
3
+ /**
4
+ * Encode a practitioner from ANDES to FHIR
5
+ * @param {} practitioner
6
+ */
7
+ export function encode(practitioner) {
8
+ let data = practitioner;
9
+ if (data) {
10
+ let identificadores = data.documento ? [{
11
+ system: 'http://www.renaper.gob.ar/dni',
12
+ value: data.documento
13
+ }] : [];
14
+ if (data.cuit) {
15
+ identificadores.push({
16
+ system: 'https://seti.afip.gob.ar/padron-puc-constancia-internet/ConsultaConstanciaAction.do',
17
+ value: data.cuit
18
+ });
19
+ }
20
+ identificadores.push({
21
+ system: getDominio(),
22
+ value: data._id
23
+ });
24
+ // Parsea contactos
25
+ let contactos = data.contacto ? data.contacto.map(unContacto => {
26
+ let cont = {
27
+ resourceType: 'ContactPoint',
28
+ value: unContacto.valor,
29
+ rank: unContacto.ranking,
30
+ };
31
+ switch (unContacto.tipo) {
32
+ case 'fijo':
33
+ cont['system'] = 'phone';
34
+ break;
35
+ case 'celular':
36
+ cont['system'] = 'phone';
37
+ break;
38
+ case 'email':
39
+ cont['system'] = 'email';
40
+ break;
41
+ }
42
+ return cont;
43
+ }) : [];
44
+ // Parsea direcciones
45
+ let direcciones = data.domicilios ? data.domicilios.map(unDomicilio => {
46
+ let direc = {
47
+ resourceType: 'Address',
48
+ postalCode: unDomicilio.codigoPostal ? unDomicilio.codigoPostal : '',
49
+ line: [unDomicilio.valor],
50
+ city: unDomicilio.ubicacion.localidad ? unDomicilio.ubicacion.localidad.nombre : '',
51
+ state: unDomicilio.ubicacion.provincia ? unDomicilio.ubicacion.provincia.nombre : '',
52
+ country: unDomicilio.ubicacion.pais ? unDomicilio.ubicacion.pais.nombre : ''
53
+ };
54
+ return direc;
55
+ }) : [];
56
+ // Parsea relaciones
57
+ let relaciones = data.relaciones ? data.relaciones.map(unaRelacion => {
58
+ let relacion = {
59
+ relationship: [{
60
+ text: unaRelacion.relacion.nombre
61
+ }],
62
+ name: {
63
+ resourceType: 'HumanName',
64
+ family: unaRelacion.apellido.split(' '),
65
+ given: unaRelacion.nombre.split(' '),
66
+ }
67
+ };
68
+ return relacion;
69
+ }) : [];
70
+ let matriculas = data.formacionGrado ? data.formacionGrado.map(datosGrado => {
71
+ let cantMatriculaciones = datosGrado.matriculacion ? datosGrado.matriculacion.length : 0;
72
+ let unaMatricula = {
73
+ identifier: datosGrado.profesion.nombre ? [{
74
+ system: 'https://www.saludneuquen.gob.ar/matriculacionGrado',
75
+ value: datosGrado.profesion.nombre
76
+ }] : [],
77
+ code: cantMatriculaciones > 0 ? {
78
+ coding: [{
79
+ system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
80
+ code: datosGrado.profesion.codigo,
81
+ display: datosGrado.profesion.tipoDeFormacion
82
+ }],
83
+ text: datosGrado.matriculacion[cantMatriculaciones - 1].matriculaNumero
84
+ } : null,
85
+ period: cantMatriculaciones > 0 ? {
86
+ start: datosGrado.matriculacion[cantMatriculaciones - 1].inicio ? datosGrado.matriculacion[cantMatriculaciones - 1].inicio : null,
87
+ end: datosGrado.matriculacion[cantMatriculaciones - 1].fin ? datosGrado.matriculacion[cantMatriculaciones - 1].fin : null
88
+ } : null
89
+ };
90
+ return unaMatricula;
91
+ }) : null;
92
+ let matriculasEspecialidad = (data.formacionPosgrado ? data.formacionPosgrado.map(datosPosgrado => {
93
+ let cantMatriculacionesEsp = datosPosgrado.matriculacion ? datosPosgrado.matriculacion.length : 0;
94
+ let unaMatricula = {
95
+ identifier: datosPosgrado.especialidad.nombre ? [{
96
+ system: 'https://www.saludneuquen.gob.ar/matriculacionEspecialidad/',
97
+ value: datosPosgrado.especialidad.nombre
98
+ }] : [],
99
+ code: cantMatriculacionesEsp > 0 ? {
100
+ coding: [{
101
+ system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
102
+ code: datosPosgrado.especialidad.codigo,
103
+ display: datosPosgrado.especialidad.tipo
104
+ }],
105
+ text: datosPosgrado.matriculacion[cantMatriculacionesEsp - 1].matriculaNumero
106
+ } : null,
107
+ period: cantMatriculacionesEsp > 0 ? {
108
+ start: datosPosgrado.matriculacion[cantMatriculacionesEsp - 1].inicio ? datosPosgrado.matriculacion[cantMatriculacionesEsp - 1].inicio : null,
109
+ end: datosPosgrado.matriculacion[cantMatriculacionesEsp - 1].fin ? datosPosgrado.matriculacion[cantMatriculacionesEsp - 1].fin : null
110
+ } : null
111
+ };
112
+ return unaMatricula;
113
+ }) : null);
114
+ let genero;
115
+ switch (data.sexo.toLowerCase()) {
116
+ case 'femenino':
117
+ genero = 'female';
118
+ break;
119
+ case 'masculino':
120
+ genero = 'male';
121
+ break;
122
+ case 'otro':
123
+ genero = 'other';
124
+ break;
125
+ }
126
+ let profesionalFHIR = {
127
+ resourceType: 'Practitioner',
128
+ identifier: identificadores,
129
+ active: data.habilitado ? data.habilitado : null,
130
+ name: [{
131
+ resourceType: 'HumanName',
132
+ family: data.apellido.split(' '),
133
+ given: data.nombre.split(' '),
134
+ }],
135
+ gender: genero,
136
+ birthDate: data.fechaNacimiento,
137
+ };
138
+ if (data.foto) {
139
+ profesionalFHIR['photo'] = [{
140
+ data: data.foto
141
+ }];
142
+ }
143
+ if (contactos.length > 0) {
144
+ profesionalFHIR['telecom'] = contactos;
145
+ }
146
+ if (direcciones.length > 0) {
147
+ profesionalFHIR['address'] = direcciones;
148
+ }
149
+ if (matriculas.length > 0) {
150
+ profesionalFHIR['qualification'] = matriculas.concat(matriculasEspecialidad);
151
+ }
152
+
153
+ return profesionalFHIR;
154
+ } else {
155
+ return null;
156
+ }
157
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "build",
6
+ "declaration": true,
7
+ "target": "es2018",
8
+ "module": "commonjs",
9
+ "moduleResolution": "node"
10
+ },
11
+ "exclude": [
12
+ "build",
13
+ "node_modules",
14
+ "coverage",
15
+ "config",
16
+ "src/**/*.story.tsx"
17
+ ]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,139 @@
1
+ {
2
+ "extends": [
3
+ "tslint-eslint-rules"
4
+ ],
5
+ "rules": {
6
+ "class-name": true,
7
+ "comment-format": [
8
+ true,
9
+ "check-space"
10
+ ],
11
+ "curly": true,
12
+ "eofline": true,
13
+ "forin": false,
14
+ "indent": [
15
+ true,
16
+ "spaces"
17
+ ],
18
+ "label-position": true,
19
+ "max-line-length": [
20
+ false,
21
+ 140
22
+ ],
23
+ "member-access": false,
24
+ "no-arg": true,
25
+ "no-bitwise": true,
26
+ "no-console": [
27
+ true
28
+ ],
29
+ "no-construct": true,
30
+ "no-debugger": true,
31
+ "no-duplicate-variable": true,
32
+ "no-empty": false,
33
+ "no-eval": true,
34
+ "no-inferrable-types": true,
35
+ "no-shadowed-variable": true,
36
+ "no-string-literal": false,
37
+ "no-switch-case-fall-through": true,
38
+ "no-trailing-whitespace": true,
39
+ "object-literal-sort-keys": false,
40
+ "one-line": [
41
+ true,
42
+ "check-open-brace",
43
+ "check-catch",
44
+ "check-else",
45
+ "check-whitespace"
46
+ ],
47
+ "quotemark": [
48
+ true,
49
+ "single"
50
+ ],
51
+ "radix": true,
52
+ "semicolon": [
53
+ true,
54
+ "always"
55
+ ],
56
+ "triple-equals": [
57
+ true,
58
+ "allow-null-check"
59
+ ],
60
+ "typedef-whitespace": [
61
+ true,
62
+ {
63
+ "call-signature": "nospace",
64
+ "index-signature": "nospace",
65
+ "parameter": "nospace",
66
+ "property-declaration": "nospace",
67
+ "variable-declaration": "nospace"
68
+ }
69
+ ],
70
+ "variable-name": false,
71
+ "whitespace": [
72
+ true,
73
+ "check-branch",
74
+ "check-decl",
75
+ "check-operator",
76
+ "check-separator",
77
+ "check-type",
78
+ "check-preblock"
79
+ ],
80
+ "object-literal-key-quotes": [
81
+ true,
82
+ "as-needed"
83
+ ],
84
+ "no-unnecessary-callback-wrapper": true,
85
+ "no-consecutive-blank-lines": [
86
+ true,
87
+ 2
88
+ ],
89
+ "align": [
90
+ true,
91
+ "parameters",
92
+ "statements",
93
+ "members"
94
+ ],
95
+ "space-before-function-paren": [
96
+ true,
97
+ {
98
+ "anonymous": "always",
99
+ "named": "never",
100
+ "asyncArrow": "always"
101
+ }
102
+ ],
103
+ "no-implicit-dependencies": [
104
+ true,
105
+ "dev"
106
+ ],
107
+ "no-unused-expression": true,
108
+ "no-var-keyword": true,
109
+ "prefer-object-spread": true,
110
+ "import-spacing": true,
111
+ "object-literal-shorthand": true,
112
+ "only-arrow-functions": [
113
+ true,
114
+ "allow-declarations",
115
+ "allow-named-functions"
116
+ ],
117
+ "ter-indent": [
118
+ true,
119
+ 4,
120
+ {
121
+ "SwitchCase": 1
122
+ }
123
+ ],
124
+ "array-bracket-spacing": [
125
+ true,
126
+ {
127
+ "singleValue": false,
128
+ "objectsInArrays": false,
129
+ "arraysInArrays": false
130
+ }
131
+ ],
132
+ "no-constant-condition": [
133
+ true,
134
+ {
135
+ "checkLoops": false
136
+ }
137
+ ]
138
+ }
139
+ }