Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Testing from "./components/ConsoleBox/Testing";
import UserMessage from "./components/UserMessage/UserMessage";
import TaskPopup from "./components/Popup/TaskPopup";
import PatientSelect from "./components/PatientSelect/PatientSelect";
import RemsInterface from "./components/RemsInterface/RemsInterface";

// uncomment for testing UserMessage
// let sampleError = {
Expand All @@ -36,6 +37,7 @@ export default class App extends Component {
questionnaire: null,
response: null,
priorAuthClaim: null,
specialtyRxBundle: null,
cqlPrepopulationResults: null,
deviceRequest: null,
bundle: null,
Expand Down Expand Up @@ -349,6 +351,10 @@ export default class App extends Component {
this.setState({ priorAuthClaim: claimBundle });
}

setSpecialtyRxBundle(specialtyRxBundleParam) {
this.setState({ specialtyRxBundle: specialtyRxBundleParam });
}

getQuestionByName(question) {
//question should be the HTML node
const temp = question.getElementsByClassName("lf-item-code ng-hide")[0].innerText.trim();
Expand Down Expand Up @@ -595,8 +601,8 @@ export default class App extends Component {
>

</div>
{this.state.priorAuthClaim ? (
<PriorAuth claimBundle={this.state.priorAuthClaim} />
{this.state.specialtyRxBundle ? (
<RemsInterface specialtyRxBundle={this.state.specialtyRxBundle} />
) : (
<QuestionnaireForm
qform={this.state.questionnaire}
Expand All @@ -609,6 +615,7 @@ export default class App extends Component {
attested={this.state.attested}
priorAuthReq={this.props.priorAuthReq === "true" ? true : false}
setPriorAuthClaim={this.setPriorAuthClaim.bind(this)}
setSpecialtyRxBundle={this.setSpecialtyRxBundle.bind(this)}
fhirVersion={this.fhirVersion.toUpperCase()}
smart={this.smart}
FHIR_PREFIX={this.props.FHIR_PREFIX}
Expand Down
113 changes: 113 additions & 0 deletions src/components/QuestionnaireForm/QuestionnaireForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,120 @@ export default class QuestionnaireForm extends Component {
priorAuthBundle.signature = signature;
priorAuthBundle.entry.unshift({ resource: priorAuthClaim });

const specialtyRxBundle = JSON.parse(JSON.stringify(priorAuthBundle));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to keep the priorAuthBundle around? Can we just remove it and use the specialtyRxBundle exclusively or does REMS have some use for the priorAuthBundle?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its nice to show the synergy between the two but its ultimately not a part of this use case

specialtyRxBundle.type = "message";
if (this.makeReference(priorAuthBundle, "MedicationRequest")) {
const pharmacy = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a broader question but how is DTR supposed to know where to send this bundle? Will it be a config option or is it supposed to be dynamic and passed in when the app launches? Theoretically this resource or the MessageHeader should have the info on where to send it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now hard code it to send to the the PIS system at the following url:
localhost:3010/api/doctorOder/FHIR

resourceType: "Organization",
id: "pharm0111",
identifier: [
{
system: "http://hl7.org/fhir/sid/us-npi",
value: "1837247346"
},
{
system: "http://terminology.hl7.org/CodeSystem/NCPDPProviderIdentificationNumber",
value: "838283882"
}
],
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"]
}
]
}

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",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MessageHeader is missing required source field

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed at meeting, will be added in as part of REMS-86

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);


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.")
}
Expand Down
51 changes: 51 additions & 0 deletions src/components/RemsInterface/RemsInterface.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;

}
.left-form {
width: 50%;
float: left;
margin-top: 25px;
margin-left: 25px;
padding: 5px;
}

.resource-entry{
border-left: 4px solid #ffcccb;
padding: 5px;
margin-left: 10px;
border-bottom: 1px solid grey;
background-color: #ededed;
width: 800px;
}

.resource-entry:hover{
border-left: 4px solid #ff6663;
background-color: #fdfdfd;
}

.resource-entry.active{
border-left: 4px solid #ff6663;
background-color: #f5f5f5;
}

.details{
margin-left: 60px;
background-color: #ededed;
width: 750px;
}


.submit-btn {
float: right;
margin-top: 6px;
}


.submit-btn:hover{
border-width:1px 3px 1px 1px;
margin-left:2px;
margin-top:8px;
}
59 changes: 59 additions & 0 deletions src/components/RemsInterface/RemsInterface.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { Component } from "react";
import ResourceEntry from './ResourceEntry';
import "./RemsInterface.css";

import axios from "axios";
import { SystemUpdateTwoTone } from "@material-ui/icons";


export default class RemsInterface extends Component {
constructor(props) {
super(props);
this.state = {
claimResponseBundle: null,
};

this.getAxiosOptions = this.getAxiosOptions.bind(this);
this.sendMessage = this.sendMessage.bind(this);
this.renderBundle= this.renderBundle.bind(this);
}
getAxiosOptions() {
const options = {
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
};
return options;
}

sendMessage(destination) {
console.log(this.props.specialtyRxBundle);
axios.post(destination, this.props.specialtyRxBundle, this.getAxiosOptions());
}

renderBundle() {
return this.props.specialtyRxBundle.entry.map((entry) => {
const resource = entry.resource;
console.log(resource);
return(
<div>
<ResourceEntry resource={resource}></ResourceEntry>
</div>
)
})
}
render() {
return (
<div>
<div className="container left-form">
{this.renderBundle()}
<button className="submit-btn" onClick={()=>{this.sendMessage("http://localhost:3010/api/doctorOder/FHIR")}}>Submit</button>

</div>
<div className="right-form">
</div>
</div>
)
}
}
33 changes: 33 additions & 0 deletions src/components/RemsInterface/ResourceEntry.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, {Component} from 'react'
import "./RemsInterface.css";

export default class ResourceEntry extends Component {
constructor(props) {
super(props);
this.state = {
viewDetails: null,
};
this.openDetails = this.openDetails.bind(this);

}


openDetails() {

this.setState((prevState) => {
return { viewDetails: !prevState.viewDetails };
})


}
render() {
return (
<div>
<div className={"resource-entry " + [this.state.viewDetails ? "active" : ""]} onClick={this.openDetails}>
<div>{this.props.resource["resourceType"]}</div>
</div>
{this.state.viewDetails ? <div className="details"><pre>{JSON.stringify(this.props.resource,null,'\t')}</pre></div> : null}
</div>
)
}
}