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
9 changes: 0 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"lodash": "^4.17.21",
"moment": "^2.26.0",
"nodemailer": "^6.4.16",
"sha.js": "^2.4.9",
"winston": "^3.2.1"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/helpers/patientUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-underscore-dangle */
const fhirpath = require('fhirpath');
const shajs = require('sha.js');
const crypto = require('crypto');
const { extensionArr, dataAbsentReasonExtension } = require('../templates/snippets/extension.js');

// Based on the OMB Ethnicity table found here:http://hl7.org/fhir/us/core/STU3.1/ValueSet-omb-ethnicity-category.html
Expand Down Expand Up @@ -104,7 +104,9 @@ function maskPatientData(bundle, mask) {
patient._gender = masked;
} else if (field === 'mrn' && 'identifier' in patient) {
// id and fullURL still need valid values, so we use a hashed version of MRN instead of dataAbsentReason
const maskedMRN = shajs('sha256').update(patient.id).digest('hex');
const hash = crypto.createHash('sha256');
const maskedMRN = hash.update(patient.id).digest('hex');

patient.id = maskedMRN;
const patientEntry = fhirpath.evaluate(
bundle,
Expand Down
5 changes: 3 additions & 2 deletions src/templates/ResourceGenerator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require('lodash');
const shajs = require('sha.js');
const crypto = require('crypto');
const logger = require('../helpers/logger');

const { adverseEventTemplate } = require('./AdverseEventTemplate');
Expand Down Expand Up @@ -36,7 +36,8 @@ function loadFhirTemplate(mcodeProfileID) {

// Hash a data object to get a unique, deterministic ID for it
function generateResourceId(data) {
return shajs('sha256').update(JSON.stringify(data)).digest('hex');
const hash = crypto.createHash('sha256');
return hash.update(JSON.stringify(data)).digest('hex');
}

// Ensures that empty data in the resource object carries a null value, rather than being undefined or an empty string
Expand Down