From 98369939dd3544d4a11396ca173ec4b53ec24a13 Mon Sep 17 00:00:00 2001 From: shermanlo77 Date: Fri, 12 May 2023 15:58:41 +0100 Subject: [PATCH 1/2] Implement saving and loading of externalID Implement saving and loading of externalID (aka Identifier) Based on the commit aehrc:open-pedigree@ea3db71 --- src/script/GA4GHFHIRConverter.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/script/GA4GHFHIRConverter.js b/src/script/GA4GHFHIRConverter.js index e6648ac..3a1d7f6 100644 --- a/src/script/GA4GHFHIRConverter.js +++ b/src/script/GA4GHFHIRConverter.js @@ -474,9 +474,9 @@ GA4GHFHIRConverter.extractDataFromObservation = function (observationResource, n let nodeData = nodeDataLookup[familyMember]; let fhirTerminologyHelper = editor.getFhirTerminologyHelper(); - + let foundCode = false; - + if (observationResource.valueCodeableConcept) { for (const coding of observationResource.valueCodeableConcept.coding) { if (coding.system === 'http://snomed.info/sct' && coding.code === '87955000') { @@ -603,6 +603,13 @@ GA4GHFHIRConverter.extractDataFromPatient = function (patientResource, properties.gender = 'F'; } + if (patientResource.externalID) { + if (patientResource.externalID.system === + 'https://github.com/phenotips/open-pedigree?externalID') { + properties.externalID = patientResource.externalID.value; + } + } + const dateTimeSplitter = /([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?/; const nameUseOrder = ['anonymous', 'temp', 'expired_nickname', 'expired_', 'expired_usual', 'expired_official', 'maiden', 'old', 'nickname', '', 'usual', 'official']; let maxFNameUse = -2; @@ -1281,6 +1288,14 @@ GA4GHFHIRConverter.buildPedigreeIndividual = function (containedId, nodeProperti } } } + + if (nodeProperties.externalID) { + patientResource.externalID = { + 'system': 'https://github.com/phenotips/open-pedigree?externalID', + 'value': nodeProperties.externalID + }; + } + return patientResource; }; From 017b8865d687eab7608bbaa5f07ab8fa0a1c0ae3 Mon Sep 17 00:00:00 2001 From: shermanlo77 Date: Wed, 10 Jan 2024 14:38:21 +0000 Subject: [PATCH 2/2] Rename externalID to identifier in patientResource --- src/script/GA4GHFHIRConverter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/script/GA4GHFHIRConverter.js b/src/script/GA4GHFHIRConverter.js index 3a1d7f6..c7fc3b4 100644 --- a/src/script/GA4GHFHIRConverter.js +++ b/src/script/GA4GHFHIRConverter.js @@ -603,10 +603,10 @@ GA4GHFHIRConverter.extractDataFromPatient = function (patientResource, properties.gender = 'F'; } - if (patientResource.externalID) { - if (patientResource.externalID.system === + if (patientResource.identifier) { + if (patientResource.identifier.system === 'https://github.com/phenotips/open-pedigree?externalID') { - properties.externalID = patientResource.externalID.value; + properties.externalID = patientResource.identifier.value; } } @@ -1290,7 +1290,7 @@ GA4GHFHIRConverter.buildPedigreeIndividual = function (containedId, nodeProperti } if (nodeProperties.externalID) { - patientResource.externalID = { + patientResource.identifier = { 'system': 'https://github.com/phenotips/open-pedigree?externalID', 'value': nodeProperties.externalID };