コード例 #1
0
        /// <summary>Harvest specific summary information from a <see cref="StructureDefinition"/> resource.</summary>
        /// <returns><c>true</c> if the current target represents a <see cref="StructureDefinition"/> resource, or <c>false</c> otherwise.</returns>
        /// <remarks>The <see cref="ArtifactSummaryGenerator"/> calls this method from a <see cref="ArtifactSummaryHarvester"/> delegate.</remarks>
        public static bool Harvest(ISourceNode nav, ArtifactSummaryPropertyBag properties)
        {
            if (IsStructureDefinitionSummary(properties))
            {
                // [WMR 20171218] Harvest global core extensions, e.g. MaturityLevel
                nav.HarvestExtensions(properties, harvestExtension);

                // Explicit extractor chaining
                if (ConformanceSummaryProperties.Harvest(nav, properties))
                {
                    nav.HarvestValue(properties, FhirVersionKey, "fhirVersion");
                    nav.HarvestValue(properties, KindKey, "kind");
                    nav.HarvestValue(properties, ConstrainedTypeKey, "constrainedType");
                    nav.HarvestValue(properties, ContextTypeKey, "contextType");
                    // [WMR 20180919] NEW: Extension Context
                    nav.HarvestValues(properties, ContextKey, "context");
                    nav.HarvestValue(properties, BaseKey, "base");

                    // [WMR 20180725] Also harvest definition property from (first) root element in snapshot/differential
                    // HL7 FHIR website displays this text as introduction on top of each resource/datatype page
                    var elementNode = nav.Children("snapshot").FirstOrDefault() ?? nav.Children("differential").FirstOrDefault();
                    if (elementNode != null)
                    {
                        var childNode = elementNode.Children("element").FirstOrDefault();
                        if (childNode != null && Navigation.ElementDefinitionNavigator.IsRootPath(childNode.Name))
                        {
                            childNode.HarvestValue(properties, RootDefinitionKey, "definition");
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
コード例 #2
0
 /// <summary>Harvest specific summary information from a <see cref="NamingSystem"/> resource.</summary>
 /// <returns><c>true</c> if the current target represents a <see cref="NamingSystem"/> resource, or <c>false</c> otherwise.</returns>
 /// <remarks>The <see cref="ArtifactSummaryGenerator"/> calls this method through a <see cref="ArtifactSummaryHarvester"/> delegate.</remarks>
 public static bool Harvest(ISourceNode nav, ArtifactSummaryPropertyBag properties)
 {
     if (IsNamingSystemSummary(properties))
     {
         nav.HarvestValues(properties, UniqueIdKey, "uniqueId", "value");
         return(true);
     }
     return(false);
 }
コード例 #3
0
 static bool HarvestPatientSummary(ISourceNode nav, ArtifactSummaryPropertyBag properties)
 {
     if (properties.GetTypeName() == ResourceType.Patient.GetLiteral())
     {
         nav.HarvestValues(properties, PatientFamilyNameKey, "name", "family");
         return(true);
     }
     return(false);
 }
コード例 #4
0
 /// <summary>Harvest common summary information from a conformance resource.</summary>
 /// <returns><c>true</c> if the current target represents a conformance resource, or <c>false</c> otherwise.</returns>
 /// <remarks>
 /// The <see cref="ArtifactSummaryGenerator"/> calls this method through a <see cref="ArtifactSummaryHarvester"/> delegate.
 /// Also called directly by other <see cref="ArtifactSummaryHarvester"/> delegates to harvest summary
 /// information common to all conformance resources, before harvesting any additional type specific
 /// information.
 /// </remarks>
 /// <seealso cref="StructureDefinitionSummaryProperties"/>
 /// <seealso cref="ValueSetSummaryProperties"/>
 /// <seealso cref="ConceptMapSummaryProperties"/>
 public static bool Harvest(IElementNavigator nav, ArtifactSummaryPropertyBag properties)
 {
     if (IsConformanceSummary(properties))
     {
         nav.HarvestValue(properties, CanonicalUrlKey, "url");
         nav.HarvestValue(properties, NameKey, "name");
         nav.HarvestValue(properties, StatusKey, "status");
         return(true);
     }
     return(false);
 }
コード例 #5
0
 /// <summary>Harvest common summary information from a conformance resource.</summary>
 /// <returns><c>true</c> if the current target represents a conformance resource, or <c>false</c> otherwise.</returns>
 /// <remarks>
 /// The <see cref="ArtifactSummaryGenerator"/> calls this method through a <see cref="ArtifactSummaryHarvester"/> delegate.
 /// Also called directly by other <see cref="ArtifactSummaryHarvester"/> delegates to harvest summary
 /// information common to all conformance resources, before harvesting any additional type specific
 /// information.
 /// </remarks>
 /// <seealso cref="StructureDefinitionSummaryProperties"/>
 /// <seealso cref="ValueSetSummaryProperties"/>
 /// <seealso cref="ConceptMapSummaryProperties"/>
 public static bool Harvest(ISourceNode nav, ArtifactSummaryPropertyBag properties)
 {
     if (IsConformanceSummary(properties))
     {
         nav.HarvestValue(properties, CanonicalUrlKey, "url");
         nav.HarvestValue(properties, VersionKey, "version");
         nav.HarvestValue(properties, NameKey, "name");
         nav.HarvestValue(properties, StatusKey, "status");
         return(true);
     }
     return(false);
 }
コード例 #6
0
 /// <summary>Harvest specific summary information from a <see cref="ValueSet"/> resource.</summary>
 /// <returns><c>true</c> if the current target is a ValueSet, or <c>false</c> otherwise.</returns>
 /// <remarks>The <see cref="ArtifactSummaryGenerator"/> calls this method from a <see cref="ArtifactSummaryHarvester"/> delegate.</remarks>
 public static bool Harvest(ISourceNode nav, ArtifactSummaryPropertyBag properties)
 {
     if (IsValueSetSummary(properties))
     {
         // Explicit extractor chaining
         if (ConformanceSummaryProperties.Harvest(nav, properties))
         {
             nav.HarvestValue(properties, SystemKey, "codeSystem", "system");
         }
         return(true);
     }
     return(false);
 }
コード例 #7
0
        /// <summary>Create a new <see cref="ArtifactSummary"/> instance from the specified exception.</summary>
        /// <param name="error">An exception that occured while harvesting artifact summary information.</param>
        /// <param name="origin">The original location of the target artifact.</param>
        public static ArtifactSummary FromException(Exception error, string origin)
        {
            if (error == null)
            {
                throw Errors.ArgumentNull(nameof(error));
            }
            // Create a new (default) ArtifactSummaryPropertyBag to store the artifact origin
            var properties = new ArtifactSummaryPropertyBag();

            if (!string.IsNullOrEmpty(origin))
            {
                properties[ArtifactSummaryProperties.OriginKey] = origin;
            }
            return(new ArtifactSummary(properties, error));
        }
コード例 #8
0
        /// <summary>Harvest specific summary information from a <see cref="StructureDefinition"/> resource.</summary>
        /// <returns><c>true</c> if the current target represents a <see cref="StructureDefinition"/> resource, or <c>false</c> otherwise.</returns>
        /// <remarks>The <see cref="ArtifactSummaryGenerator"/> calls this method from a <see cref="ArtifactSummaryHarvester"/> delegate.</remarks>
        public static bool Harvest(IElementNavigator nav, ArtifactSummaryPropertyBag properties)
        {
            if (IsStructureDefinitionSummary(properties))
            {
                // [WMR 20171218] Harvest global core extensions, e.g. MaturityLevel
                nav.HarvestExtensions(properties, harvestExtension);

                // Explicit extractor chaining
                if (ConformanceSummaryProperties.Harvest(nav, properties))
                {
                    nav.HarvestValue(properties, FhirVersionKey, "fhirVersion");
                    nav.HarvestValue(properties, KindKey, "kind");
                    nav.HarvestValue(properties, ConstrainedTypeKey, "constrainedType");
                    nav.HarvestValue(properties, ContextTypeKey, "contextType");
                    nav.HarvestValue(properties, BaseKey, "base");
                }
                return(true);
            }
            return(false);
        }
コード例 #9
0
        /// <summary>Harvest specific summary information from a <see cref="ConceptMap"/> resource.</summary>
        /// <returns><c>true</c> if the current target represents a <see cref="ConceptMap"/> resource, or <c>false</c> otherwise.</returns>
        /// <remarks>The <see cref="ArtifactSummaryGenerator"/> calls this method from a <see cref="ArtifactSummaryHarvester"/> delegate.</remarks>
        public static bool Harvest(ISourceNode nav, ArtifactSummaryPropertyBag properties)
        {
            if (IsConceptMapSummary(properties))
            {
                // Explicit extractor chaining
                if (ConformanceSummaryProperties.Harvest(nav, properties))
                {
                    if (!nav.HarvestValue(properties, SourceKey, "sourceUri"))
                    {
                        nav.HarvestValue(properties, SourceKey, "sourceReference", "reference");
                    }

                    if (!nav.HarvestValue(properties, TargetKey, "targetUri"))
                    {
                        nav.HarvestValue(properties, TargetKey, "targetReference", "reference");
                    }
                }
                return(true);
            }
            return(false);
        }
コード例 #10
0
 internal static void SetSerializationFormat(this ArtifactSummaryPropertyBag properties, string value)
 {
     Debug.Assert(Array.IndexOf(FhirSerializationFormats.All, value) >= 0);
     properties[SerializationFormatKey] = value;
 }
コード例 #11
0
 internal static void SetLastModified(this ArtifactSummaryPropertyBag properties, DateTimeOffset value)
 {
     properties[LastModifiedKey] = value;
 }
コード例 #12
0
 internal static void SetFileSize(this ArtifactSummaryPropertyBag properties, long value)
 {
     properties[FileSizeKey] = value;
 }
コード例 #13
0
 internal static void SetOrigin(this ArtifactSummaryPropertyBag properties, string value)
 {
     properties[OriginKey] = value;
 }
コード例 #14
0
 internal static void SetResourceUri(this ArtifactSummaryPropertyBag properties, string value)
 {
     properties[ResourceUriKey] = value;
 }
コード例 #15
0
 internal static void SetTypeName(this ArtifactSummaryPropertyBag properties, string value)
 {
     properties[TypeNameKey] = value;
 }
コード例 #16
0
 internal static void SetPosition(this ArtifactSummaryPropertyBag properties, string value)
 {
     properties[PositionKey] = value;
 }