From 6792f11b020cbad66348061215b67cfd11a2dd1c Mon Sep 17 00:00:00 2001 From: Richard Almeida Date: Wed, 3 Jul 2024 06:46:37 -0400 Subject: [PATCH] update canonicals of the library and dependent libraries --- Cql/Cql.Packaging/ResourcePackager.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Cql/Cql.Packaging/ResourcePackager.cs b/Cql/Cql.Packaging/ResourcePackager.cs index fe10ccf71..5308a9cb3 100644 --- a/Cql/Cql.Packaging/ResourcePackager.cs +++ b/Cql/Cql.Packaging/ResourcePackager.cs @@ -16,6 +16,7 @@ using FhirLibrary = Hl7.Fhir.Model.Library; using Annotation = Hl7.Cql.Elm.Annotation; using DateTimePrecision = Hl7.Cql.Iso8601.DateTimePrecision; +using Hl7.Fhir.Utility; namespace Hl7.Cql.Packaging; @@ -206,7 +207,7 @@ private static FhirLibrary CreateLibraryResource( var library = new FhirLibrary(); library.Content.Add(attachment); library.Type = LogicLibraryCodeableConcept; - string libraryId = $"{elmLibrary!.NameAndVersion()}"; + string libraryId = $"{elmLibrary!.identifier.id}"; library.Id = libraryId!; library.Version = elmLibrary!.identifier?.version!; library.Name = elmLibrary!.identifier?.id!; @@ -240,11 +241,12 @@ private static FhirLibrary CreateLibraryResource( foreach (var include in elmLibrary?.includes ?? []) { - var includeId = $"{include.path}-{include.version}"; + string includeVersionString = string.IsNullOrEmpty(include.version) ? string.Empty : $"|{include.version}"; + string includeIdMaybeVersion = $"{resourceCanonicalRootUrl.EnsureEndsWith("/")}Library/{include.path}{includeVersionString}"; library.RelatedArtifact.Add(new RelatedArtifact { Type = RelatedArtifact.RelatedArtifactType.DependsOn, - Resource = includeId, + Resource = includeIdMaybeVersion, }); }