@metriport/commonwell-cert-runner 2.3.2 → 2.3.3

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 (57) hide show
  1. package/package.json +2 -2
  2. package/dist/document-consumption.d.ts +0 -16
  3. package/dist/document-consumption.d.ts.map +0 -1
  4. package/dist/document-consumption.js +0 -85
  5. package/dist/document-consumption.js.map +0 -1
  6. package/dist/document-contribution.d.ts +0 -12
  7. package/dist/document-contribution.d.ts.map +0 -1
  8. package/dist/document-contribution.js +0 -514
  9. package/dist/document-contribution.js.map +0 -1
  10. package/dist/issues/issue425-strong-id-on-link.d.ts +0 -7
  11. package/dist/issues/issue425-strong-id-on-link.d.ts.map +0 -1
  12. package/dist/issues/issue425-strong-id-on-link.js +0 -125
  13. package/dist/issues/issue425-strong-id-on-link.js.map +0 -1
  14. package/dist/link-management.d.ts +0 -7
  15. package/dist/link-management.d.ts.map +0 -1
  16. package/dist/link-management.js +0 -47
  17. package/dist/link-management.js.map +0 -1
  18. package/dist/org-management.d.ts +0 -7
  19. package/dist/org-management.d.ts.map +0 -1
  20. package/dist/org-management.js +0 -47
  21. package/dist/org-management.js.map +0 -1
  22. package/dist/patient-management.d.ts +0 -8
  23. package/dist/patient-management.d.ts.map +0 -1
  24. package/dist/patient-management.js +0 -91
  25. package/dist/patient-management.js.map +0 -1
  26. package/dist/payloads/patient-carin.d.ts +0 -3
  27. package/dist/payloads/patient-carin.d.ts.map +0 -1
  28. package/dist/payloads/patient-carin.js +0 -34
  29. package/dist/payloads/patient-carin.js.map +0 -1
  30. package/dist/payloads/patient-crane.d.ts +0 -3
  31. package/dist/payloads/patient-crane.d.ts.map +0 -1
  32. package/dist/payloads/patient-crane.js +0 -31
  33. package/dist/payloads/patient-crane.js.map +0 -1
  34. package/dist/person-management.d.ts +0 -7
  35. package/dist/person-management.d.ts.map +0 -1
  36. package/dist/person-management.js +0 -94
  37. package/dist/person-management.js.map +0 -1
  38. package/dist/shared-person.d.ts +0 -35
  39. package/dist/shared-person.d.ts.map +0 -1
  40. package/dist/shared-person.js +0 -78
  41. package/dist/shared-person.js.map +0 -1
  42. package/dist/single-commands/create-patient.d.ts +0 -5
  43. package/dist/single-commands/create-patient.d.ts.map +0 -1
  44. package/dist/single-commands/create-patient.js +0 -56
  45. package/dist/single-commands/create-patient.js.map +0 -1
  46. package/dist/single-commands/delete-patient.d.ts +0 -5
  47. package/dist/single-commands/delete-patient.d.ts.map +0 -1
  48. package/dist/single-commands/delete-patient.js +0 -51
  49. package/dist/single-commands/delete-patient.js.map +0 -1
  50. package/dist/single-commands/get-patient-links.d.ts +0 -5
  51. package/dist/single-commands/get-patient-links.d.ts.map +0 -1
  52. package/dist/single-commands/get-patient-links.js +0 -52
  53. package/dist/single-commands/get-patient-links.js.map +0 -1
  54. package/dist/single-commands/get-patient.d.ts +0 -5
  55. package/dist/single-commands/get-patient.d.ts.map +0 -1
  56. package/dist/single-commands/get-patient.js +0 -52
  57. package/dist/single-commands/get-patient.js.map +0 -1
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
- export declare function patientLinksWithStrongIds(
4
- commonWell: CommonWell,
5
- queryMeta: RequestMetadata
6
- ): Promise<void>;
7
- //# sourceMappingURL=issue425-strong-id-on-link.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issue425-strong-id-on-link.d.ts","sourceRoot":"","sources":["../../src/issues/issue425-strong-id-on-link.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,UAAU,EAGV,eAAe,EAEhB,MAAM,2BAA2B,CAAC;AA6CnC,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,eAAe,iBAU3B"}
@@ -1,125 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.patientLinksWithStrongIds = void 0;
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
- /* eslint-disable @typescript-eslint/no-unused-vars */
7
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
8
- const payloads_1 = require("../payloads");
9
- // TODO add CW case number and rename this file accodingly
10
- /**
11
- * This code runs logic to show an issue at the Commonwell API, related to adding strong IDs on patient links.
12
- *
13
- * Import the `patientLinksWithStrongIds` function on the cert runner and comment out the other tests/functions.
14
- *
15
- * Issue @ Metriport: https://github.com/metriport/metriport-internal/issues/425
16
- * Issue @ Commonwell: ???
17
- */
18
- // https://generatormr.com/
19
- const driversLicense = {
20
- system: "urn:oid:2.16.840.1.113883.4.3.6",
21
- key: "498651177",
22
- };
23
- // https://generatormr.com/
24
- const passport = {
25
- // Generic
26
- // system: "urn:oid:2.16.840.1.113883.4.330",
27
- // USA
28
- system: "urn:oid:2.16.840.1.113883.4.330.840",
29
- key: "515823867",
30
- // use: IdentifierUseCodes.official,
31
- // key: driversLicenseId,
32
- // system: caDriversLicenseUri,
33
- // period: {
34
- // start: "2020-05-21",
35
- // end: "2030-05-20",
36
- // },
37
- };
38
- // https://generatormr.com/
39
- const ssn = {
40
- system: "urn:oid:2.16.840.1.113883.4.1",
41
- key: "825-30-4344",
42
- };
43
- // https://codepen.io/dormenog/pen/bqYYzM
44
- const medicare = {
45
- system: "urn:oid:2.16.840.1.113883.4.572",
46
- key: "125819RL",
47
- };
48
- async function patientLinksWithStrongIds(commonWell, queryMeta) {
49
- console.log(`\n>>>>>>>>>>>> Running w/ Drivers License`);
50
- await runWith(driversLicense, commonWell, queryMeta);
51
- console.log(`\n>>>>>>>>>>>> Running w/ SSN`);
52
- await runWith(ssn, commonWell, queryMeta);
53
- console.log(`\n>>>>>>>>>>>> Running w/ Passport`);
54
- await runWith(passport, commonWell, queryMeta);
55
- console.log(`\n>>>>>>>>>>>> Running w/ Medicare`);
56
- await runWith(medicare, commonWell, queryMeta);
57
- }
58
- exports.patientLinksWithStrongIds = patientLinksWithStrongIds;
59
- async function runWith(id, commonWell, queryMeta) {
60
- let personId;
61
- try {
62
- console.log(`>>> Enroll a Person with a Strong ID`);
63
- const respEnrollPerson = await commonWell.enrollPerson(queryMeta, {
64
- ...payloads_1.personStrongId,
65
- details: {
66
- ...payloads_1.personStrongId.details,
67
- identifier: [id],
68
- },
69
- });
70
- // console.log(respEnrollPerson);
71
- console.log(`>>> Enroll a Person with a Strong ID OK`);
72
- personId = (0, commonwell_sdk_1.getId)(respEnrollPerson);
73
- if (!personId)
74
- throw new Error(`Person ID not found in response to enrollPerson`);
75
- }
76
- catch (err) {
77
- console.log(`___ ERROR enrolling person (CW-Ref: ${commonWell.lastReferenceHeader}): ${getMessage(err)}`);
78
- console.log(`___ ID: ${JSON.stringify(id, null, 2)}`);
79
- return;
80
- }
81
- try {
82
- console.log(`>>> Register a Patient`);
83
- const patient = (0, payloads_1.makePatient)({ facilityId: commonWell.oid });
84
- const respRegPatient = await commonWell.registerPatient(queryMeta, {
85
- ...patient,
86
- details: {
87
- ...patient.details,
88
- identifier: [id],
89
- },
90
- });
91
- const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(respRegPatient);
92
- if (!patientId)
93
- throw new Error(`Patient ID not found in response of registerPatient`);
94
- const referenceLink = respRegPatient._links?.self.href;
95
- if (!referenceLink)
96
- throw new Error(`Patient reference link not found in response of registerPatient`);
97
- console.log(`>>> Register a Patient OK`);
98
- try {
99
- console.log(`>>> Create patient link w/ strong ID`);
100
- await commonWell.addPatientLink(queryMeta, personId, referenceLink, id);
101
- console.log(`>>> Create patient link w/ strong ID OK`);
102
- }
103
- catch (err) {
104
- console.log(`___ ERROR linking (CW-Ref: ${commonWell.lastReferenceHeader}): ${getMessage(err)}`);
105
- console.log(`___ ID: ${JSON.stringify(id, null, 2)}`);
106
- }
107
- finally {
108
- console.log(`>>> Delete the Patient`);
109
- await commonWell.deletePatient(queryMeta, patientId);
110
- console.log(`>>> Delete the Patient OK`);
111
- }
112
- }
113
- finally {
114
- console.log(`>>> Unenroll the Person`);
115
- await commonWell.unenrollPerson(queryMeta, personId);
116
- console.log(`>>> Unenroll the Person OK`);
117
- console.log(`>>> Delete the Person`);
118
- await commonWell.deletePerson(queryMeta, personId);
119
- console.log(`>>> Delete the Person OK`);
120
- }
121
- }
122
- function getMessage(error) {
123
- return error.response?.data?.message ?? error.message;
124
- }
125
- //# sourceMappingURL=issue425-strong-id-on-link.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issue425-strong-id-on-link.js","sourceRoot":"","sources":["../../src/issues/issue425-strong-id-on-link.ts"],"names":[],"mappings":";;;;AACA,uDAAuD;AACvD,sDAAsD;AACtD,8DAMmC;AAEnC,0CAA0D;AAE1D,0DAA0D;AAC1D;;;;;;;GAOG;AAEH,2BAA2B;AAC3B,MAAM,cAAc,GAAa;IAC/B,MAAM,EAAE,iCAAiC;IACzC,GAAG,EAAE,WAAW;CACjB,CAAC;AACF,2BAA2B;AAC3B,MAAM,QAAQ,GAAa;IACzB,UAAU;IACV,6CAA6C;IAC7C,MAAM;IACN,MAAM,EAAE,qCAAqC;IAC7C,GAAG,EAAE,WAAW;IAChB,oCAAoC;IACpC,yBAAyB;IACzB,+BAA+B;IAC/B,YAAY;IACZ,yBAAyB;IACzB,uBAAuB;IACvB,KAAK;CACN,CAAC;AACF,2BAA2B;AAC3B,MAAM,GAAG,GAAa;IACpB,MAAM,EAAE,+BAA+B;IACvC,GAAG,EAAE,aAAa;CACnB,CAAC;AACF,yCAAyC;AACzC,MAAM,QAAQ,GAAa;IACzB,MAAM,EAAE,iCAAiC;IACzC,GAAG,EAAE,UAAU;CAChB,CAAC;AAEK,KAAK,UAAU,yBAAyB,CAC7C,UAAsB,EACtB,SAA0B;IAE1B,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IACzD,MAAM,OAAO,CAAC,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAC7C,MAAM,OAAO,CAAC,GAAG,E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G,CAAC,yBAAyB,CAAC,CAAC;QACvC,MAAM,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAE1C,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACrC,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;KACzC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;AACxD,CAAC"}
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
- export declare function linkManagement(
4
- commonWell: CommonWell,
5
- queryMeta: RequestMetadata
6
- ): Promise<void>;
7
- //# sourceMappingURL=link-management.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link-management.d.ts","sourceRoot":"","sources":["../src/link-management.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAA6B,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAOnG,wBAAsB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,iBA4CtF"}
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.linkManagement = void 0;
5
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
6
- const payloads_1 = require("./payloads");
7
- // 3. Link Management
8
- // https://commonwellalliance.sharepoint.com/sites/ServiceAdopter/SitePages/Patient-Management-(PIX,-REST).aspx
9
- async function linkManagement(commonWell, queryMeta) {
10
- // C5: Levels of Link Assurance
11
- console.log(`>>> C5a : Link a Patient to a Person upgrading from LOLA 1 to LOLA 2.`);
12
- const person = await commonWell.enrollPerson(queryMeta, payloads_1.personStrongId);
13
- const personId = (0, commonwell_sdk_1.getId)(person);
14
- if (!personId)
15
- throw new Error("No personId on response from enrollPerson");
16
- const respPatient = await commonWell.registerPatient(queryMeta, (0, payloads_1.makePatient)({ facilityId: commonWell.oid }));
17
- const patientUri = respPatient._links?.self.href;
18
- if (!patientUri)
19
- throw new Error("No patientUri on response from registerPatient");
20
- const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(respPatient);
21
- if (!patientId)
22
- throw new Error("No patientId on response from registerPatient");
23
- const referenceLink = respPatient._links?.self.href;
24
- if (!referenceLink)
25
- throw new Error("No referenceLink on response from registerPatient");
26
- const respC5a = await commonWell.addPatientLink(queryMeta, personId, referenceLink);
27
- console.log(respC5a);
28
- const patientLinkUri = respC5a._links?.self?.href;
29
- if (!patientLinkUri)
30
- throw new Error("No patientLinkUri on response from addPatientLink");
31
- console.log(`>>> C5b : Upgrade Patient link from LOLA 2 to LOLA 3 (with Strong ID).`);
32
- const respC5b = await commonWell.updatePatientLink(queryMeta, patientLinkUri, patientUri, payloads_1.identifier);
33
- console.log(respC5b);
34
- console.log(`>>> C5c : Downgrade Patient link from LOLA 3 to LOLA 2 (without Strong ID).`);
35
- const respC5c = await commonWell.updatePatientLink(queryMeta, patientLinkUri, patientUri);
36
- console.log(respC5c);
37
- const patientLinkFromUpdate = respC5c._links?.self.href;
38
- if (!patientLinkFromUpdate)
39
- throw new Error("No patientLinkFromUpdate on response from updatePatientLink");
40
- console.log(`>>> C5a : Delete Patient/Person link that exists as LOLA 2.`);
41
- await commonWell.deletePatientLink(queryMeta, patientLinkFromUpdate);
42
- // Note: will be deleting patient & person created in this run
43
- await commonWell.deletePerson(queryMeta, personId);
44
- await commonWell.deletePatient(queryMeta, patientId);
45
- }
46
- exports.linkManagement = linkManagement;
47
- //# sourceMappingURL=link-management.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link-management.js","sourceRoot":"","sources":["../src/link-management.ts"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Ac;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAE1F,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAChD,SAAS,EACT,cAAc,EACd,UAAU,EACV,qBAAU,CACX,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,6EAA6E,CAAC,CAAC;IAC3F,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,MAAM,qBAAqB,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;IACxD,IAAI,CAAC,qBAAqB;QACxB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAEjF,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC3E,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAErE,8DAA8D;IAC9D,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC;AA5CD,wCA4CC"}
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
- export declare function orgManagement(
4
- commonWell: CommonWell,
5
- queryMeta: RequestMetadata
6
- ): Promise<void>;
7
- //# sourceMappingURL=org-management.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"org-management.d.ts","sourceRoot":"","sources":["../src/org-management.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAsB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5F,wBAAsB,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,iBAgErF"}
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.orgManagement = void 0;
5
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
6
- const payloads_1 = require("./payloads");
7
- // 4. Org Management
8
- // https://commonwellalliance.sharepoint.com/sites/ServiceAdopter/SitePages/Organization-Management-API---Overview-and-Summary.aspx#overview-and-summary
9
- async function orgManagement(commonWell, queryMeta) {
10
- console.log(`>>> Create an org`);
11
- const org = (0, payloads_1.makeOrganization)();
12
- const respCreateOrg = await commonWell.createOrg(queryMeta, org);
13
- console.log(respCreateOrg);
14
- console.log(`>>> Update an org`);
15
- org.locations[0].city = "Miami";
16
- const orgId = (0, commonwell_sdk_1.getIdTrailingSlash)(respCreateOrg);
17
- if (!orgId)
18
- throw new Error("No orgId on response from createOrg");
19
- const respUpdateOrg = await commonWell.updateOrg(queryMeta, org, orgId);
20
- console.log(respUpdateOrg);
21
- console.log(`>>> Get all orgs`);
22
- const respGetAllOrgs = await commonWell.getAllOrgs(queryMeta);
23
- console.log(respGetAllOrgs);
24
- console.log(`>>> Get one org`);
25
- const respGetOneOrg = await commonWell.getOneOrg(queryMeta, orgId);
26
- console.log(respGetOneOrg);
27
- console.log(`>>> Add certificate to org`);
28
- const respAddCertificateToOrg = await commonWell.addCertificateToOrg(queryMeta, payloads_1.certificate, orgId);
29
- console.log(respAddCertificateToOrg);
30
- console.log(`>>> Replace certificate for org`);
31
- const respReplaceCertificateForOrg = await commonWell.replaceCertificateForOrg(queryMeta, payloads_1.certificate, orgId);
32
- console.log(respReplaceCertificateForOrg);
33
- console.log(`>>> Get certificate from org`);
34
- const respGetCertificatesFromOrg = await commonWell.getCertificatesFromOrg(queryMeta, orgId);
35
- console.log(respGetCertificatesFromOrg);
36
- console.log(`>>> Get certificate from org (by thumprint)`);
37
- const respGetCertificatesFromOrgByThumbprint = await commonWell.getCertificatesFromOrgByThumbprint(queryMeta, orgId, payloads_1.thumbprint);
38
- console.log(respGetCertificatesFromOrgByThumbprint);
39
- console.log(`>>> Get certificate from org (by thumprint & purpose)`);
40
- const respGetCertificatesFromOrgByThumbprintAndPurpose = await commonWell.getCertificatesFromOrgByThumbprintAndPurpose(queryMeta, orgId, payloads_1.thumbprint, payloads_1.certificate.Certificates[0].purpose);
41
- console.log(respGetCertificatesFromOrgByThumbprintAndPurpose);
42
- console.log(`>>> Delete certificate from org`);
43
- await commonWell.deleteCertificateFromOrg(queryMeta, orgId, payloads_1.thumbprint, payloads_1.certificate.Certificates[0].purpose);
44
- console.log("Certificate deleted");
45
- }
46
- exports.orgManagement = orgManagement;
47
- //# sourceMappingURL=org-management.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"org-management.js","sourceRoot":"","sources":["../src/org-management.ts"],"names":[],"mappings":";;;;AACA,8DAA4F;AAE5F,yCAAuE;AAEvE,oBAAoB;AACpB,wJAAwJ;AAEjJ,KAAK,UAAU,aAAa,CAAC,UAAsB,EAAE,SAA0B;IACpF,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,IAAA,2BAAgB,GAAE,CAAC;IAC/B,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAE3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC;IAChC,MAAM,KAAK,GAAG,IAAA,mCAAkB,EAAC,aAAa,CAAC,CAAC;IAChD,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACnE,MAAM,aAAa,GAA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IACpF,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IAEpD,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IACrE,MAAM,gDAAgD,GACpD,MAAM,UAAU,CAAC,4CAA4C,CAC3D,SAAS,EACT,KAAK,EACL,qBAAU,EACV,sBAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CACpC,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAE9D,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,MAAM,UAAU,CAAC,wBAAwB,CACvC,SAAS,EACT,KAAK,EACL,qBAAU,EACV,sBAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CACpC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACrC,CAAC;AAhED,sCAgEC"}
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
- export declare function patientManagement(
4
- commonWell: CommonWell,
5
- commonwellSandbox: CommonWell,
6
- queryMeta: RequestMetadata
7
- ): Promise<void>;
8
- //# sourceMappingURL=patient-management.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patient-management.d.ts","sourceRoot":"","sources":["../src/patient-management.ts"],"names":[],"mappings":";AACA,OAAO,EACL,UAAU,EAIV,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAanC,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,UAAU,EAC7B,SAAS,EAAE,eAAe,iBA8F3B"}
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.patientManagement = void 0;
5
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
6
- const lodash_1 = require("lodash");
7
- const payloads_1 = require("./payloads");
8
- const util_1 = require("./util");
9
- const commonwellSandboxOID = (0, util_1.getEnvOrFail)("COMMONWELL_SANDBOX_OID");
10
- const commonwellSandboxOrgName = (0, util_1.getEnvOrFail)("COMMONWELL_SANDBOX_ORG_NAME");
11
- // 2. Patient Management
12
- // https://commonwellalliance.sharepoint.com/sites/ServiceAdopter/SitePages/Patient-Management-(PIX,-REST).aspx
13
- async function patientManagement(commonWell, commonwellSandbox, queryMeta) {
14
- const patient = (0, payloads_1.makePatient)({ facilityId: commonWell.oid });
15
- // PATIENT MANAGEMENT
16
- console.log(`>>> D1b: Register a new Patient`);
17
- const respD1b = await commonWell.registerPatient(queryMeta, patient);
18
- console.log(respD1b);
19
- console.log(`>>> D2a: Update demographics for a local Patient `);
20
- patient.details.name[0].family[0] = "Graham";
21
- const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(respD1b);
22
- if (!patientId)
23
- throw new Error("No patientId on response from registerPatient");
24
- const respD2a = await commonWell.updatePatient(queryMeta, patient, patientId);
25
- console.log(respD2a);
26
- console.log(`>>> D3a: Search for a Patient`);
27
- const respD3a = await commonWell.searchPatient(queryMeta, (0, util_1.firstElementOrFail)(patient.details.name[0].given, "given name"), patient.details.name[0].family[0], patient.details.birthDate, patient.details.gender.code, patient.details.address[0].zip);
28
- console.log(respD3a);
29
- console.log(`>>> D4a: Merge two Patient records`);
30
- // Create a second patient
31
- const respPatient2 = await commonWell.registerPatient(queryMeta, (0, payloads_1.makeMergePatient)({ facilityId: commonWell.oid }));
32
- const patientId2 = (0, commonwell_sdk_1.getIdTrailingSlash)(respPatient2);
33
- if (!patientId2)
34
- throw new Error("No patientId on response from registerPatient");
35
- const referenceLink = respD1b._links?.self.href;
36
- if (!referenceLink)
37
- throw new Error("No referenceLink on response from registerPatient");
38
- await commonWell.mergePatients(queryMeta, patientId2, referenceLink);
39
- console.log("D4a successful");
40
- // LINK MANAGEMENT
41
- // D5: Patient Matches
42
- console.log(`>>> D5a: Retrieve network links`);
43
- // Main Account Link
44
- const person = await commonWell.enrollPerson(queryMeta, payloads_1.personStrongId);
45
- const personId = (0, commonwell_sdk_1.getId)(person);
46
- if (!personId)
47
- throw new Error("No personId on response from enrollPerson");
48
- await commonWell.addPatientLink(queryMeta, personId, referenceLink);
49
- // Sandbox Account Link
50
- const payloadSandboxPatient = (0, lodash_1.cloneDeep)(patient);
51
- if (payloadSandboxPatient.identifier) {
52
- payloadSandboxPatient.identifier[0].system = `urn:oid:${commonwellSandboxOID}`;
53
- payloadSandboxPatient.identifier[0].assigner = commonwellSandboxOrgName;
54
- payloadSandboxPatient.identifier[0].label = commonwellSandboxOrgName;
55
- }
56
- const sandboxPatient = await commonwellSandbox.registerPatient(queryMeta, payloadSandboxPatient);
57
- const sandboxPatientId = (0, commonwell_sdk_1.getIdTrailingSlash)(sandboxPatient);
58
- if (!sandboxPatientId)
59
- throw new Error("No sandboxPatientId on response from registerPatient");
60
- const sandboxReferenceLink = sandboxPatient._links?.self.href;
61
- if (!sandboxReferenceLink) {
62
- throw new Error("No sandboxReferenceLink on response from registerPatient");
63
- }
64
- await commonwellSandbox.addPatientLink(queryMeta, personId, sandboxReferenceLink);
65
- await commonWell.searchPersonByPatientDemo(queryMeta, patientId);
66
- const respD5a = await commonWell.getNetworkLinks(queryMeta, patientId);
67
- console.log(respD5a);
68
- // D6: Upgrade/Downgrade a Network link
69
- console.log(`>>> D6a: Upgrade link from LOLA 1 to LOLA 2`);
70
- const getLola1Link = respD5a._embedded.networkLink?.find(link => link && link.assuranceLevel === commonwell_sdk_1.LOLA.level_1);
71
- const upgradeURL = getLola1Link?._links?.upgrade?.href;
72
- if (!upgradeURL)
73
- throw new Error("No upgradeURL on response from getNetworkLinks");
74
- const respD6a = await commonWell.upgradeOrDowngradeNetworkLink(queryMeta, upgradeURL);
75
- console.log(respD6a);
76
- console.log(`>>> D6b: Downgrade link from LOLA 2 to LOLA 0`);
77
- const downgradeURL = respD6a._links?.downgrade?.href;
78
- if (!downgradeURL) {
79
- throw new Error("No downgradeURL on response from upgradeOrDowngradeNetworkLink");
80
- }
81
- const respD6b = await commonWell.upgradeOrDowngradeNetworkLink(queryMeta, downgradeURL);
82
- console.log(respD6b);
83
- // Deletes created patients (not a part of spec just for cleanup)
84
- console.log(`>>> Delete created patients.`);
85
- // Note: will be deleting patient & person created in this run
86
- await commonWell.deletePerson(queryMeta, personId);
87
- await commonWell.deletePatient(queryMeta, patientId);
88
- await commonwellSandbox.deletePatient(queryMeta, sandboxPatientId);
89
- }
90
- exports.patientManagement = patientManagement;
91
- //# sourceMappingURL=patient-management.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patient-management.js","sourceRoot":"","sources":["../src/patient-management.ts"],"names":[],"mappings":";;;;AACA,8DAMmC;AACnC,mCAAmC;AAEnC,yCAA2E;AAE3E,iCAA0D;AAE1D,MAAM,oBAAoB,GAAG,IAAA,mBAAY,EAAC,wBAAwB,CAAC,CAAC;AACpE,MAAM,wBAAwB,GAAG,IAAA,mBAAY,EAAC,6BAA6B,CAAC,CAAC;AAE7E,wBAAwB;AACxB,+GAA+G;AAExG,KAAK,UAAU,iBAAiB,CACrC,UAAsB,EACtB,iBAA6B,EAC7B,SAA0B;IAE1B,MAAM,OAAO,GAAG,IAAA,sBAAW,EAAC,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;IAE5D,qBAAqB;IACrB,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAA,mCAAkB,EAAC,OAAO,CAAC,CA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,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAE5C,8DAA8D;IAC9D,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnD,MAAM,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACrD,MAAM,iBAAiB,CAAC,aAAa,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACrE,CAAC;AAjGD,8CAiGC"}
@@ -1,3 +0,0 @@
1
- import { Demographics } from "@metriport/commonwell-sdk";
2
- export declare const patientConnieCarin: Demographics;
3
- //# sourceMappingURL=patient-carin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patient-carin.d.ts","sourceRoot":"","sources":["../../src/payloads/patient-carin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGb,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,kBAAkB,EAAE,YA2BhC,CAAC"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.patientConnieCarin = void 0;
4
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
5
- const identifier_1 = require("@metriport/commonwell-sdk/models/identifier");
6
- exports.patientConnieCarin = {
7
- address: [
8
- {
9
- use: commonwell_sdk_1.AddressUseCodes.home,
10
- postalCode: "01890",
11
- state: "MA",
12
- line: ["681 Schumm View"],
13
- city: "Winchester",
14
- },
15
- ],
16
- name: [
17
- {
18
- use: commonwell_sdk_1.NameUseCodes.usual,
19
- given: ["Connie"],
20
- family: ["CarinTest"],
21
- },
22
- ],
23
- gender: commonwell_sdk_1.GenderCodes.F,
24
- birthDate: "1945-01-12",
25
- identifier: [
26
- {
27
- use: "official",
28
- type: "SSN",
29
- value: "109887878",
30
- system: identifier_1.KnownIdentifierSystems.SSN,
31
- },
32
- ],
33
- };
34
- //# sourceMappingURL=patient-carin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patient-carin.js","sourceRoot":"","sources":["../../src/payloads/patient-carin.ts"],"names":[],"mappings":";;;AAAA,8DAKmC;AACnC,4EAAqF;AAExE,QAAA,kBAAkB,GAAiB;IAC9C,OAAO,EAAE;QACP;YACE,GAAG,EAAE,gCAAe,CAAC,IAAI;YACzB,UAAU,EAAE,OAAO;YACnB,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,CAAC,iBAAiB,CAAC;YACzB,IAAI,EAAE,YAAY;SACnB;KACF;IACD,IAAI,EAAE;QACJ;YACE,GAAG,EAAE,6BAAY,CAAC,KAAK;YACvB,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,MAAM,EAAE,CAAC,WAAW,CAAC;SACtB;KACF;IACD,MAAM,EAAE,4BAAW,CAAC,CAAC;IACrB,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE;QACV;YACE,GAAG,EAAE,UAAU;YACf,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,WAAW;YAClB,MAAM,EAAE,mCAAsB,CAAC,GAAG;SACnC;KACF;CACF,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Demographics } from "@metriport/commonwell-sdk";
2
- export declare const patientTracyCrane: Omit<Demographics, "identifier">;
3
- //# sourceMappingURL=patient-crane.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patient-crane.d.ts","sourceRoot":"","sources":["../../src/payloads/patient-crane.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAGb,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAyB9D,CAAC"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.patientTracyCrane = void 0;
4
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
5
- exports.patientTracyCrane = {
6
- address: [
7
- {
8
- use: commonwell_sdk_1.AddressUseCodes.home,
9
- postalCode: "01462",
10
- state: "MA",
11
- line: ["458 Streich Street"],
12
- city: "Lunenburg",
13
- },
14
- ],
15
- name: [
16
- {
17
- use: commonwell_sdk_1.NameUseCodes.usual,
18
- given: ["Tracy"],
19
- family: ["CraneTest"],
20
- },
21
- ],
22
- gender: commonwell_sdk_1.GenderCodes.F,
23
- birthDate: "1936-12-26",
24
- telecom: [
25
- {
26
- value: "2223601564",
27
- system: commonwell_sdk_1.ContactSystemCodes.phone,
28
- },
29
- ],
30
- };
31
- //# sourceMappingURL=patient-crane.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patient-crane.js","sourceRoot":"","sources":["../../src/payloads/patient-crane.ts"],"names":[],"mappings":";;;AAAA,8DAMmC;AAEtB,QAAA,iBAAiB,GAAqC;IACjE,OAAO,EAAE;QACP;YACE,GAAG,EAAE,gCAAe,CAAC,IAAI;YACzB,UAAU,EAAE,OAAO;YACnB,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,CAAC,oBAAoB,CAAC;YAC5B,IAAI,EAAE,WAAW;SAClB;KACF;IACD,IAAI,EAAE;QACJ;YACE,GAAG,EAAE,6BAAY,CAAC,KAAK;YACvB,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,MAAM,EAAE,CAAC,WAAW,CAAC;SACtB;KACF;IACD,MAAM,EAAE,4BAAW,CAAC,CAAC;IACrB,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE;QACP;YACE,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,mCAAkB,CAAC,KAAK;SACjC;KACF;CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { CommonWell, RequestMetadata } from "@metriport/commonwell-sdk";
3
- export declare function personManagement(
4
- commonWell: CommonWell,
5
- queryMeta: RequestMetadata
6
- ): Promise<void>;
7
- //# sourceMappingURL=person-management.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"person-management.d.ts","sourceRoot":"","sources":["../src/person-management.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAA6B,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAcnG,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,iBA0ExF"}
@@ -1,94 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.personManagement = void 0;
28
- const commonwell_sdk_1 = require("@metriport/commonwell-sdk");
29
- const nanoid = __importStar(require("nanoid"));
30
- const payloads_1 = require("./payloads");
31
- // 1. Person Management
32
- // https://commonwellalliance.sharepoint.com/sites/ServiceAdopter/SitePages/Person-Management-(REST).aspx
33
- async function personManagement(commonWell, queryMeta) {
34
- // C1: Enroll a person
35
- console.log(`>>> C1a: Enroll a Person with a Strong ID`);
36
- const respC1a = await commonWell.enrollPerson(queryMeta, payloads_1.personStrongId);
37
- console.log(respC1a);
38
- console.log(`>>> C1b: Enroll a Person without a Strong ID`);
39
- const respC1b = await commonWell.enrollPerson(queryMeta, payloads_1.personNoStrongId);
40
- console.log(respC1b);
41
- // C2: Person search
42
- console.log(`>>> C2a: Search for a Person using the Strong ID`);
43
- const respC2a = await commonWell.searchPerson(queryMeta, payloads_1.driversLicenseId, payloads_1.caDriversLicenseUri);
44
- console.log(respC2a);
45
- console.log(`>>> C2b: Search for a Person using the local Patient demographics.`);
46
- const personId = (0, commonwell_sdk_1.getId)(respC1a);
47
- if (!personId)
48
- throw new Error("No personId on response from enrollPerson");
49
- const newPatient = await commonWell.registerPatient(queryMeta, (0, payloads_1.makePatient)({ facilityId: commonWell.oid }));
50
- const patientId = (0, commonwell_sdk_1.getIdTrailingSlash)(newPatient);
51
- if (!patientId)
52
- throw new Error("No patientId on response from registerPatient");
53
- const respC2b = await commonWell.searchPersonByPatientDemo(queryMeta, patientId);
54
- console.log(respC2b);
55
- // C3: Person Update
56
- console.log(`>>> C3a: Update a Person with an existing Strong ID by updating their demographics and/or Strong ID`);
57
- payloads_1.personStrongId.details.name[0].family[0] = "Graham";
58
- const respC3a = await commonWell.updatePerson(queryMeta, payloads_1.personStrongId, personId);
59
- console.log(respC3a);
60
- console.log(`>>> C3b: Update a Person without a Strong ID by updating their demographics and/or by adding a Strong ID`);
61
- const personId2 = (0, commonwell_sdk_1.getId)(respC1b);
62
- if (!personId2)
63
- throw new Error("No personId2 on response from enrollPerson");
64
- const driversLicenseId2 = nanoid.nanoid();
65
- payloads_1.personNoStrongId.details.identifier = [
66
- {
67
- use: "usual",
68
- key: driversLicenseId2,
69
- system: payloads_1.caDriversLicenseUri,
70
- period: {
71
- start: "2016-04-20T00:00:00Z",
72
- },
73
- },
74
- ];
75
- const respC3b = await commonWell.updatePerson(queryMeta, payloads_1.personNoStrongId, personId2);
76
- console.log(respC3b);
77
- // C4: Patient Match
78
- console.log(`>>> C4a: Search for patients matching the Person demographics.`);
79
- const respC4a = await commonWell.patientMatch(queryMeta, personId);
80
- console.log(respC4a);
81
- // C6: Unenroll a person
82
- console.log(`>>> C6a: Unenroll a Person who is active`);
83
- const respC6a = await commonWell.unenrollPerson(queryMeta, personId2);
84
- console.log(respC6a);
85
- // C7: Delete Person
86
- console.log(`>>> C7a: Delete a Person who was previously enrolled with or without a Strong ID and at least one patient link.`);
87
- // Note: will be deleting both persons created in this run
88
- await commonWell.deletePerson(queryMeta, personId);
89
- await commonWell.deletePerson(queryMeta, personId2);
90
- // Note: delete created patient
91
- await commonWell.deletePatient(queryMeta, patientId);
92
- }
93
- exports.personManagement = personManagement;
94
- //# sourceMappingURL=person-management.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"person-management.js","sourceRoot":"","sources":["../src/person-management.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8DAAmG;AACnG,+CAAiC;AAEjC,yCAMoB;AAEpB,uBAAuB;AACvB,yGAAyG;AAElG,KAAK,UAAU,gBAAgB,CAAC,UAAsB,EAAE,SAA0B;IACvF,sBAAsB;IACtB,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,yBAAc,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,2BAAgB,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,2BAAgB,EAAE,8BAAmB,CAAC,CAAC;IAChG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;IAClF,MAAM,QAAQ,GAAG,IAAA,sBAAK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