@andes/fhir 1.12.0 → 1.12.1-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.
Files changed (127) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +2 -2
  3. package/{src → dist}/data/patient.json +192 -192
  4. package/dist/helpers/patientFactory.d.ts +26 -0
  5. package/dist/{src/helpers → helpers}/patientFactory.js +35 -31
  6. package/dist/index.d.ts +15 -0
  7. package/dist/index.js +55 -52
  8. package/dist/lib/allergyIntolerance.d.ts +29 -0
  9. package/dist/{src/lib → lib}/allergyIntolerance.js +39 -40
  10. package/dist/lib/bundle.d.ts +14 -0
  11. package/dist/{src/lib → lib}/bundle.js +25 -26
  12. package/dist/lib/composition.d.ts +47 -0
  13. package/dist/{src/lib → lib}/composition.js +152 -152
  14. package/dist/lib/condition.d.ts +53 -0
  15. package/dist/{src/lib → lib}/condition.js +79 -80
  16. package/dist/lib/config.d.ts +9 -0
  17. package/dist/{src/lib → lib}/config.js +27 -21
  18. package/dist/lib/config.test.d.ts +1 -0
  19. package/dist/lib/config.test.js +19 -0
  20. package/dist/lib/device.d.ts +22 -0
  21. package/dist/{src/lib → lib}/device.js +38 -39
  22. package/dist/lib/device.test.d.ts +1 -0
  23. package/dist/lib/device.test.js +9 -0
  24. package/dist/lib/document-reference.d.ts +71 -0
  25. package/dist/{src/lib → lib}/document-reference.js +106 -107
  26. package/dist/lib/immunization.d.ts +44 -0
  27. package/dist/{src/lib → lib}/immunization.js +67 -68
  28. package/dist/lib/medication.d.ts +25 -0
  29. package/{src/lib/medication.ts → dist/lib/medication.js} +64 -61
  30. package/dist/lib/medicationRequest.d.ts +42 -0
  31. package/{src/lib/medicationRequest.ts → dist/lib/medicationRequest.js} +103 -100
  32. package/dist/lib/medicationStatement.d.ts +47 -0
  33. package/dist/{src/lib → lib}/medicationStatement.js +55 -56
  34. package/dist/lib/organization.d.ts +6 -0
  35. package/dist/lib/organization.js +93 -0
  36. package/dist/lib/patient.d.ts +14 -0
  37. package/dist/lib/patient.js +465 -0
  38. package/dist/lib/patient.test.d.ts +1 -0
  39. package/dist/{src/lib → lib}/patient.test.js +132 -113
  40. package/dist/lib/practitioner.d.ts +6 -0
  41. package/dist/lib/practitioner.js +186 -0
  42. package/dist/types/andes/organization.types.d.ts +39 -0
  43. package/dist/types/andes/organization.types.js +2 -0
  44. package/dist/types/andes/patient.types.d.ts +57 -0
  45. package/dist/types/andes/patient.types.js +2 -0
  46. package/dist/types/andes/practitioner.types.d.ts +72 -0
  47. package/dist/types/andes/practitioner.types.js +3 -0
  48. package/package.json +56 -45
  49. package/.circleci/config.yml +0 -72
  50. package/.editorconfig +0 -14
  51. package/.env.example +0 -2
  52. package/.gitattributes +0 -1
  53. package/.github/CODEOWNERS +0 -1
  54. package/.github/labeler.yml +0 -11
  55. package/.github/pull_request_template.md +0 -28
  56. package/.github/workflows/build_test.yml +0 -14
  57. package/.github/workflows/has_conflicts.yml +0 -13
  58. package/.vscode/settings.json +0 -2
  59. package/CHANGELOG.md +0 -351
  60. package/coverage/clover.xml +0 -209
  61. package/coverage/coverage-final.json +0 -5
  62. package/coverage/lcov-report/base.css +0 -224
  63. package/coverage/lcov-report/block-navigation.js +0 -87
  64. package/coverage/lcov-report/config.ts.html +0 -136
  65. package/coverage/lcov-report/device.ts.html +0 -193
  66. package/coverage/lcov-report/favicon.png +0 -0
  67. package/coverage/lcov-report/helpers/index.html +0 -116
  68. package/coverage/lcov-report/helpers/patientFactory.ts.html +0 -124
  69. package/coverage/lcov-report/index.html +0 -131
  70. package/coverage/lcov-report/lib/config.ts.html +0 -136
  71. package/coverage/lcov-report/lib/device.ts.html +0 -193
  72. package/coverage/lcov-report/lib/index.html +0 -146
  73. package/coverage/lcov-report/lib/patient.ts.html +0 -1318
  74. package/coverage/lcov-report/patient.ts.html +0 -1207
  75. package/coverage/lcov-report/prettify.css +0 -1
  76. package/coverage/lcov-report/prettify.js +0 -2
  77. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  78. package/coverage/lcov-report/sorter.js +0 -210
  79. package/coverage/lcov.info +0 -425
  80. package/dist/index.js.map +0 -1
  81. package/dist/src/data/patient.json +0 -192
  82. package/dist/src/helpers/patientFactory.js.map +0 -1
  83. package/dist/src/lib/allergyIntolerance.js.map +0 -1
  84. package/dist/src/lib/bundle.js.map +0 -1
  85. package/dist/src/lib/composition.js.map +0 -1
  86. package/dist/src/lib/condition.js.map +0 -1
  87. package/dist/src/lib/config.js.map +0 -1
  88. package/dist/src/lib/config.test.js +0 -13
  89. package/dist/src/lib/config.test.js.map +0 -1
  90. package/dist/src/lib/device.js.map +0 -1
  91. package/dist/src/lib/device.test.js +0 -10
  92. package/dist/src/lib/device.test.js.map +0 -1
  93. package/dist/src/lib/document-reference.js.map +0 -1
  94. package/dist/src/lib/immunization.js.map +0 -1
  95. package/dist/src/lib/medication.js +0 -65
  96. package/dist/src/lib/medication.js.map +0 -1
  97. package/dist/src/lib/medicationRequest.js +0 -103
  98. package/dist/src/lib/medicationRequest.js.map +0 -1
  99. package/dist/src/lib/medicationStatement.js.map +0 -1
  100. package/dist/src/lib/organization.js +0 -91
  101. package/dist/src/lib/organization.js.map +0 -1
  102. package/dist/src/lib/patient.js +0 -397
  103. package/dist/src/lib/patient.js.map +0 -1
  104. package/dist/src/lib/patient.test.js.map +0 -1
  105. package/dist/src/lib/practitioner.js +0 -161
  106. package/dist/src/lib/practitioner.js.map +0 -1
  107. package/index.ts +0 -30
  108. package/jest.config.js +0 -12
  109. package/release.config.js +0 -74
  110. package/src/helpers/patientFactory.ts +0 -13
  111. package/src/lib/allergyIntolerance.ts +0 -36
  112. package/src/lib/bundle.ts +0 -19
  113. package/src/lib/composition.ts +0 -153
  114. package/src/lib/condition.ts +0 -80
  115. package/src/lib/config.test.ts +0 -13
  116. package/src/lib/config.ts +0 -17
  117. package/src/lib/device.test.ts +0 -9
  118. package/src/lib/device.ts +0 -36
  119. package/src/lib/document-reference.ts +0 -102
  120. package/src/lib/immunization.ts +0 -64
  121. package/src/lib/medicationStatement.ts +0 -52
  122. package/src/lib/organization.ts +0 -89
  123. package/src/lib/patient.test.ts +0 -101
  124. package/src/lib/patient.ts +0 -411
  125. package/src/lib/practitioner.ts +0 -157
  126. package/tsconfig.test.json +0 -18
  127. package/tslint.json +0 -139
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Encode de Vacunas Nomivac from ANDES to FHIR
3
+ * @param {} nomivac
4
+ * [ASK] El code de extension puede ir en vaccineCode?
5
+ * [ASk] Location no se sabe. Solo esta el texto
6
+ */
7
+ export declare function encode(patientReference: any, nomivac: any): {
8
+ resourceType: string;
9
+ id: any;
10
+ extension: {
11
+ url: string;
12
+ valueCoding: {
13
+ system: string;
14
+ code: string;
15
+ display: any;
16
+ };
17
+ }[];
18
+ status: string;
19
+ notGiven: boolean;
20
+ vaccineCode: {
21
+ coding: {
22
+ system: string;
23
+ code: any;
24
+ display: any;
25
+ }[];
26
+ };
27
+ patient: {
28
+ reference: any;
29
+ };
30
+ date: any;
31
+ primarySource: boolean;
32
+ location: {
33
+ reference: string;
34
+ };
35
+ vaccinationProtocol: {
36
+ doseSequence: number;
37
+ doseStatus: {
38
+ coding: {
39
+ system: string;
40
+ code: any;
41
+ }[];
42
+ };
43
+ }[];
44
+ };
@@ -1,68 +1,67 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = void 0;
4
- /**
5
- * Encode de Vacunas Nomivac from ANDES to FHIR
6
- * @param {} nomivac
7
- * [ASK] El code de extension puede ir en vaccineCode?
8
- * [ASk] Location no se sabe. Solo esta el texto
9
- */
10
- function encode(patientReference, nomivac) {
11
- return {
12
- resourceType: 'Immunization',
13
- id: nomivac.idvacuna,
14
- extension: [
15
- {
16
- url: 'http://sisa/fhir/esquema',
17
- valueCoding: {
18
- system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
19
- code: '0',
20
- display: nomivac.vacuna
21
- }
22
- },
23
- {
24
- url: 'http://sisa/fhir/condicionAplicacion',
25
- valueCoding: {
26
- system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
27
- code: '17',
28
- display: 'Personal de Salud'
29
- }
30
- }
31
- ],
32
- status: 'completed',
33
- notGiven: false,
34
- vaccineCode: {
35
- coding: [
36
- {
37
- system: 'https://snomed.info/sct/11000221109/id/228100022110',
38
- code: nomivac.idvacuna,
39
- display: nomivac.vacuna
40
- }
41
- ]
42
- },
43
- patient: {
44
- reference: patientReference
45
- },
46
- date: nomivac.fechaAplicacion,
47
- primarySource: false,
48
- location: {
49
- reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
50
- },
51
- // lotNumber: null,
52
- vaccinationProtocol: [
53
- {
54
- doseSequence: 1,
55
- doseStatus: {
56
- coding: [
57
- {
58
- system: 'http://hl7.org/fhir/vaccination-protocol-dose-status',
59
- code: nomivac.dosis
60
- }
61
- ]
62
- }
63
- }
64
- ]
65
- };
66
- }
67
- exports.encode = encode;
68
- //# sourceMappingURL=immunization.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encode = void 0;
4
+ /**
5
+ * Encode de Vacunas Nomivac from ANDES to FHIR
6
+ * @param {} nomivac
7
+ * [ASK] El code de extension puede ir en vaccineCode?
8
+ * [ASk] Location no se sabe. Solo esta el texto
9
+ */
10
+ function encode(patientReference, nomivac) {
11
+ return {
12
+ resourceType: 'Immunization',
13
+ id: nomivac.idvacuna,
14
+ extension: [
15
+ {
16
+ url: 'http://sisa/fhir/esquema',
17
+ valueCoding: {
18
+ system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
19
+ code: '0', // [TODO] Ver que code ponemos acá
20
+ display: nomivac.vacuna
21
+ }
22
+ },
23
+ {
24
+ url: 'http://sisa/fhir/condicionAplicacion',
25
+ valueCoding: {
26
+ system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
27
+ code: '17',
28
+ display: 'Personal de Salud'
29
+ }
30
+ }
31
+ ],
32
+ status: 'completed',
33
+ notGiven: false,
34
+ vaccineCode: {
35
+ coding: [
36
+ {
37
+ system: 'https://snomed.info/sct/11000221109/id/228100022110',
38
+ code: nomivac.idvacuna,
39
+ display: nomivac.vacuna
40
+ }
41
+ ]
42
+ },
43
+ patient: {
44
+ reference: patientReference
45
+ },
46
+ date: nomivac.fechaAplicacion,
47
+ primarySource: false,
48
+ location: {
49
+ reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
50
+ },
51
+ // lotNumber: null,
52
+ vaccinationProtocol: [
53
+ {
54
+ doseSequence: 1,
55
+ doseStatus: {
56
+ coding: [
57
+ {
58
+ system: 'http://hl7.org/fhir/vaccination-protocol-dose-status',
59
+ code: nomivac.dosis
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ ]
65
+ };
66
+ }
67
+ exports.encode = encode;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Encode de Medicamentos from ANDES to FHIR
3
+ * @param {} medication
4
+ */
5
+ export declare function encode(medication: any): {
6
+ resourceType: string;
7
+ id: any;
8
+ meta: {
9
+ profile: string[];
10
+ };
11
+ identifier: any;
12
+ code: {
13
+ coding: {
14
+ system: string;
15
+ display: any;
16
+ code: any;
17
+ }[];
18
+ text: any;
19
+ };
20
+ status: string;
21
+ text: {
22
+ status: string;
23
+ div: string;
24
+ };
25
+ };
@@ -1,61 +1,64 @@
1
- /**
2
- * Encode de Medicamentos from ANDES to FHIR
3
- * @param {} medication
4
- */
5
- export function encode(medication) {
6
- // Falta completar con más detalle
7
- return {
8
- resourceType: 'Medication',
9
- id: medication.conceptId, // Es el id del medicamento, en este caso usamos el código de snomed (ver si sería correcto)
10
- meta: {
11
- profile: [
12
- 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
13
- ]
14
- },
15
- identifier: medication.moduleId, // Acá va el serial number del medicamento.
16
- code: {
17
- coding: [
18
- {
19
- system: 'http://snomed.info/sct',
20
- display: medication.term,
21
- code: medication.conceptId
22
- }
23
- ],
24
- text: medication.fsn
25
- },
26
- status: medication.active === true ? 'active' : 'inactive',
27
- // manufacturer: null,
28
- // form: null,
29
- // amount: null,
30
- // ingredient: null,
31
- // ingredient: [ // ejemplo
32
- // {
33
- // code: {
34
- // coding: [
35
- // {
36
- // system: "http://snomed.info/sct",
37
- // display: "salbutamol (sustancia)",
38
- // code: "372897005"
39
- // }
40
- // ]
41
- // },
42
- // isActive: true,
43
- // strength: {
44
- // numerator: {
45
- // value: 200,
46
- // unit: "mcg"
47
- // },
48
- // denominator: {
49
- // value: 1,
50
- // unit: "disparo"
51
- // }
52
- // }
53
- // }
54
- // ],
55
- text: {
56
- status: 'generated',
57
- 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>: ${medication.pt.term}</p></div>`
58
- }
59
- };
60
- }
61
-
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 {} medication
7
+ */
8
+ function encode(medication) {
9
+ // Falta completar con más detalle
10
+ return {
11
+ resourceType: 'Medication',
12
+ id: medication.conceptId, // Es el id del medicamento, en este caso usamos el código de snomed (ver si sería correcto)
13
+ meta: {
14
+ profile: [
15
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
16
+ ]
17
+ },
18
+ identifier: medication.moduleId, // Acá va el serial number del medicamento.
19
+ code: {
20
+ coding: [
21
+ {
22
+ system: 'http://snomed.info/sct',
23
+ display: medication.term,
24
+ code: medication.conceptId
25
+ }
26
+ ],
27
+ text: medication.fsn
28
+ },
29
+ status: medication.active === true ? 'active' : 'inactive',
30
+ // manufacturer: null,
31
+ // form: null,
32
+ // amount: null,
33
+ // ingredient: null,
34
+ // ingredient: [ // ejemplo
35
+ // {
36
+ // code: {
37
+ // coding: [
38
+ // {
39
+ // system: "http://snomed.info/sct",
40
+ // display: "salbutamol (sustancia)",
41
+ // code: "372897005"
42
+ // }
43
+ // ]
44
+ // },
45
+ // isActive: true,
46
+ // strength: {
47
+ // numerator: {
48
+ // value: 200,
49
+ // unit: "mcg"
50
+ // },
51
+ // denominator: {
52
+ // value: 1,
53
+ // unit: "disparo"
54
+ // }
55
+ // }
56
+ // }
57
+ // ],
58
+ text: {
59
+ status: 'generated',
60
+ 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>: ${medication.pt.term}</p></div>`
61
+ }
62
+ };
63
+ }
64
+ exports.encode = encode;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Encode medicationRequest from ANDES to FHIR
3
+ * @param {} medicationRequest
4
+ */
5
+ export declare function encode(patientReference: any, practitionerReference: any, medicationFHIR: any, data: any): {
6
+ resourceType: string;
7
+ id: any;
8
+ text: {
9
+ status: string;
10
+ };
11
+ contained: any[];
12
+ identifier: {
13
+ use: string;
14
+ system: string;
15
+ value: any;
16
+ }[];
17
+ status: string;
18
+ intent: string;
19
+ priority: string;
20
+ doNotPerform: boolean;
21
+ medicationReference: {
22
+ reference: any;
23
+ display: any;
24
+ };
25
+ subject: {
26
+ reference: any;
27
+ };
28
+ authoredOn: string;
29
+ requester: {
30
+ reference: any;
31
+ };
32
+ basedOn: any;
33
+ note: null;
34
+ dosageInstruction: null;
35
+ substitution: {
36
+ allowedBoolean: boolean;
37
+ reason: null;
38
+ };
39
+ priorPrescription: null;
40
+ detectedIssue: null;
41
+ eventHistory: null;
42
+ };
@@ -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;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Encode de Medicamentos from ANDES to FHIR
3
+ * @param {} medicationStatement
4
+ */
5
+ export declare function encode(patientReference: any, medicationReference: any, prestacionMedicamento: any): {
6
+ resourceType: string;
7
+ status: string;
8
+ id: any;
9
+ effectiveDateTime: any;
10
+ medicationCodeableConcept: {
11
+ coding: {
12
+ system: string;
13
+ code: any;
14
+ display: any;
15
+ }[];
16
+ };
17
+ meta: {
18
+ profile: string[];
19
+ };
20
+ subject: {
21
+ reference: any;
22
+ };
23
+ medicationReference: {
24
+ reference: any;
25
+ };
26
+ dosage: {
27
+ text: any;
28
+ route: {
29
+ coding: {
30
+ system: string;
31
+ code: any;
32
+ display: any;
33
+ }[];
34
+ };
35
+ timing: {
36
+ coding: {
37
+ system: string;
38
+ code: string;
39
+ display: string;
40
+ };
41
+ };
42
+ }[];
43
+ text: {
44
+ status: string;
45
+ div: string;
46
+ };
47
+ };