-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from rmngrc/accepting-multiple-definitions-of-o…
…ne-kind Supporting many definitions of one kind
- Loading branch information
Showing
3 changed files
with
152 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"format": "hl7-2.4", | ||
"adapter": "default", | ||
"mapping": { | ||
"msh": { | ||
"values": [ | ||
{ "field": "msh.message_datetime", "component": [5,1] }, | ||
{ "field": "msh.message_type", "component": [7,1] }, | ||
{ "field": "msh.message_type_ref", "component": [7,2] }, | ||
{ "field": "msh.message_control_id", "component": [8,1] } | ||
] | ||
}, | ||
"pid": { | ||
"values": [ | ||
{ "field": "pid.id", "component": [3,1] }, | ||
{ "field": "pid.origin", "component": [3,4] }, | ||
{ "field": "pid.first_name", "component": [5,2] }, | ||
{ "field": "pid.last_name", "component": [5,1] }, | ||
{ "field": "pid.birthdate", "component": [7,1] }, | ||
{ "field": "pid.gender", "component": [8,1] }, | ||
{ "field": "pid.street_name", "component": [11,1] }, | ||
{ "field": "pid.city", "component": [11,3] }, | ||
{ "field": "pid.zip_code", "component": [11,5] }, | ||
{ "field": "pid.phone", "component": [13,1] }, | ||
{ "field": "pid.email", "component": [13,4] } | ||
] | ||
}, | ||
"orc": { | ||
"values": [ | ||
{ "field": "orc.order_control", "component": [1,1] }, | ||
{ "field": "orc.order_number", "component": [2,1] }, | ||
{ "field": "orc.order_status", "component": [5,1] }, | ||
{ "field": "orc.response_flag", "component": [6,1] }, | ||
{ "field": "orc.timestamp", "component": [9,1] }, | ||
{ "field": "orc.entered_by", "component": [10,8] }, | ||
{ "field": "orc.ordering_provider", "component": [12,8] }, | ||
{ "field": "orc.enterers_location", "component": [13,1] } | ||
] | ||
}, | ||
"obr": { | ||
"values": [ | ||
{ "field": "obr.id", "component": [1,1] }, | ||
{ "field": "obr.order_id", "component": [2,1] }, | ||
{ "field": "obr.file_number", "component": [3,1] }, | ||
{ "field": "obr.universal_service_id", "component": [4,1] }, | ||
{ "field": "obr.priority", "component": [5,1] }, | ||
{ "field": "obr.timestamp", "component": [7,1] }, | ||
{ "field": "obr.collector_id", "component": [10,1] } | ||
] | ||
}, | ||
"obx": { | ||
"values": [ | ||
{ "field": "obx.id", "component": [1,1] }, | ||
{ "field": "obx.type", "component": [2,1] }, | ||
{ "field": "obx.observation_id", "component": [3,1] }, | ||
{ "field": "obx.text", "component": [3,2] }, | ||
{ "field": "obx.value", "component": [5,1] }, | ||
{ "field": "obx.unit", "component": [6,1] }, | ||
{ "field": "obx.ranges", "component": [7,1] }, | ||
{ "field": "obx.status", "component": [11,1] }, | ||
{ "field": "obx.timestamp", "component": [14,1] }, | ||
{ "field": "obx.laboratory", "component": [15,1] } | ||
] | ||
}, | ||
"nte": { | ||
"values": [ | ||
{ "field": "nte.id", "component": [1,1] }, | ||
{ "field": "nte.source", "component": [2,1] }, | ||
{ "field": "nte.comment", "component": [3,1] } | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import test from 'ava' | ||
import {decode} from '../../src/lib/parser' | ||
import r01Mapping from './config/r01.json' | ||
|
||
test(`ORU - Notification of new observation result`, t => { | ||
const r01 = `MSH|^~\&|LCS|LCA|LIS|TEST9999|199807311532||ORU^R01|3629|P|2.2\rPID|2|2161348462|20809880170|1614614|20809880170^TESTPAT||19760924|M|||^^^^\r00000-0000|||||||86427531^^^03|SSN# HERE\rORC|NW|8642753100012^LIS|20809880170^LCS||||||19980727000000|||HAVILAND\rOBR|1|8642753100012^LIS|20809880170^LCS|008342^UPPER RESPIRATORY\rCULTURE^L|||19980727175800||||||SS#634748641 CH14885 SRC:THROA\rSRC:PENI|19980727000000||||||20809880170||19980730041800||BN|F\rOBX|1|ST|008342^UPPER RESPIRATORY CULTURE^L||FINALREPORT|||||N|F||| 19980729160500|BN\rORC|NW|8642753100012^LIS|20809880170^LCS||||||19980727000000|||HAVILAND\rOBR|2|8642753100012^LIS|20809880170^LCS|997602^.^L|||19980727175800||||G|||\r19980727000000||||||20809880170||19980730041800|||F|997602|||008342\rOBX|2|CE|997231^RESULT 1^L||M415|||||N|F|||19980729160500|BN\rNTE|1|L|MORAXELLA (BRANHAMELLA) CATARRHALIS\rNTE|2|L| HEAVY GROWTH\rNTE|3|L| BETA LACTAMASE POSITIVE\rOBX|3|CE|997232^RESULT 2^L||MR105|||||N|F|||19980729160500|BN\rNTE|1|L|ROUTINE RESPIRATORY FLORA` | ||
const obj = decode(r01, r01Mapping) | ||
t.is(obj.msh.message_datetime, '199807311532') | ||
t.is(obj.msh.message_type, 'ORU') | ||
t.is(obj.msh.message_type_ref, 'R01') | ||
t.is(obj.msh.message_control_id, '3629') | ||
t.is(obj.pid.id, '20809880170') | ||
t.is(obj.pid.origin, '') | ||
t.is(obj.pid.first_name, 'TESTPAT') | ||
t.is(obj.pid.last_name, '20809880170') | ||
t.is(obj.pid.birthdate, '19760924') | ||
t.is(obj.pid.gender, 'M') | ||
t.is(obj.pid.street_name, '') | ||
t.is(obj.pid.city, '') | ||
t.is(obj.pid.zip_code, '') | ||
t.is(obj.pid.phone, '') | ||
t.is(obj.pid.email, '') | ||
t.is(obj.nte.length, 4) | ||
t.is(obj.nte[0].id, '1') | ||
t.is(obj.nte[0].source, 'L') | ||
t.is(obj.nte[0].comment, 'MORAXELLA (BRANHAMELLA) CATARRHALIS') | ||
t.is(obj.nte[1].id, '2') | ||
t.is(obj.nte[1].source, 'L') | ||
t.is(obj.nte[1].comment, ' HEAVY GROWTH') | ||
t.is(obj.nte[2].id, '3') | ||
t.is(obj.nte[2].source, 'L') | ||
t.is(obj.nte[2].comment, ' BETA LACTAMASE POSITIVE') | ||
t.is(obj.nte[3].id, '1') | ||
t.is(obj.nte[3].source, 'L') | ||
t.is(obj.nte[3].comment, 'ROUTINE RESPIRATORY FLORA') | ||
t.is(obj.orc.length, 2) | ||
t.is(obj.obr.length, 2) | ||
t.is(obj.obx.length, 3) | ||
}) |