Skip to content
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
690 changes: 326 additions & 364 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"axios": "^0.18.0",
"base64url": "^3.0.0",
"classnames": "^2.2.6",
"clone": "^2.1.2",
"dotenv": "^16.3.1",
"env-var": "^7.3.1",
"fhirclient": "^2.3.1",
Expand Down
27 changes: 4 additions & 23 deletions src/components/RequestBox/RequestBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { Component } from "react";
import FHIR from "fhirclient";
import SMARTBox from "../SMARTBox/SMARTBox";
import PatientBox from "../SMARTBox/PatientBox";
import CheckBox from '../Inputs/CheckBox';
import { types, defaultValues, shortNameMap } from "../../util/data";
import { getAge } from "../../util/fhir";
import buildNewRxRequest from '../../util/buildScript.2017071.js';
Expand All @@ -28,8 +27,7 @@ export default class RequestBox extends Component {
display: null,
request: {},
gatherCount: 0,
response: {},
deidentifyRecords: false
response: {}
};

this.renderRequestResources = this.renderRequestResources.bind(this);
Expand All @@ -39,7 +37,6 @@ export default class RequestBox extends Component {
this.renderPrefetchedResources = this.renderPrefetchedResources.bind(this);
this.renderError = this.renderError.bind(this);
this.buildLaunchLink = this.buildLaunchLink.bind(this);
this.updateDeidentifyCheckbox = this.updateDeidentifyCheckbox.bind(this);
}

// TODO - see how to submit response for alternative therapy
Expand All @@ -48,7 +45,7 @@ export default class RequestBox extends Component {
// Prepare the prefetch.
const prefetch = this.prepPrefetch();
// Submit the CRD request.
this.props.submitInfo(prefetch, request, this.state.patient, "order-sign", this.state.deidentifyRecords);
this.props.submitInfo(prefetch, request, this.state.patient, "order-sign");
}

componentDidMount() {}
Expand Down Expand Up @@ -80,8 +77,7 @@ export default class RequestBox extends Component {
this.prepPrefetch(),
this.state.request,
this.state.patient,
"order-sign",
this.state.deidentifyRecords
"order-sign"
);
}
};
Expand Down Expand Up @@ -422,10 +418,6 @@ export default class RequestBox extends Component {
return Object.keys(this.state.patient).length === 0;
}

updateDeidentifyCheckbox(elementName, value) {
this.setState({ deidentifyRecords: value });
}

render() {
const params = {};
params['serverUrl'] = this.props.ehrUrl;
Expand Down Expand Up @@ -481,18 +473,7 @@ export default class RequestBox extends Component {
<div>
{this.renderPatientInfo()}
{this.renderPrefetchedResources()}
</div>

{this.state.patient.id ?
<div>
<b>Deidentify Records</b>
<CheckBox
toggle = {this.state.deidentifyRecords}
updateCB={this.updateDeidentifyCheckbox}
elementName = "deidentifyCheckbox"
/>
</div> : <div/>
}
</div>
</div>
</div>
{this.state.patient.id ?
Expand Down
4 changes: 2 additions & 2 deletions src/containers/RequestBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ export default class RequestBuilder extends Component {
return controller;
}

submit_info(prefetch, request, patient, hook, deidentifyRecords) {
submit_info(prefetch, request, patient, hook) {
this.setState({loading: true});
this.consoleLog("Initiating form submission", types.info);
this.setState({patient});
const hookConfig = {
"includeConfig": this.state.includeConfig,
"alternativeTherapy": this.state.alternativeTherapy
}
let json_request = buildRequest(request, patient, this.state.ehrUrl, this.state.token, prefetch, this.state.sendPrefetch, hook, hookConfig, deidentifyRecords);
let json_request = buildRequest(request, patient, this.state.ehrUrl, this.state.token, prefetch, this.state.sendPrefetch, hook, hookConfig);
let cdsUrl = this.state.cdsUrl;
if (hook === "order-sign") {
cdsUrl = cdsUrl + "/" + this.state.orderSign;
Expand Down
852 changes: 0 additions & 852 deletions src/db.json

This file was deleted.

34 changes: 1 addition & 33 deletions src/util/buildRequest.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@

import deidentifyPatient from "./deidentifyPatient";
import deidentifyCoverage from "./deidentifyCoverage";
import clone from 'clone'


export default function buildRequest(request, patient, ehrUrl, token, prefetch, includePrefetch, hook, hookConfig, deidentifyRecords) {
if (deidentifyRecords) {
// make a copy of the resources before modifying
let newPrefetch = clone(prefetch);

console.log("Deidentify Patient and Coverage Resources to remove PHI");
// loop through the prefetch looking for the patient and the coverage
newPrefetch.forEach((bundle) => {
bundle.forEach((resource) => {
let resourceType = resource.resource.resourceType;
if (resourceType === "Patient") {
// deidentify the patient
let patient = deidentifyPatient(resource.resource);
// replace the patient resource with the deidentified version
resource.resource = patient
} else if (resourceType === "Coverage") {
// deidentify the coverage
let coverage = deidentifyCoverage(resource.resource);
// replace the coverage resource with the deidentified version
resource.resource = coverage
}
})
});

// set the prefetch reference to the modified copy
prefetch = newPrefetch
}

export default function buildRequest(request, patient, ehrUrl, token, prefetch, includePrefetch, hook, hookConfig) {
const r4json = {
"hookInstance": "d1577c69-dfbe-44ad-ba6d-3e05e953b2ea",
"fhirServer": ehrUrl,
Expand Down
39 changes: 0 additions & 39 deletions src/util/deidentifyCoverage.js

This file was deleted.

75 changes: 0 additions & 75 deletions src/util/deidentifyPatient.js

This file was deleted.