From 30a0fa35bfd9defa8cc556a77c2dc0dfd33433f2 Mon Sep 17 00:00:00 2001 From: Angelica Ochoa <15623749+ao508@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:09:34 -0400 Subject: [PATCH] Resolve CMO Patient ID from PatientAlias Signed-off-by: Angelica Ochoa <15623749+ao508@users.noreply.github.com> --- graphql-server/src/utils/flattening.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graphql-server/src/utils/flattening.ts b/graphql-server/src/utils/flattening.ts index 5dd2fe6c..e8c5a340 100644 --- a/graphql-server/src/utils/flattening.ts +++ b/graphql-server/src/utils/flattening.ts @@ -155,8 +155,9 @@ const nestedValueGetters: NestedValueGetters = { Patient: (parent, fieldName, _context) => { switch (fieldName) { case "cmoPatientId": - return parent.hasSampleSamples?.[0]?.hasMetadataSampleMetadata?.[0] - ?.cmoPatientId; + return parent.patientAliasesIsAlias?.find( + (patientAlias) => patientAlias.namespace === "cmoId" + )?.value; case "dmpPatientId": return parent.patientAliasesIsAlias?.find( (patientAlias) => patientAlias.namespace === "dmpId"