@andes/fhir 1.12.0 → 1.12.1-beta.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 (103) hide show
  1. package/{src → dist}/data/patient.json +192 -192
  2. package/dist/{src/helpers → helpers}/patientFactory.js +35 -31
  3. package/dist/{src/lib → lib}/allergyIntolerance.js +39 -40
  4. package/dist/{src/lib → lib}/bundle.js +25 -26
  5. package/dist/{src/lib → lib}/composition.js +152 -152
  6. package/dist/{src/lib → lib}/condition.js +79 -80
  7. package/dist/{src/lib → lib}/config.js +27 -21
  8. package/dist/lib/config.test.js +19 -0
  9. package/dist/{src/lib → lib}/device.js +38 -39
  10. package/dist/lib/device.test.js +9 -0
  11. package/dist/{src/lib → lib}/document-reference.js +106 -107
  12. package/dist/{src/lib → lib}/immunization.js +67 -68
  13. package/{src/lib/medication.ts → dist/lib/medication.js} +64 -61
  14. package/{src/lib/medicationRequest.ts → dist/lib/medicationRequest.js} +103 -100
  15. package/dist/{src/lib → lib}/medicationStatement.js +55 -56
  16. package/dist/lib/organization.js +93 -0
  17. package/dist/lib/patient.js +465 -0
  18. package/dist/{src/lib → lib}/patient.test.js +132 -113
  19. package/dist/lib/practitioner.js +186 -0
  20. package/dist/types/andes/organization.types.js +2 -0
  21. package/dist/types/andes/patient.types.js +2 -0
  22. package/dist/types/andes/practitioner.types.js +3 -0
  23. package/package.json +53 -44
  24. package/.circleci/config.yml +0 -72
  25. package/.editorconfig +0 -14
  26. package/.env.example +0 -2
  27. package/.gitattributes +0 -1
  28. package/.github/CODEOWNERS +0 -1
  29. package/.github/labeler.yml +0 -11
  30. package/.github/pull_request_template.md +0 -28
  31. package/.github/workflows/build_test.yml +0 -14
  32. package/.github/workflows/has_conflicts.yml +0 -13
  33. package/.vscode/settings.json +0 -2
  34. package/CHANGELOG.md +0 -351
  35. package/coverage/clover.xml +0 -209
  36. package/coverage/coverage-final.json +0 -5
  37. package/coverage/lcov-report/base.css +0 -224
  38. package/coverage/lcov-report/block-navigation.js +0 -87
  39. package/coverage/lcov-report/config.ts.html +0 -136
  40. package/coverage/lcov-report/device.ts.html +0 -193
  41. package/coverage/lcov-report/favicon.png +0 -0
  42. package/coverage/lcov-report/helpers/index.html +0 -116
  43. package/coverage/lcov-report/helpers/patientFactory.ts.html +0 -124
  44. package/coverage/lcov-report/index.html +0 -131
  45. package/coverage/lcov-report/lib/config.ts.html +0 -136
  46. package/coverage/lcov-report/lib/device.ts.html +0 -193
  47. package/coverage/lcov-report/lib/index.html +0 -146
  48. package/coverage/lcov-report/lib/patient.ts.html +0 -1318
  49. package/coverage/lcov-report/patient.ts.html +0 -1207
  50. package/coverage/lcov-report/prettify.css +0 -1
  51. package/coverage/lcov-report/prettify.js +0 -2
  52. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  53. package/coverage/lcov-report/sorter.js +0 -210
  54. package/coverage/lcov.info +0 -425
  55. package/dist/index.js +0 -52
  56. package/dist/index.js.map +0 -1
  57. package/dist/src/data/patient.json +0 -192
  58. package/dist/src/helpers/patientFactory.js.map +0 -1
  59. package/dist/src/lib/allergyIntolerance.js.map +0 -1
  60. package/dist/src/lib/bundle.js.map +0 -1
  61. package/dist/src/lib/composition.js.map +0 -1
  62. package/dist/src/lib/condition.js.map +0 -1
  63. package/dist/src/lib/config.js.map +0 -1
  64. package/dist/src/lib/config.test.js +0 -13
  65. package/dist/src/lib/config.test.js.map +0 -1
  66. package/dist/src/lib/device.js.map +0 -1
  67. package/dist/src/lib/device.test.js +0 -10
  68. package/dist/src/lib/device.test.js.map +0 -1
  69. package/dist/src/lib/document-reference.js.map +0 -1
  70. package/dist/src/lib/immunization.js.map +0 -1
  71. package/dist/src/lib/medication.js +0 -65
  72. package/dist/src/lib/medication.js.map +0 -1
  73. package/dist/src/lib/medicationRequest.js +0 -103
  74. package/dist/src/lib/medicationRequest.js.map +0 -1
  75. package/dist/src/lib/medicationStatement.js.map +0 -1
  76. package/dist/src/lib/organization.js +0 -91
  77. package/dist/src/lib/organization.js.map +0 -1
  78. package/dist/src/lib/patient.js +0 -397
  79. package/dist/src/lib/patient.js.map +0 -1
  80. package/dist/src/lib/patient.test.js.map +0 -1
  81. package/dist/src/lib/practitioner.js +0 -161
  82. package/dist/src/lib/practitioner.js.map +0 -1
  83. package/index.ts +0 -30
  84. package/jest.config.js +0 -12
  85. package/release.config.js +0 -74
  86. package/src/helpers/patientFactory.ts +0 -13
  87. package/src/lib/allergyIntolerance.ts +0 -36
  88. package/src/lib/bundle.ts +0 -19
  89. package/src/lib/composition.ts +0 -153
  90. package/src/lib/condition.ts +0 -80
  91. package/src/lib/config.test.ts +0 -13
  92. package/src/lib/config.ts +0 -17
  93. package/src/lib/device.test.ts +0 -9
  94. package/src/lib/device.ts +0 -36
  95. package/src/lib/document-reference.ts +0 -102
  96. package/src/lib/immunization.ts +0 -64
  97. package/src/lib/medicationStatement.ts +0 -52
  98. package/src/lib/organization.ts +0 -89
  99. package/src/lib/patient.test.ts +0 -101
  100. package/src/lib/patient.ts +0 -411
  101. package/src/lib/practitioner.ts +0 -157
  102. package/tsconfig.test.json +0 -18
  103. package/tslint.json +0 -139
