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"