From 15db0e6705c3defc80e286657ca66709eee815b1 Mon Sep 17 00:00:00 2001 From: Patrick LaRocque <41444457+plarocque4@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:32:31 -0400 Subject: [PATCH] Add ability to deidentify Patient and Coverage resources. (#70) * DMEERX-367: IG - Add support for PHI and Hook Invocation * Only deidentify the patient and coverage if box is checked. * Remove the telecom key from the Patient resource. Make sure only one deidentified profile can be found in the patient meta. * Fix issue with duplicate profile in the coverage as well. * Fix issue with deselecting deidentify resources still sends deidentified resources. Make a deep copy of the data to not change the original when deidentifying the resources. --- package.json | 1 + src/components/RequestBox/RequestBox.js | 25 +++++++-- src/containers/RequestBuilder.js | 4 +- src/util/buildRequest.js | 34 ++++++++++- src/util/deidentifyCoverage.js | 39 +++++++++++++ src/util/deidentifyPatient.js | 75 +++++++++++++++++++++++++ 6 files changed, 170 insertions(+), 8 deletions(-) create mode 100644 src/util/deidentifyCoverage.js create mode 100644 src/util/deidentifyPatient.js diff --git a/package.json b/package.json index 65328ff5..8ffe2508 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "axios": "^0.18.0", "base64url": "^3.0.0", "classnames": "^2.2.6", + "clone": "^2.1.2", "fhirclient": "^2.3.1", "json-server": "^0.16.3", "jsrsasign": "^10.2.0", diff --git a/src/components/RequestBox/RequestBox.js b/src/components/RequestBox/RequestBox.js index 6232cd93..1c4375b2 100644 --- a/src/components/RequestBox/RequestBox.js +++ b/src/components/RequestBox/RequestBox.js @@ -2,6 +2,7 @@ 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 { defaultValues, shortNameMap } from "../../util/data"; import { getAge } from "../../util/fhir"; import _ from "lodash"; @@ -23,7 +24,8 @@ export default class RequestBox extends Component { display: null, request: {}, gatherCount: 0, - response: {} + response: {}, + deidentifyRecords: false }; this.renderRequestResources = this.renderRequestResources.bind(this); @@ -33,6 +35,7 @@ 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 @@ -42,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.props.submitInfo(prefetch, request, this.state.patient, "order-sign", this.state.deidentifyRecords); } componentDidMount() {} @@ -68,7 +71,8 @@ export default class RequestBox extends Component { this.prepPrefetch(), this.state.request, this.state.patient, - "order-sign" + "order-sign", + this.state.deidentifyRecords ); } }; @@ -326,6 +330,10 @@ export default class RequestBox extends Component { return Object.keys(this.state.request).length === 0; } + updateDeidentifyCheckbox(elementName, value) { + this.setState({ deidentifyRecords: value }); + } + render() { const params = {}; params['serverUrl'] = this.props.ehrUrl; @@ -379,8 +387,15 @@ export default class RequestBox extends Component {
{this.renderPatientInfo()} {this.renderPrefetchedResources()} -
- + +
+ Deidentify Records + +