Skip to content

Commit

Permalink
Formatting cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmccall committed Aug 26, 2014
1 parent cfd8d83 commit 267f5f9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 272 deletions.
6 changes: 0 additions & 6 deletions lib/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ exports.compare = function compare(a, b) {
throw "two arguments are required for compare function";
}

//console.log("a "+a);
//console.log("b "+b);
//console.log(a);
//console.log(b);
//console.log(equal(a,b));

//excellent code here
if (equal(a, b)) {
return {
Expand Down
7 changes: 2 additions & 5 deletions lib/match-single.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
"use strict";

var equal = require('deep-equal');

var utils = require('./utils.js');
var _ = require('underscore');

//Full comparison of two demographics JSON elements for equality and/or diff
exports.compare = function compare(a, b, section) {
//console.log(a);
//console.log(b);

//excellent code here
if (equal(a, {}) && equal(b, {})) {
return {
Expand All @@ -17,6 +15,7 @@ exports.compare = function compare(a, b, section) {
"src_id": 0,
"dest_id": 0
};

//comparing non-empty demographics section with empty master record
} else if (equal(b, {})) {
return {
Expand All @@ -34,8 +33,6 @@ exports.compare = function compare(a, b, section) {
};
} else {

//console.log(a, b);

var diff = utils.diff(a, b);

var pctOutput = 0;
Expand Down
38 changes: 4 additions & 34 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ exports.compare = function compare(a, b, section) {
var calculateMatch = function (primaryEntries, secondaryEntries, object_a, object_b) {

//console.log(primaryEntries);
//console.log(object_a);
//console.log(object_b);

var primaryTotal = primaryEntries.length;
var primaryCount = 0;

//console.log(object_a);
//console.log(object_b);

var matchPercent = 0;

//Extract primary matching logic from schema.
var primaryCodedEntries = _.where(primaryEntries, {
type: 'codedEntry'
Expand Down Expand Up @@ -113,8 +113,6 @@ exports.compare = function compare(a, b, section) {

}

//console.log(primaryStringEntries);

for (var i in primaryStringEntries) {

var inputObjectAPSE = object_a;
Expand All @@ -136,14 +134,9 @@ exports.compare = function compare(a, b, section) {
inputObjectBPSE = object_b[primaryStringEntries[i].path];
}

//console.log(inputObjectA);
//console.log(inputObjectB);

//console.log(primaryStringEntries[i].path);
if (utils.stringMatch(inputObjectAPSE, inputObjectBPSE)) {
matchPercent = matchPercent + primaryStringEntries[i].percent;
primaryCount++;
//console.log(matchPercent);
}
}

Expand Down Expand Up @@ -171,8 +164,6 @@ exports.compare = function compare(a, b, section) {
inputObjectBPCE = object_b[primaryCodedEntries[ipce].path];
}

//console.log(inputObjectA);

if (utils.codedMatch(inputObjectAPCE, inputObjectBPCE)) {
//console.log(inputObjectAPCE);
//console.log(inputObjectBPCE);
Expand Down Expand Up @@ -206,17 +197,13 @@ exports.compare = function compare(a, b, section) {

}

//If primary entries match, add in secondary match.
//Logical flaw here. All of the entries should need to hit, not just a determination over 0.
//Need to shim matchPercent to equal zero.

//console.log('-------');
//console.log(primaryEntries);
//console.log(primaryTotal);
//console.log(primaryCount);

//console.log(matchPercent);

//If primary entries match, add in secondary match.
if (primaryTotal !== primaryCount) {
matchPercent = 0;
}
Expand Down Expand Up @@ -286,16 +273,12 @@ exports.compare = function compare(a, b, section) {

//console.log(object_a);
//console.log(object_b);

//console.log(secondaryEntries);

if (_.isUndefined(secondaryEntries)) {
secondaryEntries = [];
}

//console.log(object_a);
//console.log(object_b);

if (equal(object_a, object_b)) {
return {
"match": "duplicate",
Expand Down Expand Up @@ -323,10 +306,7 @@ exports.compare = function compare(a, b, section) {
//Process first object.
newPct = newPct + calculateMatch(logic.primary, logic.secondary, a, b);

//console.log(b);

//if newPct = 0, return 'new', otherwise, run subarrays.

var aMatches;

if (newPct === 0) {
Expand All @@ -345,11 +325,6 @@ exports.compare = function compare(a, b, section) {
var atemp = a;
var btemp = b;

//a[ii] references title as value, need to expand.
//console.log(a.observation);

//console.log(atemp);

//if string split it.
if (ii.indexOf(".") > -1) {
var subPathSplit = ii.split(".");
Expand All @@ -360,8 +335,6 @@ exports.compare = function compare(a, b, section) {
}
} else {

//atemp = atemp[ii];

if (_.isUndefined(a[ii])) {
atemp = [];
} else {
Expand All @@ -379,8 +352,6 @@ exports.compare = function compare(a, b, section) {
//console.log(atemp);
//console.log('---');

//console.log(ii);

for (var aObj in atemp) {

//Match Target.
Expand All @@ -395,7 +366,6 @@ exports.compare = function compare(a, b, section) {

if (aMatches[ii] === undefined) {
aMatches[ii] = [];
//aMatches.push({ii: []});
}

//Graph against all dest target objects.
Expand Down

0 comments on commit 267f5f9

Please sign in to comment.