@@ -1,100 +1,103 @@
1
- /**
2
- * Encode medicationRequest from ANDES to FHIR
3
- * @param {} medicationRequest
4
- */
5
-
6
- import moment from 'moment';
7
-
8
- // Muy incompleto hay que mejorarlo mucho todavía
9
-
10
- export function encode(patientReference, practitionerReference, medicationFHIR, data) {
11
- return {
12
- resourceType: 'MedicationRequest',
13
- id: data.registro._id, // id de la prescripción completa
14
- text: {
15
- status: 'generated',
16
- // div: `<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion </p><p><b>meta</b>: </p><p><b>text</b>: ${'DEFINIR'}</p></div>`
17
- },
18
- contained: [
19
- medicationFHIR
20
- ],
21
- identifier: [ // Ver bien que sería el array de identifiers
22
- {
23
- use: 'official',
24
- system: 'http://app.andes.gob.ar/prescriptions', // Es el id de la prestación completa
25
- value: data.registro.id
26
- }
27
- ],
28
- // active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown
29
- status: (data.prestacion.estadoActual.tipo === 'validada') ? 'active' : 'on-hold', // Lo mejor sería enviar el estado de la receta desde la prestación
30
- // intent: proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option
31
- intent: 'order', // Ya que no tenemos este dato, ver como sería en caso de recetas prolongadas si puede ir como plan
32
- // category: {
33
- // coding: [
34
- // {
35
- // system: '',
36
- // display: '',
37
- // code: ''
38
- // }
39
- // ]
40
- // },
41
- // priority: routine | urgent | asap | stat
42
- priority: 'routine',
43
- doNotPerform: false,
44
- // Se puede usar medicationCodeableConcept o medicationReference, vamos a usar esta última.
45
- medicationReference: {
46
- reference: medicationFHIR.id,
47
- display: medicationFHIR.code.text
48
- },
49
- subject: {
50
- reference: patientReference // podría ser una reference a un group también
51
- },
52
- // encounter: Por ahora lo dejo pendiente. Podría ponerse una referencia a otra prestación o al informe del encuentro.
53
- authoredOn: moment(data.registro.createdAt).format('YYYY-MM-DD'),
54
- // requester & performer: pueden ser Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)
55
- // por el momento vamos a tomar al profesional porque no tenemos otra info en la prestación
56
- requester: {
57
- reference: practitionerReference
58
- },
59
- // performer: {
60
- // reference: practitionerReference
61
- // },
62
- // performerType: Lo dejamos pendiente
63
- // recorder: {
64
- // reference: practitionerReference
65
- // },
66
- // instantiatesCanonical: null, // ["<canonical>"], // Instantiates FHIR protocol or definition
67
- // instantiatesUri: null, // ["<uri>"], // Instantiates external protocol or definition
68
- basedOn: data.prestacion.id, // Vamos a usar el id de la prestación donde esta todo [{ Reference(CarePlan|MedicationRequest|ServiceRequest| ImmunizationRecommendation) }], // What request fulfills
69
- // groupIdentifier: null, // { Identifier }, // Composite request this is part of
70
- // courseOfTherapyType: null, // { CodeableConcept }, // Overall pattern of medication administration
71
- // insurance: null, // [{ Reference(Coverage|ClaimResponse) }], // Associated insurance coverage
72
- note: null, // De donde sacamos las notas? [{ Annotation }], // Information about the prescription
73
- dosageInstruction: null, // [{ Dosage }], // How the medication should be taken
74
- // Medication supply authorization: Hay que ver esta parte
75
- /*
76
- dispenseRequest: { // Medication supply authorization
77
- initialFill: { // First fill details
78
- quantity: { Quantity(SimpleQuantity) }, // First fill quantity
79
- duration: { Duration } // First fill duration
80
- },
81
- dispenseInterval: { Duration }, // Minimum period of time between dispenses
82
- validityPeriod: { Period }, // Time period supply is authorized for
83
- numberOfRepeatsAllowed: "<unsignedInt>", // Number of refills authorized
84
- quantity: { Quantity(SimpleQuantity) }, // Amount of medication to supply per dispense
85
- expectedSupplyDuration: { Duration }, // Number of days supply per dispense
86
- performer: { Reference(Organization) } // Intended dispenser
87
- },
88
- */
89
- substitution: { // Any restrictions on medication substitution
90
- // allowed[x]: Whether substitution is allowed or not. One of these 2:
91
- allowedBoolean: true, // <boolean>,
92
- // "allowedCodeableConcept" : { CodeableConcept },
93
- reason: null // { CodeableConcept } // Why should (not) substitution be made
94
- },
95
- priorPrescription: null, // { Reference(MedicationRequest) }, // An order/prescription that is being replaced
96
- detectedIssue: null, // [{ Reference(DetectedIssue) }], // Clinical Issue with action
97
- eventHistory: null// [{ Reference(Provenance) }]
98
- };
99
- }
100
-
1
+ "use strict";
2
+ /**
3
+ * Encode medicationRequest from ANDES to FHIR
4
+ * @param {} medicationRequest
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.encode = void 0;
11
+ const moment_1 = __importDefault(require("moment"));
12
+ // Muy incompleto hay que mejorarlo mucho todavía
13
+ function encode(patientReference, practitionerReference, medicationFHIR, data) {
14
+ return {
15
+ resourceType: 'MedicationRequest',
16
+ id: data.registro._id, // id de la prescripción completa
17
+ text: {
18
+ status: 'generated',
19
+ // div: `<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion </p><p><b>meta</b>: </p><p><b>text</b>: ${'DEFINIR'}</p></div>`
20
+ },
21
+ contained: [
22
+ medicationFHIR
23
+ ],
24
+ identifier: [
25
+ {
26
+ use: 'official',
27
+ system: 'http://app.andes.gob.ar/prescriptions', // Es el id de la prestación completa
28
+ value: data.registro.id
29
+ }
30
+ ],
31
+ // active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown
32
+ status: (data.prestacion.estadoActual.tipo === 'validada') ? 'active' : 'on-hold', // Lo mejor sería enviar el estado de la receta desde la prestación
33
+ // intent: proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option
34
+ intent: 'order', // Ya que no tenemos este dato, ver como sería en caso de recetas prolongadas si puede ir como plan
35
+ // category: {
36
+ // coding: [
37
+ // {
38
+ // system: '',
39
+ // display: '',
40
+ // code: ''
41
+ // }
42
+ // ]
43
+ // },
44
+ // priority: routine | urgent | asap | stat
45
+ priority: 'routine',
46
+ doNotPerform: false,
47
+ // Se puede usar medicationCodeableConcept o medicationReference, vamos a usar esta última.
48
+ medicationReference: {
49
+ reference: medicationFHIR.id,
50
+ display: medicationFHIR.code.text
51
+ },
52
+ subject: {
53
+ reference: patientReference // podría ser una reference a un group también
54
+ },
55
+ // encounter: Por ahora lo dejo pendiente. Podría ponerse una referencia a otra prestación o al informe del encuentro.
56
+ authoredOn: (0, moment_1.default)(data.registro.createdAt).format('YYYY-MM-DD'),
57
+ // requester & performer: pueden ser Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)
58
+ // por el momento vamos a tomar al profesional porque no tenemos otra info en la prestación
59
+ requester: {
60
+ reference: practitionerReference
61
+ },
62
+ // performer: {
63
+ // reference: practitionerReference
64
+ // },
65
+ // performerType: Lo dejamos pendiente
66
+ // recorder: {
67
+ // reference: practitionerReference
68
+ // },
69
+ // instantiatesCanonical: null, // ["<canonical>"], // Instantiates FHIR protocol or definition
70
+ // instantiatesUri: null, // ["<uri>"], // Instantiates external protocol or definition
71
+ basedOn: data.prestacion.id, // Vamos a usar el id de la prestación donde esta todo [{ Reference(CarePlan|MedicationRequest|ServiceRequest| ImmunizationRecommendation) }], // What request fulfills
72
+ // groupIdentifier: null, // { Identifier }, // Composite request this is part of
73
+ // courseOfTherapyType: null, // { CodeableConcept }, // Overall pattern of medication administration
74
+ // insurance: null, // [{ Reference(Coverage|ClaimResponse) }], // Associated insurance coverage
75
+ note: null, // De donde sacamos las notas? [{ Annotation }], // Information about the prescription
76
+ dosageInstruction: null, // [{ Dosage }], // How the medication should be taken
77
+ // Medication supply authorization: Hay que ver esta parte
78
+ /*
79
+ dispenseRequest: { // Medication supply authorization
80
+ initialFill: { // First fill details
81
+ quantity: { Quantity(SimpleQuantity) }, // First fill quantity
82
+ duration: { Duration } // First fill duration
83
+ },
84
+ dispenseInterval: { Duration }, // Minimum period of time between dispenses
85
+ validityPeriod: { Period }, // Time period supply is authorized for
86
+ numberOfRepeatsAllowed: "<unsignedInt>", // Number of refills authorized
87
+ quantity: { Quantity(SimpleQuantity) }, // Amount of medication to supply per dispense
88
+ expectedSupplyDuration: { Duration }, // Number of days supply per dispense
89
+ performer: { Reference(Organization) } // Intended dispenser
90
+ },
91
+ */
92
+ substitution: {
93
+ // allowed[x]: Whether substitution is allowed or not. One of these 2:
94
+ allowedBoolean: true, // <boolean>,
95
+ // "allowedCodeableConcept" : { CodeableConcept },
96
+ reason: null // { CodeableConcept } // Why should (not) substitution be made
97
+ },
98
+ priorPrescription: null, // { Reference(MedicationRequest) }, // An order/prescription that is being replaced
99
+ detectedIssue: null, // [{ Reference(DetectedIssue) }], // Clinical Issue with action
100
+ eventHistory: null // [{ Reference(Provenance) }]
101
+ };
102
+ }
103
+ exports.encode = encode;
@@ -1,56 +1,55 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
4
- /**
5
- * Encode de Medicamentos from ANDES to FHIR
6
- * @param {} medicationStatement
7
- */
8
- // Muy incompleto hay que mejorarlo mucho todavía
9
- function encode(patientReference, medicationReference, prestacionMedicamento) {
10
- return {
11
- resourceType: 'MedicationStatement',
12
- status: (prestacionMedicamento.valor.estado === 'activo') ? 'active' : 'inactive',
13
- id: prestacionMedicamento._id,
14
- effectiveDateTime: prestacionMedicamento.createdAt,
15
- medicationCodeableConcept: {
16
- coding: [
17
- {
18
- system: 'http://snomed.info/sct',
19
- code: prestacionMedicamento.concepto.conceptId,
20
- display: prestacionMedicamento.concepto.term
21
- }
22
- ]
23
- },
24
- meta: {
25
- profile: [
26
- 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
27
- ]
28
- },
29
- // extension: null,
30
- // identifier: '', // Business identifier, not a resource identifier
31
- subject: {
32
- reference: patientReference
33
- },
34
- medicationReference: {
35
- reference: medicationReference
36
- },
37
- // context: null, // Encounter | Episode of care (podría ser el informe del encuentro o lo que definamos que brinda más información sobre el por qué)
38
- dosage: [
39
- {
40
- text: prestacionMedicamento.valor,
41
- route: { coding: [{ system: 'http://standardterms.edqm.eu', code: prestacionMedicamento._id, display: prestacionMedicamento.nombre }] },
42
- timing: { coding: { system: 'http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation', code: 'QD', display: 'Diario' } }
43
- }
44
- ],
45
- // effectivePeriod: { // Esta parte se podría calcular entre la fecha de la prestación y la cant. de tiempo que se indica, pero hay problemas
46
- // en este registro ya que no siempre está la unidad de tiempo (dias, mes, etc) hay q ver si no es un bug.
47
- // start: '2015-03'
48
- // },
49
- text: {
50
- status: 'generated',
51
- div: `<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion </p><p><b>meta</b>: </p><p><b>text</b>: ${prestacionMedicamento.concepto.term}</p></div>`
52
- }
53
- };
54
- }
55
- exports.encode = encode;
56
- //# sourceMappingURL=medicationStatement.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encode = void 0;
4
+ /**
5
+ * Encode de Medicamentos from ANDES to FHIR
6
+ * @param {} medicationStatement
7
+ */
8
+ // Muy incompleto hay que mejorarlo mucho todavía
9
+ function encode(patientReference, medicationReference, prestacionMedicamento) {
10
+ return {
11
+ resourceType: 'MedicationStatement',
12
+ status: (prestacionMedicamento.valor.estado === 'activo') ? 'active' : 'inactive',
13
+ id: prestacionMedicamento._id, // El código de la prestación donde está el registro del contexto de porque está consumiendo el medicamento
14
+ effectiveDateTime: prestacionMedicamento.createdAt,
15
+ medicationCodeableConcept: {
16
+ coding: [
17
+ {
18
+ system: 'http://snomed.info/sct',
19
+ code: prestacionMedicamento.concepto.conceptId,
20
+ display: prestacionMedicamento.concepto.term
21
+ }
22
+ ]
23
+ },
24
+ meta: {
25
+ profile: [
26
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
27
+ ]
28
+ },
29
+ // extension: null,
30
+ // identifier: '', // Business identifier, not a resource identifier
31
+ subject: {
32
+ reference: patientReference
33
+ },
34
+ medicationReference: {
35
+ reference: medicationReference
36
+ },
37
+ // context: null, // Encounter | Episode of care (podría ser el informe del encuentro o lo que definamos que brinda más información sobre el por qué)
38
+ dosage: [
39
+ {
40
+ text: prestacionMedicamento.valor, // indicación
41
+ route: { coding: [{ system: 'http://standardterms.edqm.eu', code: prestacionMedicamento._id, display: prestacionMedicamento.nombre }] },
42
+ timing: { coding: { system: 'http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation', code: 'QD', display: 'Diario' } }
43
+ }
44
+ ],
45
+ // effectivePeriod: { // Esta parte se podría calcular entre la fecha de la prestación y la cant. de tiempo que se indica, pero hay problemas
46
+ // en este registro ya que no siempre está la unidad de tiempo (dias, mes, etc) hay q ver si no es un bug.
47
+ // start: '2015-03'
48
+ // },
49
+ text: {
50
+ status: 'generated',
51
+ div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion </p><p><b>meta</b>: </p><p><b>text</b>: ${prestacionMedicamento.concepto.term}</p></div>`
52
+ }
53
+ };
54
+ }
55
+ exports.encode = encode;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encode = void 0;
4
+ const config_1 = require("./config");
5
+ /**
6
+ * Encode an ANDES Organization to FHIR Organization
7
+ */
8
+ function encode(organization) {
9
+ const data = organization;
10
+ if (!data)
11
+ return null;
12
+ // Identificadores
13
+ const identificadores = [];
14
+ if (data.codigo?.sisa) {
15
+ identificadores.push({
16
+ system: 'andes.gob.ar/sisa',
17
+ value: data.codigo.sisa
18
+ });
19
+ }
20
+ if (data.codigo?.cuie) {
21
+ identificadores.push({
22
+ system: 'andes.gob.ar/cuie',
23
+ value: data.codigo.cuie
24
+ });
25
+ }
26
+ if (data.codigo?.remediar) {
27
+ identificadores.push({
28
+ system: 'andes.gob.ar/remediar',
29
+ value: data.codigo.remediar
30
+ });
31
+ }
32
+ if (data.codigo?.sips) {
33
+ identificadores.push({
34
+ system: 'andes.gob.ar/sips',
35
+ value: data.codigo.sips
36
+ });
37
+ }
38
+ identificadores.push({
39
+ system: (0, config_1.makeUrl)('Organization'),
40
+ value: data._id ?? data.id
41
+ });
42
+ // Contactos → telecom
43
+ const contactos = (data.contacto ?? [])
44
+ .map((item) => {
45
+ const cp = {
46
+ value: item.valor,
47
+ rank: item.ranking
48
+ };
49
+ switch (item.tipo) {
50
+ case 'fijo':
51
+ case 'celular':
52
+ cp.system = 'phone';
53
+ break;
54
+ case 'email':
55
+ cp.system = 'email';
56
+ break;
57
+ }
58
+ return cp;
59
+ });
60
+ // Dirección → address
61
+ const direcciones = [];
62
+ if (data.direccion) {
63
+ const dir = data.direccion;
64
+ direcciones.push({
65
+ postalCode: dir.codigoPostal ?? '',
66
+ line: [dir.valor],
67
+ city: dir.ubicacion?.localidad?.nombre ?? '',
68
+ state: dir.ubicacion?.provincia?.nombre ?? '',
69
+ country: dir.ubicacion?.pais?.nombre ?? ''
70
+ });
71
+ }
72
+ // Organización FHIR
73
+ const organizacionFHIR = {
74
+ resourceType: 'Organization',
75
+ id: data._id ?? data.id,
76
+ identifier: identificadores,
77
+ active: data.activo ?? undefined,
78
+ name: data.nombre ?? undefined,
79
+ type: data.tipoEstablecimiento
80
+ ? [{
81
+ text: data.tipoEstablecimiento.nombre
82
+ }]
83
+ : undefined
84
+ };
85
+ if (contactos.length > 0) {
86
+ organizacionFHIR.telecom = contactos;
87
+ }
88
+ if (direcciones.length > 0) {
89
+ organizacionFHIR.address = direcciones;
90
+ }
91
+ return organizacionFHIR;
92
+ }
93
+ exports.encode = encode;