From 07dccab678e7ab68e865c1c03fda8daf59e05046 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Wed, 26 Oct 2022 13:19:44 -0400 Subject: [PATCH 01/12] add case for MedicationStatement references --- src/App.jsx | 2 +- .../QuestionnaireForm/QuestionnaireForm.jsx | 6 ++--- .../buildPopulatedResourceBundle.js | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index fb92f96e..bf1aed98 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -273,7 +273,7 @@ export default class App extends Component { }); } }); - console.log(fullBundle); + console.log(allLibrariesResults); this.setState({ bundle: fullBundle, cqlPrepopulationResults: allLibrariesResults, diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index f08db2b6..f992e25c 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -668,9 +668,9 @@ export default class QuestionnaireForm extends Component { system = "RxNorm" } - if (system.length > 0) { - displayText = displayText + ' - ' + system + ' - ' + v.code - } + // if (system.length > 0) { + // displayText = displayText + ' - ' + system + ' - ' + v.code + // } } return { diff --git a/src/elmExecutor/buildPopulatedResourceBundle.js b/src/elmExecutor/buildPopulatedResourceBundle.js index eccc28db..f0a049ea 100644 --- a/src/elmExecutor/buildPopulatedResourceBundle.js +++ b/src/elmExecutor/buildPopulatedResourceBundle.js @@ -80,6 +80,23 @@ function doSearch(smart, type, fhirVersion, request, callback) { // unknown version break; } + break; + case "MedicationStatement": + smart.patient.request(type, {resolveReferences: 'medicationReference', flat: true, graph: false}).then((result) =>{ + console.log("med statement result"); + console.log(result); + let finalResult = [] + // TODO: This system should be untangled, reference resolution and resource gathering shouldn't be done separately + if(result && result.data){ + if(result.references) { + Object.keys(result.references).forEach((e)=>{ + finalResult.push(result.references[e]) + }) + } + callback(finalResult); + } + }) + break; } // If this is for Epic, there are some specific modifications needed for the queries to work properly @@ -126,10 +143,15 @@ function doSearch(smart, type, fhirVersion, request, callback) { Object.keys(q).forEach((parameter)=>{ query.set(parameter, q[parameter]); }); + if( usePatient ) { + console.log("we're going in again patient") + console.log(type) smart.patient.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } else if(q._id){ + console.log("we're going in again") + console.log(type) smart.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } From 3ca880262a98c628d628587f557f752e95d6d546 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Wed, 26 Oct 2022 14:01:59 -0400 Subject: [PATCH 02/12] remove console logs --- src/elmExecutor/buildPopulatedResourceBundle.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/elmExecutor/buildPopulatedResourceBundle.js b/src/elmExecutor/buildPopulatedResourceBundle.js index f0a049ea..ef7b2442 100644 --- a/src/elmExecutor/buildPopulatedResourceBundle.js +++ b/src/elmExecutor/buildPopulatedResourceBundle.js @@ -83,8 +83,6 @@ function doSearch(smart, type, fhirVersion, request, callback) { break; case "MedicationStatement": smart.patient.request(type, {resolveReferences: 'medicationReference', flat: true, graph: false}).then((result) =>{ - console.log("med statement result"); - console.log(result); let finalResult = [] // TODO: This system should be untangled, reference resolution and resource gathering shouldn't be done separately if(result && result.data){ @@ -145,13 +143,9 @@ function doSearch(smart, type, fhirVersion, request, callback) { }); if( usePatient ) { - console.log("we're going in again patient") - console.log(type) smart.patient.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } else if(q._id){ - console.log("we're going in again") - console.log(type) smart.request(`${type}?${query}`) .then(processSuccess(smart, [], callback), processError(smart, callback)); } From d2aeb420924952c7cd414d45137084af4a11ee84 Mon Sep 17 00:00:00 2001 From: kghoreshi Date: Tue, 31 Jan 2023 15:53:53 -0500 Subject: [PATCH 03/12] allow questionnaires to display without bundles --- src/App.jsx | 3 +- .../QuestionnaireForm/QuestionnaireForm.jsx | 470 +++++++++--------- 2 files changed, 237 insertions(+), 236 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index bf1aed98..add66b8c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -619,8 +619,7 @@ export default class App extends Component { render() { if ( (this.state.questionnaire && - this.state.cqlPrepopulationResults && - this.state.bundle) + this.state.cqlPrepopulationResults) || (this.state.questionnaire && this.state.response && diff --git a/src/components/QuestionnaireForm/QuestionnaireForm.jsx b/src/components/QuestionnaireForm/QuestionnaireForm.jsx index f992e25c..42d209bf 100644 --- a/src/components/QuestionnaireForm/QuestionnaireForm.jsx +++ b/src/components/QuestionnaireForm/QuestionnaireForm.jsx @@ -1098,272 +1098,274 @@ export default class QuestionnaireForm extends Component { } }; - const priorAuthBundle = JSON.parse(JSON.stringify(this.props.bundle)); - if (priorAuthBundle && this.isPriorAuthBundleValid(priorAuthBundle)) { - priorAuthBundle.entry.unshift({ resource: managingOrg }); - priorAuthBundle.entry.unshift({ resource: facility }); - priorAuthBundle.entry.unshift({ resource: this.props.deviceRequest }); - priorAuthBundle.entry.unshift({ resource: qr }); - - this.generateAndStoreDocumentReference(qr, priorAuthBundle); - this.storeQuestionnaireResponseToEhr(qr, false); - - const priorAuthClaim = { - resourceType: "Claim", - status: "active", - type: { - coding: [ - { - system: "http://terminology.hl7.org/CodeSystem/claim-type", - code: "professional", - display: "Professional" - } - ] - }, - identifier: [ - { - system: "urn:uuid:mitre-drls", - value: shortid.generate() - } - ], - use: "preauthorization", - patient: { reference: this.makeReference(priorAuthBundle, "Patient") }, - created: qr.authored, - provider: { - // TODO: make this organization - reference: this.makeReference(priorAuthBundle, "Practitioner") - }, - facility: { - reference: this.makeReference(priorAuthBundle, "Location") - }, - priority: { coding: [{ code: "normal" }] }, - careTeam: [ - { - sequence: 1, - provider: { - reference: this.makeReference(priorAuthBundle, "Practitioner") - }, - extension: [ + if(this.props.bundle){ + const priorAuthBundle = JSON.parse(JSON.stringify(this.props.bundle)); + if (priorAuthBundle && this.isPriorAuthBundleValid(priorAuthBundle)) { + priorAuthBundle.entry.unshift({ resource: managingOrg }); + priorAuthBundle.entry.unshift({ resource: facility }); + priorAuthBundle.entry.unshift({ resource: this.props.deviceRequest }); + priorAuthBundle.entry.unshift({ resource: qr }); + + this.generateAndStoreDocumentReference(qr, priorAuthBundle); + this.storeQuestionnaireResponseToEhr(qr, false); + + const priorAuthClaim = { + resourceType: "Claim", + status: "active", + type: { + coding: [ { - url: "http://terminology.hl7.org/ValueSet/v2-0912", - valueCode: "OP" + system: "http://terminology.hl7.org/CodeSystem/claim-type", + code: "professional", + display: "Professional" } ] - } - ], - supportingInfo: [ - { - sequence: 1, - category: { - coding: [ - { - system: - "http://hl7.org/us/davinci-pas/CodeSystem/PASSupportingInfoType", - code: "patientEvent" - } - ] - }, - timingPeriod: { - start: "2020-01-01", - end: "2021-01-01" + }, + identifier: [ + { + system: "urn:uuid:mitre-drls", + value: shortid.generate() } + ], + use: "preauthorization", + patient: { reference: this.makeReference(priorAuthBundle, "Patient") }, + created: qr.authored, + provider: { + // TODO: make this organization + reference: this.makeReference(priorAuthBundle, "Practitioner") }, - { - sequence: 2, - category: { - coding: [ + facility: { + reference: this.makeReference(priorAuthBundle, "Location") + }, + priority: { coding: [{ code: "normal" }] }, + careTeam: [ + { + sequence: 1, + provider: { + reference: this.makeReference(priorAuthBundle, "Practitioner") + }, + extension: [ { - system: - "http://terminology.hl7.org/CodeSystem/claiminformationcategory", - code: "info", - display: "Information" + url: "http://terminology.hl7.org/ValueSet/v2-0912", + valueCode: "OP" } ] - }, - valueReference: { - reference: this.makeReference( - priorAuthBundle, - "QuestionnaireResponse" - ) - } - } - ], - item: [ - { - sequence: 1, - careTeamSequence: [1], - productOrService: this.getCode(), - quantity: { - value: 1 } - // TODO: add extensions - } - ], - diagnosis: [], - insurance: [ - { - sequence: 1, - focal: true, - coverage: { - // TODO: diagnosis is not a reference it must be CodeableConcept - reference: this.makeReference(priorAuthBundle, "Coverage") - } - } - ] - }; - - const signature = { - resourceType: "Signature", - type: [ - { - system: "urn:iso-astm:E1762-95:2013", - code: "1.2.840.10065.1.12.1.14", - display: "Source Signature" - } - ], - when: new Date(Date.now()).toISOString(), - who: this.makeReference(priorAuthBundle, "Practitioner") - } - var sequence = 1; - priorAuthBundle.entry.forEach(function (entry, index) { - if (entry.resource.resourceType == "Condition") { - priorAuthClaim.diagnosis.push({ - sequence: sequence++, - diagnosisReference: { reference: "Condition/" + entry.resource.id } - }); - } - }); - priorAuthBundle.timestamp = new Date(Date.now()).toISOString() - priorAuthBundle.language = "en"; - priorAuthBundle.id = shortid.generate(); - priorAuthBundle.meta = { - lastUpdated: Date.now() - } - priorAuthBundle.implicitRules = "http://build.fhir.org/ig/HL7/davinci-pas/StructureDefinition-profile-pas-request-bundle" - priorAuthBundle.identifier = { - use: "official", - system: "urn:uuid:mitre-drls", - value: shortid.generate() - } - priorAuthBundle.signature = signature; - priorAuthBundle.entry.unshift({ resource: priorAuthClaim }); - - const specialtyRxBundle = JSON.parse(JSON.stringify(priorAuthBundle)); - specialtyRxBundle.type = "message"; - if (this.makeReference(priorAuthBundle, "MedicationRequest")) { - const pharmacy = { - resourceType: "Organization", - id: "pharm0111", - identifier: [ + ], + supportingInfo: [ { - system: "http://hl7.org/fhir/sid/us-npi", - value: "1837247346" + sequence: 1, + category: { + coding: [ + { + system: + "http://hl7.org/us/davinci-pas/CodeSystem/PASSupportingInfoType", + code: "patientEvent" + } + ] + }, + timingPeriod: { + start: "2020-01-01", + end: "2021-01-01" + } }, { - system: "http://terminology.hl7.org/CodeSystem/NCPDPProviderIdentificationNumber", - value: "838283882" + sequence: 2, + category: { + coding: [ + { + system: + "http://terminology.hl7.org/CodeSystem/claiminformationcategory", + code: "info", + display: "Information" + } + ] + }, + valueReference: { + reference: this.makeReference( + priorAuthBundle, + "QuestionnaireResponse" + ) + } } ], - telecom: [ + item: [ { - system : "phone", - value : "919-234-5174", - use : "work", - rank : "1", + sequence: 1, + careTeamSequence: [1], + productOrService: this.getCode(), + quantity: { + value: 1 + } + // TODO: add extensions } ], - address: [ + diagnosis: [], + insurance: [ { - use: "work", - state: "IL", - postalCode: "62864", - city: "Mount Vernon", - line: ["1500 Main St"] + sequence: 1, + focal: true, + coverage: { + // TODO: diagnosis is not a reference it must be CodeableConcept + reference: this.makeReference(priorAuthBundle, "Coverage") + } } ] - } + }; - const specialtyRxSearchResult = { - resourceType: "Bundle", - type: "searchset", - id: "bundle02", - total: 0, - link: [ + const signature = { + resourceType: "Signature", + type: [ { - relation: "self", - url: "", + system: "urn:iso-astm:E1762-95:2013", + code: "1.2.840.10065.1.12.1.14", + display: "Source Signature" } ], - entry: [] + when: new Date(Date.now()).toISOString(), + who: this.makeReference(priorAuthBundle, "Practitioner") } - - const specialtyRxParameters = { - resourceType: "Parameters", - id: "param0111", - parameter: [ - { - name: "source-patient", - reference: this.makeReference(priorAuthBundle, "Patient") - }, - { - name: "prescription", - reference: this.makeReference(priorAuthBundle, "MedicationRequest") - }, - { - name: "pharmacy", - reference: "Organization/pharm0111" - }, - { - name: "prescriber", - reference: this.makeReference(priorAuthBundle, "Practitioner") - }, - { - name: "search-result", - reference: "Bundle/bundle02" - }, - - ] + var sequence = 1; + priorAuthBundle.entry.forEach(function (entry, index) { + if (entry.resource.resourceType == "Condition") { + priorAuthClaim.diagnosis.push({ + sequence: sequence++, + diagnosisReference: { reference: "Condition/" + entry.resource.id } + }); + } + }); + priorAuthBundle.timestamp = new Date(Date.now()).toISOString() + priorAuthBundle.language = "en"; + priorAuthBundle.id = shortid.generate(); + priorAuthBundle.meta = { + lastUpdated: Date.now() } - - const specialtyRxMessageHeader = { - resourceType: "MessageHeader", - id: "msghdr0111", - event: [ - { - eventCoding: { - system: "http://hl7.org/fhir/us/specialty-rx/CodeSystem/specialty-rx-event-type", - code: "query-response-unsolicited", + priorAuthBundle.implicitRules = "http://build.fhir.org/ig/HL7/davinci-pas/StructureDefinition-profile-pas-request-bundle" + priorAuthBundle.identifier = { + use: "official", + system: "urn:uuid:mitre-drls", + value: shortid.generate() + } + priorAuthBundle.signature = signature; + priorAuthBundle.entry.unshift({ resource: priorAuthClaim }); + + const specialtyRxBundle = JSON.parse(JSON.stringify(priorAuthBundle)); + specialtyRxBundle.type = "message"; + if (this.makeReference(priorAuthBundle, "MedicationRequest")) { + const pharmacy = { + resourceType: "Organization", + id: "pharm0111", + identifier: [ + { + system: "http://hl7.org/fhir/sid/us-npi", + value: "1837247346" + }, + { + system: "http://terminology.hl7.org/CodeSystem/NCPDPProviderIdentificationNumber", + value: "838283882" } - } - ], - focus: { - parameters: { - reference: "Parameters/param0111" - } - }, - source: { - // TODO: url should be dynamically created - // also if DTR expects to recieve a response it - // will need an endpoint to recieve it at - endpoint: "http://localhost:3005" + ], + telecom: [ + { + system : "phone", + value : "919-234-5174", + use : "work", + rank : "1", + } + ], + address: [ + { + use: "work", + state: "IL", + postalCode: "62864", + city: "Mount Vernon", + line: ["1500 Main St"] + } + ] } - - } - - specialtyRxBundle.entry.unshift({ resource: specialtyRxSearchResult }); - specialtyRxBundle.entry.unshift({ resource: pharmacy }); - specialtyRxBundle.entry.unshift({ resource: specialtyRxParameters }); - specialtyRxBundle.entry.unshift({ resource: specialtyRxMessageHeader }); - } + const specialtyRxSearchResult = { + resourceType: "Bundle", + type: "searchset", + id: "bundle02", + total: 0, + link: [ + { + relation: "self", + url: "", + } + ], + entry: [] + } + + const specialtyRxParameters = { + resourceType: "Parameters", + id: "param0111", + parameter: [ + { + name: "source-patient", + reference: this.makeReference(priorAuthBundle, "Patient") + }, + { + name: "prescription", + reference: this.makeReference(priorAuthBundle, "MedicationRequest") + }, + { + name: "pharmacy", + reference: "Organization/pharm0111" + }, + { + name: "prescriber", + reference: this.makeReference(priorAuthBundle, "Practitioner") + }, + { + name: "search-result", + reference: "Bundle/bundle02" + }, + + ] + } + + const specialtyRxMessageHeader = { + resourceType: "MessageHeader", + id: "msghdr0111", + event: [ + { + eventCoding: { + system: "http://hl7.org/fhir/us/specialty-rx/CodeSystem/specialty-rx-event-type", + code: "query-response-unsolicited", + } + } + ], + focus: { + parameters: { + reference: "Parameters/param0111" + } + }, + source: { + // TODO: url should be dynamically created + // also if DTR expects to recieve a response it + // will need an endpoint to recieve it at + endpoint: "http://localhost:3005" + } + + } + + specialtyRxBundle.entry.unshift({ resource: specialtyRxSearchResult }); + specialtyRxBundle.entry.unshift({ resource: pharmacy }); + specialtyRxBundle.entry.unshift({ resource: specialtyRxParameters }); + specialtyRxBundle.entry.unshift({ resource: specialtyRxMessageHeader }); - console.log("specialtyRx", specialtyRxBundle); + } + console.log("specialtyRx", specialtyRxBundle); - this.props.setPriorAuthClaim(priorAuthBundle); - this.props.setSpecialtyRxBundle(specialtyRxBundle); - } else { - alert("Prior Auth Bundle is not available or does not contain enough resources for Prior Auth. Can't submit to prior auth.") + + this.props.setPriorAuthClaim(priorAuthBundle); + this.props.setSpecialtyRxBundle(specialtyRxBundle); + } else { + alert("Prior Auth Bundle is not available or does not contain enough resources for Prior Auth. Can't submit to prior auth.") + } } } From e69e8b203988baca0235a765bd9993064fe729fd Mon Sep 17 00:00:00 2001 From: Sahil Malhotra Date: Thu, 9 Feb 2023 12:32:00 -0500 Subject: [PATCH 04/12] initial commit for integration --- .../RemsInterface/RemsInterface.jsx | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 7a58f75a..07eadb9a 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -57,38 +57,29 @@ export default class RemsInterface extends Component { return (
-
{metReq.requirement.name}
+
{metReq.requirementName}
{metReq.completed ? "✅" : "❌"}
-
{metReq.requirement.description}
+
{metReq.requirementDescription}
- { - metReq.childMetRequirements.map(subMetReq => -
-
{subMetReq.requirement.name}
-
{subMetReq.completed ? "✅" : "❌"}
-
{subMetReq.requirement.description}
-
- ) - }
) }); } - + async sendRemsMessage() { - const remsAdminResponse = await axios.post("http://localhost:8090/rems", this.props.specialtyRxBundle, this.getAxiosOptions()); + const remsAdminResponse = await axios.post("http://localhost:8090/etasu/met", this.props.specialtyRxBundle, this.getAxiosOptions()); this.setState({ remsAdminResponse }); console.log(remsAdminResponse) - // Will not send post request to PIS if only for prescriber enrollment - if(this.state.remsAdminResponse?.data?.case_number){ - axios.post("http://localhost:3010/api/doctorOrder/$process-message", remsAdminResponse.data, this.getAxiosOptions()).then((response) => { - this.setState({ response }); - console.log(response); - console.log(response.data); - }); - } + // Will not send post request to PIS if only for patient enrollment + // if(this.state.remsAdminResponse?.data?.case_number){ + // axios.post("http://localhost:3010/api/doctorOrder/$process-message", remsAdminResponse.data, this.getAxiosOptions()).then((response) => { + // this.setState({ response }); + // console.log(response); + // console.log(response.data); + // }); + // } } toggleBundle() { @@ -131,7 +122,7 @@ export default class RemsInterface extends Component { refreshBundle() { this.setState({ spin: true }); - axios.get(`http://localhost:8090/rems/${this.state.remsAdminResponse.data.case_number}`).then((response) => { + axios.get(`http://localhost:8090/etasu/met/${this.state.remsAdminResponse.data.case_number}`).then((response) => { this.setState({ remsAdminResponse: response }); }) } From 23b61514b352ceba6ae7534c8e2b979c446617a4 Mon Sep 17 00:00:00 2001 From: Sahil Malhotra Date: Thu, 9 Feb 2023 15:17:27 -0500 Subject: [PATCH 05/12] initial pims integration --- .../RemsInterface/RemsInterface.jsx | 69 ++++++++++++++++--- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 07eadb9a..3c2b235b 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -66,20 +66,67 @@ export default class RemsInterface extends Component { }); } + + getResource(bundle, resourceReference) { + let temp = resourceReference.split("/"); + let _resourceType = temp[0]; + let _id = temp[1]; + + for (let i = 0; i < bundle.entry.length; i++) { + if ((bundle.entry[i].resource.resourceType === _resourceType) + && (bundle.entry[i].resource.id === _id)) { + return bundle.entry[i].resource; + } + } + return null; + } async sendRemsMessage() { const remsAdminResponse = await axios.post("http://localhost:8090/etasu/met", this.props.specialtyRxBundle, this.getAxiosOptions()); - this.setState({ remsAdminResponse }); - console.log(remsAdminResponse) - - // Will not send post request to PIS if only for patient enrollment - // if(this.state.remsAdminResponse?.data?.case_number){ - // axios.post("http://localhost:3010/api/doctorOrder/$process-message", remsAdminResponse.data, this.getAxiosOptions()).then((response) => { - // this.setState({ response }); - // console.log(response); - // console.log(response.data); - // }); - // } + console.log(remsAdminResponse) + + if (remsAdminResponse) { + this.setState({ remsAdminResponse }); + } else { + // error handling + } + + // Will not send post request to PIS if only for patient enrollment + if(this.state.remsAdminResponse?.data?.case_number){ + + // extract params and questionnaire response identifier + let params = this.getResource(this.props.specialtyRxBundle, this.props.specialtyRxBundle.entry[0].resource.focus.parameters.reference); + + // stakeholder and medication references + let prescriptionReference = ""; + let patientReference = ""; + for (let param of params.parameter) { + if (param.name === "prescription") { + prescriptionReference = param.reference; + } + else if (param.name === "source-patient") { + patientReference = param.reference; + } + } + + // obtain drug information from database + let presciption = this.getResource(this.props.specialtyRxBundle, prescriptionReference); + let prescriptionDisplay = presciption.medicationCodeableConcept.coding[0].display.split(" ")[0]; + let patient = this.getResource(this.props.specialtyRxBundle, patientReference); + let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; + + console.log(`http://localhost:5150/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`); + + axios.get(`http://localhost:5150/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`, remsAdminResponse.data, this.getAxiosOptions()).then((response) => { + this.setState({ response }); + console.log(response); + console.log(response.data); + }); + } + + // const remsAdminResponse = await axios.post("http://localhost:8090/etasu/met", this.props.specialtyRxBundle, this.getAxiosOptions()); + // this.setState({ remsAdminResponse }); + // console.log(remsAdminResponse) } toggleBundle() { From 8a2158d4214e1b241368b3f7bce9fd63df96d247 Mon Sep 17 00:00:00 2001 From: Sahil Malhotra Date: Thu, 9 Feb 2023 15:46:41 -0500 Subject: [PATCH 06/12] added error handling for already submitted reqs --- .../RemsInterface/RemsInterface.jsx | 212 +++++++++--------- 1 file changed, 109 insertions(+), 103 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 3c2b235b..53419799 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -84,12 +84,7 @@ export default class RemsInterface extends Component { async sendRemsMessage() { const remsAdminResponse = await axios.post("http://localhost:8090/etasu/met", this.props.specialtyRxBundle, this.getAxiosOptions()); console.log(remsAdminResponse) - - if (remsAdminResponse) { - this.setState({ remsAdminResponse }); - } else { - // error handling - } + this.setState({ remsAdminResponse }); // Will not send post request to PIS if only for patient enrollment if(this.state.remsAdminResponse?.data?.case_number){ @@ -195,116 +190,127 @@ export default class RemsInterface extends Component { } // Checking if REMS Request (pt enrollment) || Met Requirments (prescriber Form) + let hasRemsResponse = this.state.remsAdminResponse?.data ? true : false let hasRemsCase = this.state.remsAdminResponse?.data?.case_number ? true : false; return (
- {hasRemsCase ? + { + hasRemsResponse ?
-
-

REMS Admin Status

- -
-
- Case Number : {this.state.remsAdminResponse?.data?.case_number || "N/A"} -
-
- Status: {this.state.remsAdminResponse?.data?.status} -
-
- - - - {this.state.remsAdminResponse?.data?.case_number ? - this.setState({ spin: false })} - /> - : "" - } - -
- -
- {this.state.viewResponse ? -
+ {hasRemsCase ? +
+
+

REMS Admin Status

+ +
+
+ Case Number : {this.state.remsAdminResponse?.data?.case_number || "N/A"} +
+
+ Status: {this.state.remsAdminResponse?.data?.status} +
+
+ + + + {this.state.remsAdminResponse?.data?.case_number ? + this.setState({ spin: false })} + /> + : "" + } + +
+ +
+ {this.state.viewResponse ? +
+

+

ETASU

+ {this.unfurlJson(this.state.remsAdminResponse?.data, 0)} +
+ : + ""} + {this.state.viewBundle ?


-

ETASU

- {this.unfurlJson(this.state.remsAdminResponse?.data, 0)} -
- : - ""} - {this.state.viewBundle ?
-

-

Bundle

- {this.renderBundle(this.props.specialtyRxBundle)} -
: ""} - +

Bundle

+ {this.renderBundle(this.props.specialtyRxBundle)} +
: ""} + +
+ +
+

Pharmacy Status

+ +
+
+ ID : {this.state.response?.data?.doctorOrder?._id || "N/A"} +
+
+ Status: {this.state.response?.data?.doctorOrder?.dispenseStatus} +
+
+ + {this.state.response?.data?.doctorOrder?._id ? + this.setState({ spinPis: false })} + /> + : "" + } +
+ +
+ {this.state.viewPisBundle ?
+

+

Bundle

+ {this.renderBundle(this.props.specialtyRxBundle)} +
: ""} +
- -
-

Pharmacy Status

- -
-
- ID : {this.state.response?.data?.doctorOrder?._id || "N/A"} -
-
- Status: {this.state.response?.data?.doctorOrder?.dispenseStatus} -
-
- - {this.state.response?.data?.doctorOrder?._id ? - this.setState({ spinPis: false })} - /> - : "" - } -
- -
- {this.state.viewPisBundle ?
-

-

Bundle

- {this.renderBundle(this.props.specialtyRxBundle)} -
: ""} + : +
+
+

