From 451541663509bca735c8302b73e488cde3b7bb04 Mon Sep 17 00:00:00 2001 From: julianxcarter Date: Tue, 5 Oct 2021 13:46:18 -0400 Subject: [PATCH 1/4] Picker for patient mask fields --- react-app/src/components/Extractor.js | 46 +++++++++++++++++---------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/react-app/src/components/Extractor.js b/react-app/src/components/Extractor.js index b154bfa..4b123c5 100644 --- a/react-app/src/components/Extractor.js +++ b/react-app/src/components/Extractor.js @@ -57,7 +57,7 @@ function Extractor(props) { validExtractors: ['CSVCancerDiseaseStatusExtractor'], }, { - mask: props.formData.constructorArgs.mask ? props.formData.constructorArgs.mask : '', + mask: props.formData.constructorArgs.mask ? props.formData.constructorArgs.mask : [], label: 'Masked Fields', type: 'dropdown', included: false, @@ -87,6 +87,17 @@ function Extractor(props) { props.onArgsChange(constructorArgs); } + // Handles updates to multi-select arg fields such as "mask" + function updateOptions(argObj, changedValue, propertyName) { + const currentOptions = argObj[propertyName]; + const changedIndex = currentOptions.indexOf(changedValue); + if (changedIndex > -1) { + currentOptions.splice(changedIndex, 1); + } else { + currentOptions.push(changedValue); + } + } + const getArg = (newArgs, key) => newArgs.find((temp) => key === temp.key); function getArgsJSX() { @@ -205,22 +216,25 @@ function Extractor(props) {
{arg.label}
- - Enter field(s) as a list separated by a commas. The options are gender, mrn, name, address, birthDate, - language, ethnicity, birthsex, and race. - + Select fields to be masked in the extracted Patient resource
- { - const newArgs = [...args]; - const currentArg = getArg(newArgs, arg.key); - currentArg[arg.key] = e.target.value; - updateArgs(newArgs); - }} - className="arg-input-width-limit" - /> + {arg.options.map((option) => ( + { + const newArgs = [...args]; + const currentArg = getArg(newArgs, arg.key); + updateOptions(currentArg, e.target.value, arg.key); + updateArgs(newArgs); + }} + /> + ))} { const newArgs = [...args]; From 36f45af24aef7d55e6fe1d002254a79a4c1ffa1a Mon Sep 17 00:00:00 2001 From: julianxcarter Date: Tue, 5 Oct 2021 14:04:57 -0400 Subject: [PATCH 2/4] Mask options to-be now included in the picker --- react-app/src/components/Extractor.js | 59 +++++++++++++++++---------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/react-app/src/components/Extractor.js b/react-app/src/components/Extractor.js index 4b123c5..4123c35 100644 --- a/react-app/src/components/Extractor.js +++ b/react-app/src/components/Extractor.js @@ -62,7 +62,24 @@ function Extractor(props) { type: 'dropdown', included: false, key: 'mask', - options: ['gender', 'mrn', 'name', 'address', 'birthDate', 'language', 'ethnicity', 'birthsex', 'race'], + options: [ + 'gender', + 'mrn', + 'name', + 'address', + 'birthDate', + 'language', + 'ethnicity', + 'birthsex', + 'race', + 'telecom', + 'multipleBirth', + 'photo', + 'contact', + 'generalPractitioner', + 'managingOrganization', + 'link', + ], validExtractors: ['CSVPatientExtractor'], }, ]; @@ -213,28 +230,9 @@ function Extractor(props) { case 'dropdown': return ( -
- {arg.label} -
- Select fields to be masked in the extracted Patient resource
- {arg.options.map((option) => ( - { - const newArgs = [...args]; - const currentArg = getArg(newArgs, arg.key); - updateOptions(currentArg, e.target.value, arg.key); - updateArgs(newArgs); - }} - /> - ))} + {arg.label} + Select fields to be masked in the extracted Patient resource { const newArgs = [...args]; @@ -245,6 +243,23 @@ function Extractor(props) { className="mouse-pointer" />
+
+ {arg.options.map((option) => ( + { + const newArgs = [...args]; + const currentArg = getArg(newArgs, arg.key); + updateOptions(currentArg, e.target.value, arg.key); + updateArgs(newArgs); + }} + /> + ))}
); default: From 52b0846428b36f84a4aff0dbe885a35f763148e9 Mon Sep 17 00:00:00 2001 From: julianxcarter Date: Tue, 5 Oct 2021 14:07:57 -0400 Subject: [PATCH 3/4] Stray div removed --- react-app/src/components/Extractor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/react-app/src/components/Extractor.js b/react-app/src/components/Extractor.js index 4123c35..98ede77 100644 --- a/react-app/src/components/Extractor.js +++ b/react-app/src/components/Extractor.js @@ -243,7 +243,6 @@ function Extractor(props) { className="mouse-pointer" />
-
{arg.options.map((option) => ( Date: Fri, 8 Oct 2021 12:04:55 -0400 Subject: [PATCH 4/4] Id prop added to Form.Check component, MEF version updated --- package-lock.json | 27 ++++----------------------- react-app/src/components/Extractor.js | 1 + 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 821af5d..d207896 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "mcode-extraction-ui", "version": "0.0.1", "license": "Apache-2.0", "dependencies": { @@ -4599,8 +4600,8 @@ } }, "node_modules/mcode-extraction-framework": { - "version": "1.0.1", - "resolved": "git+ssh://git@github.com/mcode/mcode-extraction-framework.git#a92a233df44b59529fd3bd2ba2f0aac3aa3f649e", + "version": "1.1.0", + "resolved": "git+ssh://git@github.com/mcode/mcode-extraction-framework.git#806d3bcd60cdbd64a1a35508b7de26a19263f464", "license": "Apache-2.0", "dependencies": { "ajv": "^6.12.6", @@ -4613,7 +4614,6 @@ "lodash": "^4.17.21", "moment": "^2.26.0", "nodemailer": "^6.4.16", - "sha.js": "^2.4.9", "winston": "^3.2.1" } }, @@ -6419,17 +6419,6 @@ "dev": true, "license": "ISC" }, - "node_modules/sha.js": { - "version": "2.4.11", - "license": "(MIT AND BSD-3-Clause)", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "dev": true, @@ -10754,7 +10743,7 @@ } }, "mcode-extraction-framework": { - "version": "git+ssh://git@github.com/mcode/mcode-extraction-framework.git#a92a233df44b59529fd3bd2ba2f0aac3aa3f649e", + "version": "git+ssh://git@github.com/mcode/mcode-extraction-framework.git#806d3bcd60cdbd64a1a35508b7de26a19263f464", "from": "mcode-extraction-framework@github:mcode/mcode-extraction-framework#develop", "requires": { "ajv": "^6.12.6", @@ -10767,7 +10756,6 @@ "lodash": "^4.17.21", "moment": "^2.26.0", "nodemailer": "^6.4.16", - "sha.js": "^2.4.9", "winston": "^3.2.1" }, "dependencies": { @@ -11955,13 +11943,6 @@ "version": "2.0.0", "dev": true }, - "sha.js": { - "version": "2.4.11", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, "shebang-command": { "version": "2.0.0", "dev": true, diff --git a/react-app/src/components/Extractor.js b/react-app/src/components/Extractor.js index 98ede77..c97c76f 100644 --- a/react-app/src/components/Extractor.js +++ b/react-app/src/components/Extractor.js @@ -250,6 +250,7 @@ function Extractor(props) { type="checkbox" value={option} key={`mask-${option}`} + id={`mask-${option}`} className="arg-input-width-limit" onChange={(e) => { const newArgs = [...args];