Skip to content

Commit

Permalink
Save externalID as an identifier on family history resource
Browse files Browse the repository at this point in the history
  • Loading branch information
dconlan committed Dec 15, 2019
1 parent cc27011 commit ea3db71
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/script/model/FHIRConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ FHIRConverter.extractDataFromFMH = function(familyHistoryResource,
}
}
}

if (familyHistoryResource.identifier){
for (let i = 0; i < familyHistoryResource.identifier.length; i++) {
if (familyHistoryResource.identifier[i].system === "https://github.com/phenotips/open-pedigree?externalID"){
properties.externalID = familyHistoryResource.identifier[i].value;
break;
}
}
}
let dateSplitter = /([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2]|[1-9])(-(0[1-9]|[1-2][0-9]|3[0-1]|[1-9]))?)?/;
if (familyHistoryResource.bornDate) {
let bornDateSplit = dateSplitter.exec(familyHistoryResource.bornDate);
Expand Down Expand Up @@ -2275,6 +2284,13 @@ FHIRConverter.buildFhirFMH = function(index, pedigree, privacySetting,
}
fmhResource['condition'] = conditions;
}

if (nodeProperties['externalID']){
fmhResource['identifier'] = [{
"system": "https://github.com/phenotips/open-pedigree?externalID",
"value": nodeProperties['externalID']
}];
}
return fmhResource;

};
Expand Down

0 comments on commit ea3db71

Please sign in to comment.