public void FindAllResources() { var uris = source.ListResourceUris(ResourceType.ConceptMap); Assert.IsTrue(uris.Any()); var cmaps = source.FindAll<ConceptMap>(); Assert.AreEqual(uris.Count(), cmaps.Count()); }
public static IEnumerable <T> FindAll <T>(this IConformanceSource source) where T : Resource { var type = ModelInfo.GetFhirTypeNameForType(typeof(T)); if (type != null) { var resourceType = EnumUtility.ParseLiteral <ResourceType>(type); var uris = source.ListResourceUris(resourceType); return(uris.Select(u => source.ResolveByCanonicalUri(u) as T).Where(r => r != null)); } else { return(null); } }
public static IEnumerable <T> FindAll <T>(this IConformanceSource source) where T : Resource { var type = ModelInfo.GetFhirTypeNameForType(typeof(T)); if (type != null) { var resourceType = EnumUtility.ParseLiteral <ResourceType>(type); // for some reason there is an issue with this StructureDefinition (needs fixing) var uris = source.ListResourceUris(resourceType).Where(u => u != "http://hl7.org/fhir/us/sdc/StructureDefinition/sdc-questionnaire"); return(uris.Select(u => source.ResolveByCanonicalUri(u) as T).Where(r => r != null)); } else { return(null); } }
public void ListCanonicalUris() { var vs = source.ListResourceUris(ResourceType.ValueSet); Assert.IsTrue(vs.Any()); var cm = source.ListResourceUris(ResourceType.ConceptMap); Assert.IsTrue(cm.Any()); var ns = source.ListResourceUris(ResourceType.NamingSystem); Assert.IsTrue(ns.Any()); var sd = source.ListResourceUris(ResourceType.StructureDefinition); Assert.IsTrue(sd.Any()); var de = source.ListResourceUris(ResourceType.DataElement); Assert.IsTrue(de.Any()); var cf = source.ListResourceUris(ResourceType.Conformance); Assert.IsTrue(cf.Any()); var od = source.ListResourceUris(ResourceType.OperationDefinition); Assert.IsTrue(od.Any()); var sp = source.ListResourceUris(ResourceType.SearchParameter); Assert.IsTrue(sp.Any()); var all = source.ListResourceUris(); Assert.AreEqual(vs.Count() + cm.Count() + ns.Count() + sd.Count() + de.Count() + cf.Count() + od.Count() + sp.Count(), all.Count()); Assert.IsTrue(vs.Contains("http://hl7.org/fhir/ValueSet/contact-point-system")); Assert.IsTrue(cm.Contains("http://hl7.org/fhir/ConceptMap/v2-contact-point-use")); Assert.IsTrue(ns.Contains("http://hl7.org/fhir/NamingSystem/tx-rxnorm")); Assert.IsTrue(sd.Contains("http://hl7.org/fhir/StructureDefinition/shareablevalueset")); Assert.IsTrue(de.Contains("http://hl7.org/fhir/DataElement/Device.manufactureDate")); Assert.IsTrue(sp.Contains("http://hl7.org/fhir/SearchParameter/Condition-onset-info")); Assert.IsTrue(od.Contains("http://hl7.org/fhir/OperationDefinition/ValueSet-validate-code")); Assert.IsTrue(cf.Contains("http://hl7.org/fhir/Conformance/base")); }
public IEnumerable <string> ListResourceUris(ResourceType?filter = default(ResourceType?)) => _source.ListResourceUris(filter);