Prescriber Document Status

+ +
+
+ Status: Documents successfully submitted +
+
+ + + {this.state.remsAdminResponse?.data?.case_number ? + this.setState({ spin: false })} + /> + : "" + } +
+ +
+ {this.state.viewBundle ?
+

+

Bundle

+ {this.renderBundle(this.props.specialtyRxBundle)} +
: ""} + +
+ }
:
-
-

Prescriber Document Status

- -
-
- Status: Documents successfully submitted -
-
- - - {this.state.remsAdminResponse?.data?.case_number ? - this.setState({ spin: false })} - /> - : "" - } -
- -
- {this.state.viewBundle ?
-

-

Bundle

- {this.renderBundle(this.props.specialtyRxBundle)} -
: ""} - -
+ No response - form has already been submitted previously....
} +
) } From e3e1f1940f218663c6abbac385e77e9765575d13 Mon Sep 17 00:00:00 2001 From: Sahil Malhotra Date: Thu, 9 Feb 2023 17:16:28 -0500 Subject: [PATCH 07/12] changed pims url --- src/components/RemsInterface/RemsInterface.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 53419799..21f796ba 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -110,9 +110,9 @@ export default class RemsInterface extends Component { let patient = this.getResource(this.props.specialtyRxBundle, patientReference); let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; - console.log(`http://localhost:5150/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`); + console.log(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`); - axios.get(`http://localhost:5150/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`, remsAdminResponse.data, this.getAxiosOptions()).then((response) => { + axios.get(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`, remsAdminResponse.data, this.getAxiosOptions()).then((response) => { this.setState({ response }); console.log(response); console.log(response.data); From 2d560e115ed8b57f2f9390960417f57f94893c28 Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Thu, 9 Feb 2023 14:23:15 -0800 Subject: [PATCH 08/12] updated integration --- .../RemsInterface/RemsInterface.jsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 21f796ba..d36972b9 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -110,7 +110,7 @@ export default class RemsInterface extends Component { let patient = this.getResource(this.props.specialtyRxBundle, patientReference); let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; - console.log(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`); + // console.log(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`); axios.get(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`, remsAdminResponse.data, this.getAxiosOptions()).then((response) => { this.setState({ response }); @@ -157,7 +157,29 @@ export default class RemsInterface extends Component { refreshPisBundle() { this.setState({ spinPis: true }); - axios.get(`http://localhost:3010/api/doctorOrder/${this.state.response.data.doctorOrder._id}`).then((response) => { + + let params = this.getResource(this.props.specialtyRxBundle, this.props.specialtyRxBundle.entry[0].resource.focus.parameters.reference); + + // stakeholder and medication references + let prescriptionReference = ""; + let patientReference = ""; + for (let param of params.parameter) { + if (param.name === "prescription") { + prescriptionReference = param.reference; + } + else if (param.name === "source-patient") { + patientReference = param.reference; + } + } + + // obtain drug information from database + let presciption = this.getResource(this.props.specialtyRxBundle, prescriptionReference); + let prescriptionDisplay = presciption.medicationCodeableConcept.coding[0].display.split(" ")[0]; + let patient = this.getResource(this.props.specialtyRxBundle, patientReference); + let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; + + axios.get(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`) + .then((response) => { this.setState({ response: response }); }) } From f2ce72aae58a81ab674945e52151078026dd9e9a Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Fri, 10 Feb 2023 13:29:47 -0800 Subject: [PATCH 09/12] updated fields for pims endpoint --- src/components/RemsInterface/RemsInterface.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index d36972b9..861e43a2 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -112,7 +112,7 @@ export default class RemsInterface extends Component { // console.log(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`); - axios.get(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`, remsAdminResponse.data, this.getAxiosOptions()).then((response) => { + axios.get(`http://localhost:5051/doctorOrders/api/getRx/patient/${patientName}/drug/${prescriptionDisplay}`, remsAdminResponse.data, this.getAxiosOptions()).then((response) => { this.setState({ response }); console.log(response); console.log(response.data); @@ -178,7 +178,7 @@ export default class RemsInterface extends Component { let patient = this.getResource(this.props.specialtyRxBundle, patientReference); let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; - axios.get(`http://localhost:5051/api/getRx/paitent/${patientName}/drug/${prescriptionDisplay}`) + axios.get(`http://localhost:5051/doctorOrders/api/getRx/patient/${patientName}/drug/${prescriptionDisplay}`) .then((response) => { this.setState({ response: response }); }) From fdbbac98ee66fc704424c1886b6e480e3b1db798 Mon Sep 17 00:00:00 2001 From: Sahil Malhotra Date: Fri, 10 Feb 2023 16:48:18 -0500 Subject: [PATCH 10/12] integration changes --- src/components/RemsInterface/RemsInterface.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 861e43a2..723ce749 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -269,14 +269,14 @@ export default class RemsInterface extends Component {
- ID : {this.state.response?.data?.doctorOrder?._id || "N/A"} + ID : {this.state.response?.data?._id || "N/A"}
- Status: {this.state.response?.data?.doctorOrder?.dispenseStatus} + Status: {this.state.response?.data?.dispenseStatus}
- - {this.state.response?.data?.doctorOrder?._id ? + {/* */} + {this.state.response?.data?._id ? Date: Fri, 10 Feb 2023 17:18:07 -0500 Subject: [PATCH 11/12] fix the color header --- src/components/RemsInterface/RemsInterface.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 723ce749..401e769e 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -178,7 +178,7 @@ export default class RemsInterface extends Component { let patient = this.getResource(this.props.specialtyRxBundle, patientReference); let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; - axios.get(`http://localhost:5051/doctorOrders/api/getRx/patient/${patientName}/drug/${prescriptionDisplay}`) + axios.get(`http://localhost:5051/ix s/api/getRx/patient/${patientName}/drug/${prescriptionDisplay}`) .then((response) => { this.setState({ response: response }); }) @@ -201,7 +201,7 @@ export default class RemsInterface extends Component { } let colorPis = "#f7f7f7" - const statusPis = this.state.response?.data?.doctorOrder?.dispenseStatus; + const statusPis = this.state.response?.data?.dispenseStatus; if (statusPis === "Approved") { colorPis = "#5cb85c" From 0c83ca8d512a653b6a48f196c18c6942b0d1d190 Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Mon, 13 Feb 2023 07:53:59 -0800 Subject: [PATCH 12/12] cat on keyboard --- src/components/RemsInterface/RemsInterface.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/RemsInterface/RemsInterface.jsx b/src/components/RemsInterface/RemsInterface.jsx index 401e769e..4f2129b0 100644 --- a/src/components/RemsInterface/RemsInterface.jsx +++ b/src/components/RemsInterface/RemsInterface.jsx @@ -178,7 +178,7 @@ export default class RemsInterface extends Component { let patient = this.getResource(this.props.specialtyRxBundle, patientReference); let patientName = patient.name[0].given[0] + ' ' + patient.name[0].family; - axios.get(`http://localhost:5051/ix s/api/getRx/patient/${patientName}/drug/${prescriptionDisplay}`) + axios.get(`http://localhost:5051/doctorOrders/api/getRx/patient/${patientName}/drug/${prescriptionDisplay}`) .then((response) => { this.setState({ response: response }); })