blue-button-match
Advanced tools
Comparing version 1.1.0-beta.4 to 1.1.0-beta.5
@@ -6,2 +6,3 @@ "use strict"; | ||
var utils = require('./utils.js'); | ||
var _ = require('underscore'); | ||
@@ -16,2 +17,3 @@ //Full comparison of two demographics JSON elements for equality and/or diff | ||
"match": "duplicate", | ||
"percent": 100, | ||
"src_id": 0, | ||
@@ -24,2 +26,3 @@ "dest_id": 0 | ||
"match": "new", | ||
"percent": 0, | ||
"src_id": 0, | ||
@@ -31,2 +34,3 @@ "dest_id": 0 | ||
"match": "duplicate", | ||
"percent": 100, | ||
"src_id": 0, | ||
@@ -39,4 +43,15 @@ "dest_id": 0 | ||
var pctOutput = 0; | ||
var pctTotal = _.values(diff); | ||
var pctDiff = _.groupBy(pctTotal, function (num) { | ||
return num; | ||
}); | ||
if (_.isObject(pctDiff.duplicate)) { | ||
pctOutput = Math.round((pctDiff.duplicate.length / pctTotal.length) * 100); | ||
} | ||
return { | ||
"match": "diff", | ||
"match": "partial", | ||
"percent": pctOutput, | ||
"diff": diff, | ||
@@ -43,0 +58,0 @@ "src_id": 0, |
@@ -6,8 +6,8 @@ { | ||
"percent": 25 | ||
}], | ||
"secondary": [{ | ||
}, { | ||
"path": "date_time", | ||
"type": "dateTime", | ||
"percent": 25 | ||
}] | ||
}], | ||
"secondary": [] | ||
} |
@@ -6,8 +6,8 @@ { | ||
"percent": 25 | ||
}], | ||
"secondary": [{ | ||
}, { | ||
"path": "date_time", | ||
"type": "dateTime", | ||
"percent": 25 | ||
}] | ||
}], | ||
"secondary": [] | ||
} |
{ | ||
"name": "blue-button-match", | ||
"version": "1.1.0-beta.4", | ||
"version": "1.1.0-beta.5", | ||
"description": "Automatic matching of Blue Button JSON data (detection of new, duplicate and partial match entries).", | ||
@@ -5,0 +5,0 @@ "main": "/index.js", |
[{ | ||
"date_time": { | ||
"point": { | ||
"date": "1994-11-01T00:00:00Z", | ||
"date": "1999-11-01T00:00:00Z", | ||
"precision": "month" | ||
@@ -11,3 +11,3 @@ } | ||
}], | ||
"status": "complete", | ||
"status": "incomplete", | ||
"product": { | ||
@@ -66,2 +66,8 @@ "product": { | ||
}, { | ||
"date_time": { | ||
"point": { | ||
"date": "1998-12-15T00:00:00Z", | ||
"precision": "day" | ||
} | ||
}, | ||
"identifiers": [{ | ||
@@ -102,3 +108,3 @@ "identifier": "e6f1ba43-c0ed-4b9b-9f12-f435d8ad8f92" | ||
"name": [{ | ||
"last": "Assigned", | ||
"last": "Hugnkiss", | ||
"first": "Amanda" | ||
@@ -127,3 +133,3 @@ }], | ||
"point": { | ||
"date": "1993-12-15T00:00:00Z", | ||
"date": "1998-12-15T00:00:00Z", | ||
"precision": "day" | ||
@@ -152,3 +158,3 @@ } | ||
"route": { | ||
"name": "Intramuscular injection", | ||
"name": "Intramuscular", | ||
"code": "C28161", | ||
@@ -158,3 +164,3 @@ "code_system_name": "Medication Route FDA" | ||
"dose": { | ||
"value": 80, | ||
"value": 50, | ||
"unit": "mcg" | ||
@@ -193,3 +199,3 @@ } | ||
"point": { | ||
"date": "1992-12-15T00:00:00Z", | ||
"date": "1998-12-15T00:00:00Z", | ||
"precision": "day" | ||
@@ -213,3 +219,3 @@ } | ||
}, | ||
"lot_number": "1", | ||
"lot_number": "100", | ||
"manufacturer": "Health LS - Immuno Inc." | ||
@@ -227,3 +233,31 @@ }, | ||
} | ||
} | ||
}, | ||
"performer": { | ||
"identifiers": [{ | ||
"identifier": "2.16.840.1.113883.19.5.9999.456", | ||
"identifier_type": "2981824" | ||
}], | ||
"name": [{ | ||
"last": "Assigned", | ||
"first": "Amanda" | ||
}], | ||
"address": [{ | ||
"streetLines": [ | ||
"1021 Health Drive" | ||
], | ||
"city": "Ann Arbor", | ||
"state": "MI", | ||
"zip": "99099", | ||
"country": "US" | ||
}], | ||
"organization": [{ | ||
"identifiers": [{ | ||
"identifier": "2.16.840.1.113883.19.5.9999.1394" | ||
}], | ||
"name": [ | ||
"Good Health Clinic" | ||
] | ||
}] | ||
}, | ||
"refusal_reason": "Patient objection" | ||
}] |
@@ -39,3 +39,3 @@ /*jshint -W117 */ | ||
expect(m[0].match).to.equal("diff"); | ||
expect(m[0].match).to.equal("partial"); | ||
//console.log(m); | ||
@@ -70,3 +70,3 @@ | ||
expect(m[0].match).to.equal("diff"); | ||
expect(m[0].match).to.equal("partial"); | ||
@@ -73,0 +73,0 @@ }); |
@@ -172,3 +172,3 @@ /*jshint -W117 */ | ||
//console.log(partial_array[i]); | ||
expect(partial_array[i].percent).to.equal(25); | ||
expect(partial_array[i].percent).to.equal(50); | ||
expect(partial_array[i].diff).to.exist; | ||
@@ -236,3 +236,3 @@ } | ||
//console.log(partial_array[i]); | ||
expect(partial_array[i].percent).to.equal(25); | ||
expect(partial_array[i].percent).to.equal(50); | ||
expect(partial_array[i].diff).to.exist; | ||
@@ -239,0 +239,0 @@ } |
2376571
27506