From 4f051a8b8a1ed0ee600f797ae1f9e80256bdd06c Mon Sep 17 00:00:00 2001 From: Elsa Date: Thu, 21 Mar 2024 11:36:55 -0400 Subject: [PATCH] Make sure all child artifacts get marked as isOwned, not just the main library --- service/scripts/dbSetup.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/service/scripts/dbSetup.ts b/service/scripts/dbSetup.ts index 7eee679..713fc0d 100644 --- a/service/scripts/dbSetup.ts +++ b/service/scripts/dbSetup.ts @@ -89,6 +89,18 @@ async function uploadBundleResources(filePath: string) { // that library's entry in the relatedArtifacts of the measure const { modifiedEntry, url } = addIsOwnedExtension(ent); if (url) ownedUrls.push(url); + // check if there are other isOwned urls but already in the relatedArtifacts + if (ent.resource?.resourceType === 'Measure' || ent.resource?.resourceType === 'Library') { + ent.resource.relatedArtifact?.forEach(ra => { + if (ra.type === 'composed-of') { + if (ra.extension?.some(e => e.url === 'http://hl7.org/fhir/StructureDefinition/artifact-isOwned')) { + if (ra.resource) { + ownedUrls.push(ra.resource); + } + } + } + }); + } return modifiedEntry; }); const uploads = modifiedEntries.map(async entry => {