Skip to content

Commit 4c007d8

Browse files
authored
Merge pull request #113 from mcode/develop
Develop
2 parents 6d081f0 + 256919d commit 4c007d8

File tree

86 files changed

+8807
-4224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+8807
-4224
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ A Node.js framework for extracting mCODE FHIR resources. All resources are profi
1919
- [Masking Patient Data](#masking-patient-data)
2020
- [Extraction Date Range](#extraction-date-range)
2121
- [CLI From-Date and To-Date (NOT recommended use)](#cli-from-date-and-to-date-not-recommended-use)
22+
- [Troubleshooting](#troubleshooting)
23+
- [Byte Order Markers in CSV Files](#byte-order-markers-in-csv-files)
2224
- [Terminology and Architecture](#terminology-and-architecture)
2325
- [Glossary](#glossary)
2426
- [High Level Diagram](#high-level-diagram)
@@ -58,13 +60,13 @@ const cancerDiseaseStatusExtractor = new CSVCancerDiseaseStatusExtractor('path-t
5860
The framework also contains the [MCODEClient](src/client/MCODEClient.js) which has registered all of the extractors in this repo. Once you have exported CSV data and updated your configuration file, use the mCODE Extraction client by running the following:
5961

6062
```bash
61-
node src/cli/cli.js [options]
63+
npm start -- [options]
6264
```
6365

6466
To see all the options that can be used with the mCODE client, run the following:
6567

6668
```bash
67-
node src/cli/cli.js --help
69+
npm start -- --help
6870
```
6971

7072
### First Time User Guide
@@ -125,7 +127,7 @@ Whenever the mCODE Extraction Client successfully runs with the `--entries-filte
125127
Users can specify a different location for the file by using the `--run-log-filepath <path>` CLI option. Users will need to create this file before running the mCODE Extraction Client with `--entries-filter` and a date range. Initially, this file's contents should be an empty array, `[]`. For example:
126128

127129
```bash
128-
node src/cli/cli.js --entries-filter --from-date YYYY-MM-DD --to-date YYY-MM-DD --run-log-filepath path/to/file.json
130+
npm start -- --entries-filter --from-date YYYY-MM-DD --to-date YYY-MM-DD --run-log-filepath path/to/file.json
129131
```
130132

131133
### Masking Patient Data
@@ -158,9 +160,21 @@ If any filtering on data elements in CSV files is required, the `entries-filter`
158160
If a `from-date` is provided as an option when running the mCODE Extraction Client, it will be used to filter out any data elements that are recorded before that date based on the `dateRecorded` column in the CSV files. If a `to-date` is provided as an option, it will be used to filter out any data elements that are recorded after that date based on the `dateRecorded` column in the CSV files. If no `to-date` is provided, the default is today. If no `from-date` is provided, the mCODE Extraction Client will look to a run log file (details [above](#Logging-Successful-Extractions)) to find the most recent run and use the `to-date` of that run as the `from-date` for the current run, allowing users to only run the extraction on data elements that were not included in previous runs. If there are no previous run times logged, a `from-date` needs to be provided when running the extraction when the `entries-filter` option is provided. If the `entries-filter` option is not provided, any `from-date` and `to-date` options will be ignored, none of the data elements will be filtered by date, and a successful run will not be logged since there is no specified date range. An example running the client with the `from-date` and `to-date` is as follows:
159161

160162
```bash
161-
node src/cli/cli.js --entries-filter --from-date <YYYY-MM-DD> --to-date <YYYY-MM-DD> --config-filepath <path>
163+
npm start -- --entries-filter --from-date <YYYY-MM-DD> --to-date <YYYY-MM-DD> --config-filepath <path>
162164
```
163165

166+
### Troubleshooting
167+
168+
#### Byte Order Markers in CSV Files
169+
170+
The extraction client has built-in handling of byte order markers for CSV files in UTF-8 and UTF-16LE encodings. When using CSV files in other encodings, if you experience unexpected errors be sure to check for a byte order marker at the beginning of the file. One way to check is to run the following command from the command line:
171+
172+
```bash
173+
cat -v <file.csv>
174+
```
175+
176+
If there is an unexpected symbol at the beginning of the file, then there may be a byte order marker that needs to be removed.
177+
164178
## Terminology and Architecture
165179

166180
This framework consists of three key components: Extractors, Modules and Templates. Below is, in order:

config/csv.config.example.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
},
1414
"extractors": [
1515
{
16-
"label": "condition",
17-
"type": "CSVConditionExtractor",
16+
"label": "patient",
17+
"type": "CSVPatientExtractor",
1818
"constructorArgs": {
19-
"filePath": "./data/condition-information.csv"
19+
"filePath": "./data/patient-information.csv"
2020
}
2121
},
2222
{
23-
"label": "patient",
24-
"type": "CSVPatientExtractor",
23+
"label": "condition",
24+
"type": "CSVConditionExtractor",
2525
"constructorArgs": {
26-
"filePath": "./data/patient-information.csv"
26+
"filePath": "./data/condition-information.csv"
2727
}
2828
},
2929
{

docs/CSV_Templates.xlsx

-30.3 KB
Binary file not shown.

docs/adverse-event.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mrn,adverseEventId,adverseEventCode,adverseEventCodeSystem,adverseEventDisplayText,suspectedCauseId,suspectedCauseType,seriousness,seriousnessCodeSystem,seriousnessDisplayText,category,categoryCodeSystem,categoryDisplayText,severity,actuality,studyId,effectiveDate,recordedDate
22
mrn-full-example,example-id-1,event-code,code-system,code-display,cause-id,resourceType,seriousness-code,code-system,seriousness-display,category-code,code-system,category-dislpay,mild,actual,id,1994-12-09,1994-12-09
3-
mrn-two-category-example,example-id-1,event-code,code-system,code-display,cause-id,resourceType,seriousness-code,code-system,seriousness-display,category-code|category-code,code-system|code-system,category-display|category-display,mild,actual,id,1994-12-09,1994-12-09
3+
mrn-two-category-example,example-id-2,event-code,code-system,code-display,cause-id,resourceType,seriousness-code,code-system,seriousness-display,category-code|category-code,code-system|code-system,category-display|category-display,mild,actual,id,1994-12-09,1994-12-09
44
mrn-minimal-example,,code-from-default-system,,,,,,,,,,,,,,1994-12-09,

docs/observation.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mrn,observationId,status,code,codeSystem,displayName,value,valueCodeSystem,effectiveDate,bodySite,laterality
2-
mrn-1,example-id,example-status,example-code,example-system,example-name,example-value,example-system,YYYY-MM-DD,example-site,example-laterality
3-
mrn-2,example-id,example-status,example-code,example-system,example-name,example-value,example-system,YYYY-MM-DD,example-site,example-laterality
2+
mrn-1,example-id-1,example-status,example-code,example-system,example-name,example-value,example-system,YYYY-MM-DD,example-site,example-laterality
3+
mrn-2,example-id-2,example-status,example-code,example-system,example-name,example-value,example-system,YYYY-MM-DD,example-site,example-laterality

docs/procedure.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mrn,procedureId,conditionId,status,code,codeSystem,displayName,reasonCode,reasonCodeSystem,reasonDisplayName,effectiveDate,bodySite,laterality,treatmentIntent
2-
mrn-1,example-id,example-condition-id,example-status,example-code,example-system,example-name,example-reason-code,example-system,example-reason-display,YYYY-MM-DD,example-site,example-laterality,example-treatment-intent
3-
mrn-2,example-id,example-condition-id,example-status,example-code,example-system,example-name,example-reason-code,example-system,example-reason-display,YYYY-MM-DD,example-site,example-laterality,example-treatment-intent
2+
mrn-1,example-id-1,example-condition-id-1,example-status,example-code,example-system,example-name,example-reason-code,example-system,example-reason-display,YYYY-MM-DD,example-site,example-laterality,example-treatment-intent
3+
mrn-2,example-id-2,example-condition-id-2,example-status,example-code,example-system,example-name,example-reason-code,example-system,example-reason-display,YYYY-MM-DD,example-site,example-laterality,example-treatment-intent

docs/treatment-plan-change.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
mrn,reasonCode,changed,dateOfCarePlan,dateRecorded
2-
mrn-1,281647001,true,2020-04-15,2020-05-01
3-
mrn-2,281647001,true,2020-03-30,2020-05-01
1+
mrn,reasonCode,reasonDisplayText,changed,dateOfCarePlan,dateRecorded
2+
mrn-1,281647001,Adverse reaction (disorder),true,2020-04-15,2020-05-01
3+
mrn-2,,,false,2020-03-30,2020-05-01

0 commit comments

Comments
 (0)