public CapabilityStatement.RestComponent GetRestDefinition() { var resourceComponent = new CapabilityStatement.ResourceComponent { Type = ResourceType.Resource, Profile = "url for structure defintion", Interaction = new List <CapabilityStatement.ResourceInteractionComponent> { new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Create }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Update }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Delete } }, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; var restComponent = new CapabilityStatement.RestComponent(); restComponent.Resource.Add(resourceComponent); return(restComponent); }
public static CapabilityStatement.ResourceComponent AddSearchType(CapabilityStatement.ResourceComponent resourcecomp) { var type = CapabilityStatement.TypeRestfulInteraction.SearchType; var interaction = AddSingleResourceInteraction(resourcecomp, type); resourcecomp.Interaction.Add(interaction); return(resourcecomp); }
public static CapabilityStatement AddSingleResourceComponent(this CapabilityStatement conformance, String resourcetype, Boolean readhistory, Boolean updatecreate, CapabilityStatement.ResourceVersionPolicy versioning, ResourceReference profile = null) { var resource = new CapabilityStatement.ResourceComponent(); resource.Type = Hacky.GetResourceTypeForResourceName(resourcetype); resource.Profile = profile; resource.ReadHistory = readhistory; resource.UpdateCreate = updatecreate; resource.Versioning = versioning; conformance.Server().Resource.Add(resource); return(conformance); }
public static CapabilityStatement.ResourceComponent AddAllResourceInteractions( CapabilityStatement.ResourceComponent resourcecomp) { foreach (CapabilityStatement.TypeRestfulInteraction type in Enum.GetValues( typeof(CapabilityStatement.TypeRestfulInteraction))) { var interaction = AddSingleResourceInteraction(type); resourcecomp.Interaction.Add(interaction); } return(resourcecomp); }
public static CapabilityStatement.ResourceComponent AddCoreSearchParamsResource( CapabilityStatement.ResourceComponent resourcecomp) { var parameters = ModelInfo.SearchParameters.Where(sp => sp.Resource == resourcecomp.Type.GetLiteral()) .Select( sp => new CapabilityStatement.SearchParamComponent { Name = sp.Name, Type = sp.Type, Documentation = sp.Description }); resourcecomp.SearchParam.AddRange(parameters); return(resourcecomp); }
public static CapabilityStatement AddSingleResourceComponent(this CapabilityStatement capabilityStatement, string resourcetype, bool readhistory, bool updatecreate, CapabilityStatement.ResourceVersionPolicy versioning, ResourceReference profile = null) { var resource = new CapabilityStatement.ResourceComponent { Type = (ResourceType)Enum.Parse(typeof(ResourceType), resourcetype, true), Profile = profile, ReadHistory = readhistory, UpdateCreate = updatecreate, Versioning = versioning }; capabilityStatement.Server().Resource.Add(resource); return(capabilityStatement); }
public static CapabilityStatement AddSingleResourceComponent( this CapabilityStatement capabilityStatement, string resourcetype, bool readhistory, bool updatecreate, CapabilityStatement.ResourceVersionPolicy versioning, Canonical profile = null) { var resource = new CapabilityStatement.ResourceComponent { Type = Hacky.GetResourceTypeForResourceName(resourcetype), Profile = profile, ReadHistory = readhistory, UpdateCreate = updatecreate, Versioning = versioning }; capabilityStatement.Server().Resource.Add(resource); return(capabilityStatement); }
public IResourceServiceOutcome GetServersConformanceResource(IRequestMeta RequestMeta) { if (RequestMeta == null) { throw new NullReferenceException("RequestMeta can not be null."); } if (RequestMeta.SearchParameterGeneric == null) { throw new NullReferenceException("SearchParameterGeneric can not be null."); } IResourceServiceOutcome ServiceOperationOutcome = IResourceServiceOutcomeFactory.CreateResourceServiceOutcome(); ISearchParameterService SearchService = ISearchParameterServiceFactory.CreateSearchParameterService(); ISearchParametersServiceOutcome SearchParametersServiceOutcome = SearchService.ProcessBaseSearchParameters(RequestMeta.SearchParameterGeneric); if (SearchParametersServiceOutcome.FhirOperationOutcome != null) { ServiceOperationOutcome.ResourceResult = SearchParametersServiceOutcome.FhirOperationOutcome; ServiceOperationOutcome.HttpStatusCode = SearchParametersServiceOutcome.HttpStatusCode; ServiceOperationOutcome.FormatMimeType = SearchParametersServiceOutcome.SearchParameters.Format; return(ServiceOperationOutcome); } var Conformance = new CapabilityStatement(); var ApplicationReleaseDate = new DateTimeOffset(2017, 10, 17, 6, 00, 00, new TimeSpan(8, 0, 0)); string ServerName = "Pyro Server"; string Https = "https://"; Conformance.Id = "metadata"; Conformance.Url = $"{Https}{IPrimaryServiceRootCache.GetPrimaryRootUrlFromDatabase().Url}/metadata"; Conformance.Version = $"V{IGlobalProperties.ApplicationVersionInfo}"; Conformance.Meta = new Meta(); Conformance.Meta.LastUpdated = ApplicationReleaseDate; Conformance.Name = ServerName; Conformance.Status = PublicationStatus.Active; Conformance.Experimental = true; Conformance.Date = (new FhirDateTime(ApplicationReleaseDate)).Value; Conformance.Publisher = "PyroHealth.net"; var AngusContactDetail = Common.PyroHealthInformation.PyroHealthContactDetailAngusMillar.GetContactDetail(); Conformance.Contact = new List <ContactDetail>() { AngusContactDetail }; Conformance.Description = new Markdown("Conformance statement for the " + ServerName); var Australia = new CodeableConcept("urn:iso:std:iso:3166", "AU", "Australia"); Conformance.Jurisdiction = new List <CodeableConcept>() { Australia }; Conformance.Purpose = new Markdown("FHIR Server reference implementation"); Conformance.Copyright = new Markdown("Copyright: PyroHealth.net"); Conformance.Kind = CapabilityStatement.CapabilityStatementKind.Instance; Conformance.Software = new CapabilityStatement.SoftwareComponent(); Conformance.Software.Name = ServerName; Conformance.Software.Version = IGlobalProperties.ApplicationVersionInfo; //To align with FHIR version only use number no prefix of 'V' Conformance.Software.ReleaseDate = (new FhirDateTime(ApplicationReleaseDate)).Value; Conformance.Implementation = new CapabilityStatement.ImplementationComponent(); Conformance.Implementation.Description = $"{ServerName} is an implementation of a FHIR server supporting V{Hl7.Fhir.Model.ModelInfo.Version} of the specification. This instance is a publicly available testing server and its resource may be cleared at any time."; Conformance.Implementation.Url = $"{Https}{IPrimaryServiceRootCache.GetPrimaryRootUrlFromDatabase().Url}"; Conformance.FhirVersion = Hl7.Fhir.Model.ModelInfo.Version; //Must be formated as just the number '3.0.1' as touchstone does not like the V3.0.1 Conformance.AcceptUnknown = CapabilityStatement.UnknownContentCode.Extensions; var ContentFormatList = new List <string>(); foreach (var mediaType in Hl7.Fhir.Rest.ContentType.XML_CONTENT_HEADERS) { ContentFormatList.Add(mediaType); } foreach (var mediaType in Hl7.Fhir.Rest.ContentType.JSON_CONTENT_HEADERS) { ContentFormatList.Add(mediaType); } Conformance.Format = ContentFormatList; Conformance.Rest = new List <CapabilityStatement.RestComponent>(); var RestComponent = new CapabilityStatement.RestComponent(); Conformance.Rest.Add(RestComponent); RestComponent.Mode = CapabilityStatement.RestfulCapabilityMode.Server; RestComponent.Documentation = $"STU{Hl7.Fhir.Model.ModelInfo.Version.Split('.')[0]} V{Hl7.Fhir.Model.ModelInfo.Version} FHIR Server"; RestComponent.Security = new CapabilityStatement.SecurityComponent(); RestComponent.Security.Description = "No Security has been implemented, server if publicly open"; RestComponent.Interaction = new List <CapabilityStatement.SystemInteractionComponent>(); var SystemInteractionComponent = new CapabilityStatement.SystemInteractionComponent(); RestComponent.Interaction.Add(SystemInteractionComponent); SystemInteractionComponent.Code = CapabilityStatement.SystemRestfulInteraction.Transaction; SystemInteractionComponent.Documentation = "Batch Transaction supports all request methods (Delete, POST, PUT, GET) including conditional create/update/delete. Operatons are not supported within Transaction bundles."; var CompartmentList = IServiceCompartmentRepository.GetAllServiceCompartments(); if (CompartmentList != null && CompartmentList.Count > 0) { var CompartmentUrlList = new List <string>(); CompartmentList.ForEach(x => CompartmentUrlList.Add(x.Url)); RestComponent.Compartment = CompartmentUrlList; } RestComponent.Resource = new List <CapabilityStatement.ResourceComponent>(); List <DtoServiceSearchParameterHeavy> DtoServiceSearchParameterHeavyList = IServiceSearchParameterService.GetServiceSearchParametersHeavy(false); var ResourceTypeList = Enum.GetValues(typeof(ResourceType)); foreach (ResourceType ResourceType in ResourceTypeList) { string CurrentResourceString = ResourceType.GetLiteral(); FHIRAllTypes?FhirType = Hl7.Fhir.Model.ModelInfo.FhirTypeNameToFhirType(CurrentResourceString); var ResourceComponent = new CapabilityStatement.ResourceComponent(); RestComponent.Resource.Add(ResourceComponent); ResourceComponent.Type = ResourceType; ResourceComponent.Interaction = new List <CapabilityStatement.ResourceInteractionComponent>() { new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Create }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Delete }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Read }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Update }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Vread }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.SearchType }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.HistoryInstance }, new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.HistoryType } //new Conformance.ResourceInteractionComponent() { Code = Conformance.TypeRestfulInteraction.HistoryType}, }; ResourceComponent.Versioning = CapabilityStatement.ResourceVersionPolicy.Versioned; ResourceComponent.ReadHistory = true; ResourceComponent.UpdateCreate = true; ResourceComponent.ConditionalCreate = true; ResourceComponent.ConditionalRead = CapabilityStatement.ConditionalReadStatus.FullSupport; ResourceComponent.ConditionalUpdate = true; ResourceComponent.ConditionalDelete = CapabilityStatement.ConditionalDeleteStatus.Multiple; var ReferenceHandlingPolicyList = new List <CapabilityStatement.ReferenceHandlingPolicy?>(); ReferenceHandlingPolicyList.Add(CapabilityStatement.ReferenceHandlingPolicy.Literal); ReferenceHandlingPolicyList.Add(CapabilityStatement.ReferenceHandlingPolicy.Local); ResourceComponent.ReferencePolicy = ReferenceHandlingPolicyList; List <DtoServiceSearchParameterHeavy> DtoServiceSearchParameterHeavyForResourceList = DtoServiceSearchParameterHeavyList.Where(x => x.Resource == CurrentResourceString || x.Resource == FHIRAllTypes.Resource.GetLiteral()).ToList(); //List<ServiceSearchParameterHeavy> DtoServiceSearchParameterHeavyForResourceList = ICommonServices.GetServiceSearchParametersHeavyForResource(FhirType.Value.GetLiteral()); //DtoServiceSearchParameterHeavyForResourceList.AddRange(ICommonServices.GetServiceSearchParametersHeavyForResource(FHIRAllTypes.Resource.GetLiteral())); ResourceComponent.SearchParam = new List <CapabilityStatement.SearchParamComponent>(); List <string> IncludesList = null; List <string> RevIncludesList = null; foreach (var SupportedSearchParam in DtoServiceSearchParameterHeavyForResourceList) { if (SupportedSearchParam.IsIndexed && SupportedSearchParam.Status == PublicationStatus.Active) { //Include (RevIncludes are below) if (SupportedSearchParam.Type == SearchParamType.Reference) { if (IncludesList == null) { IncludesList = new List <string>(); } if (SupportedSearchParam.TargetResourceTypeList.Count > 1) { foreach (var Target in SupportedSearchParam.TargetResourceTypeList) { IncludesList.Add($"{SupportedSearchParam.Resource}:{SupportedSearchParam.Name}:{Target.ResourceType.GetLiteral()}"); } } else { IncludesList.Add($"{SupportedSearchParam.Resource}:{SupportedSearchParam.Name}"); } } CapabilityStatement.SearchParamComponent SearchParamComponent = new CapabilityStatement.SearchParamComponent(); ResourceComponent.SearchParam.Add(SearchParamComponent); SearchParamComponent.Name = SupportedSearchParam.Name; SearchParamComponent.Type = SupportedSearchParam.Type; SearchParamComponent.Definition = SupportedSearchParam.Url; if (!string.IsNullOrWhiteSpace(SupportedSearchParam.Description)) { SearchParamComponent.Documentation = SupportedSearchParam.Description; } } } ResourceComponent.SearchInclude = IncludesList; //RevIncludes var RevIncludeSearchParameterList = DtoServiceSearchParameterHeavyList.Where(x => x.Type == SearchParamType.Reference && x.TargetResourceTypeList.Any(c => c.ResourceType == ResourceType)); foreach (var Rev in RevIncludeSearchParameterList) { if (RevIncludesList == null) { RevIncludesList = new List <string>(); } if (Rev.TargetResourceTypeList.Count > 1) { RevIncludesList.Add($"{Rev.Resource}:{Rev.Name}:{CurrentResourceString}"); } else { RevIncludesList.Add($"{Rev.Resource}:{Rev.Name}"); } } ResourceComponent.SearchRevInclude = RevIncludesList; } ConstructConformanceResourceNarrative(Conformance); IDatabaseOperationOutcome DatabaseOperationOutcome = IDatabaseOperationOutcomeFactory.CreateDatabaseOperationOutcome(); ServiceOperationOutcome.FhirResourceId = Conformance.Id; ServiceOperationOutcome.ResourceVersionNumber = Conformance.Version; ServiceOperationOutcome.LastModified = Conformance.Meta.LastUpdated; ServiceOperationOutcome.OperationType = Common.Enum.RestEnum.CrudOperationType.Read; ServiceOperationOutcome.IsDeleted = false; ServiceOperationOutcome.RequestUri = null; ServiceOperationOutcome.ResourceResult = Conformance; ServiceOperationOutcome.FormatMimeType = SearchParametersServiceOutcome.SearchParameters.Format; ServiceOperationOutcome.HttpStatusCode = System.Net.HttpStatusCode.OK; return(ServiceOperationOutcome); }
public static CapabilityStatement.ResourceInteractionComponent AddSingleResourceInteraction(CapabilityStatement.ResourceComponent resourcecomp, CapabilityStatement.TypeRestfulInteraction type) { var interaction = new CapabilityStatement.ResourceInteractionComponent(); interaction.Code = type; return(interaction); }
public static CapabilityStatement Intersect(this ListedCapabilityStatement system, CapabilityStatement configured, bool strictConfig) { EnsureArg.IsNotNull(system, nameof(system)); EnsureArg.IsNotNull(configured, nameof(configured)); var issues = new List <string>(); var intersecting = new CapabilityStatement { // System wide values Id = system.Id, Url = system.Url?.OriginalString, Version = system.Version, Name = system.Name, Experimental = system.Experimental, Publisher = system.Publisher, Software = system.Software, FhirVersion = system.FhirVersion, Contact = new List <ContactDetail> { new ContactDetail { Telecom = system.Telecom?.Select(x => new ContactPoint(x.System, x.Use, x.Value)).ToList() } }, // Intersections with user configured values Kind = system.Kind.IntersectEnum(configured.Kind, issues, "Kind"), Status = system.Status.IntersectEnum(configured.Status, issues, "Status"), AcceptUnknown = system.AcceptUnknown.IntersectEnum(configured.AcceptUnknown, issues, "AcceptUknown"), Format = system.Format?.IntersectList(configured.Format, x => x, issues, "Format"), }; DateTimeOffset cDate; if (DateTimeOffset.TryParse(configured.Date, out cDate)) { intersecting.Date = cDate.ToString("o", CultureInfo.InvariantCulture); } if (system.Rest.Any() && configured.Rest.Any()) { // Only a single rest node is currently supported if (system.Rest.Count() > 1 || configured.Rest.Count > 1) { throw new NotSupportedException(Core.Resources.CapabilityStatementSingleRestItem); } var systemRest = system.Rest.Single(); var configuredRest = configured.Rest.Single(); var rest = new CapabilityStatement.RestComponent { Mode = systemRest.Mode.IntersectEnum(configuredRest.Mode, issues, "Rest.Mode"), Documentation = systemRest.Documentation, Security = systemRest.Security, Interaction = systemRest.Interaction?.IntersectList(configuredRest.Interaction, x => x.Code, issues, $"Rest.Interaction"), SearchParam = systemRest.SearchParam?.IntersectList(configuredRest.SearchParam, x => x.Name, issues, $"Rest.SearchParam"), Operation = systemRest.Operation?.IntersectList(configuredRest.Operation, x => x.Name, issues, $"Rest.Operation"), }; intersecting.Rest.Add(rest); var systemComponents = systemRest.Resource.Where(x => configuredRest.Resource.Select(r => r.Type).Contains(x.Type)); foreach (var systemComponent in systemComponents) { var configuredComponent = configuredRest.Resource.Single(x => x.Type == systemComponent.Type); // If the system has been set to support include, then build the possible include params from the search parameters if (system.SupportsInclude) { systemComponent.SearchInclude = systemComponent.SearchParam.Where(sp => sp.Type == SearchParamType.Reference).Select(sp => $"{systemComponent.Type.ToString()}.{sp.Name}").ToList(); } var interaction = new CapabilityStatement.ResourceComponent { // System predefined values Type = systemComponent.Type, // User configurable override Profile = configuredComponent.Profile ?? systemComponent.Profile, // Boolean intersections ReadHistory = systemComponent.ReadHistory.IntersectBool(configuredComponent.ReadHistory, issues, $"Rest.Resource['{systemComponent.Type}'].ReadHistory"), UpdateCreate = systemComponent.UpdateCreate.IntersectBool(configuredComponent.UpdateCreate, issues, $"Rest.Resource['{systemComponent.Type}'.UpdateCreate"), ConditionalCreate = systemComponent.ConditionalCreate.IntersectBool(configuredComponent.ConditionalCreate, issues, $"Rest.Resource['{systemComponent.Type}'].ConditionalCreate"), ConditionalUpdate = systemComponent.ConditionalUpdate.IntersectBool(configuredComponent.ConditionalUpdate, issues, $"Rest.Resource['{systemComponent.Type}'].ConditionalUpdate"), // List intersections SearchInclude = system.SupportsInclude ? systemComponent.SearchInclude.IntersectList(configuredComponent.SearchInclude, x => x, issues, $"Rest.Resource['{systemComponent.Type}'].SearchInclude").ToList() : Enumerable.Empty <string>(), SearchRevInclude = systemComponent.SearchRevInclude.IntersectList(configuredComponent.SearchRevInclude, x => x, issues, $"Rest.Resource['{systemComponent.Type}'].SearchRevInclude").ToList(), Interaction = systemComponent.Interaction.IntersectList(configuredComponent.Interaction, x => x.Code, issues, $"Rest.Resource['{systemComponent.Type}'].Interaction"), ReferencePolicy = systemComponent.ReferencePolicy.IntersectList(configuredComponent.ReferencePolicy, x => x, issues, $"Rest.Resource['{systemComponent.Type}'].ReferencePolicy"), SearchParam = systemComponent.SearchParam.IntersectList(configuredComponent.SearchParam, x => string.Concat(x.Name, x.Type), issues, $"Rest.Resource['{systemComponent.Type}'].SearchParam"), // Listed Enumerations intersections Versioning = systemComponent.Versioning.IntersectEnum(configuredComponent.Versioning, issues, $"Rest.Resource['{systemComponent.Type}'].Versioning"), ConditionalRead = systemComponent.ConditionalRead.IntersectEnum(configuredComponent.ConditionalRead, issues, $"Rest.Resource['{systemComponent.Type}'].ConditionalRead"), ConditionalDelete = systemComponent.ConditionalDelete.IntersectEnum(configuredComponent.ConditionalDelete, issues, $"Rest.Resource['{systemComponent.Type}'].ConditionalDelete"), }; rest.Resource.Add(interaction); } rest.Resource = rest.Resource.OrderBy(x => x.Type.ToString()).ToList(); } if (strictConfig && issues.Any()) { throw new UnsupportedConfigurationException(Core.Resources.UnsupportedConfigurationMessage, issues.Select(i => new OperationOutcomeIssue(OperationOutcomeConstants.IssueSeverity.Error, OperationOutcomeConstants.IssueType.Exception, i)).ToArray()); } return(intersecting); }
public static CapabilityStatement GenerateCapabilityStatement(string url) { var cs = new CapabilityStatement { Name = "Azure HLS Team API Application FHIR Server", Status = PublicationStatus.Draft, Experimental = true, Publisher = "Microsoft Corporation", FhirVersion = "R4.Core 0.95.0.0", Format = new[] { "json", "xml" }, Contact = new List <ContactDetail>() }; // cs.AcceptUnknown = CapabilityStatement.UnknownContentCode.Both; var cc = new ContactDetail { Name = "Steve Ordahl", Telecom = new List <ContactPoint> { new ContactPoint(ContactPoint.ContactPointSystem.Email, ContactPoint.ContactPointUse.Work, "*****@*****.**") } }; cs.Contact.Add(cc); cs.Kind = CapabilityStatement.CapabilityStatementKind.Instance; cs.Date = "2018-05-06"; cs.Description = new Markdown("This is the FHIR capability statement for the HLS Team API Application FHIR Server 3.0.1"); cs.Software = new CapabilityStatement.SoftwareComponent { Name = "Experimental Microsoft HLS Team FHIR Server API App", Version = "0.9.1", ReleaseDate = "2018-05-06" }; cs.Implementation = new CapabilityStatement.ImplementationComponent { Description = "MSHLS Experimental FHIR Server" }; var endpos = url.ToLower().LastIndexOf("/metadata", StringComparison.Ordinal); if (endpos > -1) { url = url.Substring(0, endpos); } cs.Implementation.Url = url; var rc = new CapabilityStatement.RestComponent { Mode = CapabilityStatement.RestfulCapabilityMode.Server, Security = new CapabilityStatement.SecurityComponent { Service = new List <CodeableConcept> { new CodeableConcept("http://hl7.org/fhir/restful-security-service", "SMART-on-FHIR", "OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)") }, Extension = new List <Extension>() } }; //security profile var oauthex = new Extension { Extension = new List <Extension>(), Url = "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris" }; oauthex.Extension.Add(new Extension("token", new FhirUri("https://login.microsoftonline.com/microsoft.onmicrosoft.com/oauth2/token"))); oauthex.Extension.Add(new Extension("authorize", new FhirUri("https://login.microsoftonline.com/microsoft.onmicrosoft.com/oauth2/authorize"))); rc.Security.Extension.Add(oauthex); rc.Security.Cors = true; //All controller resources var supported = Enum.GetValues(typeof(ResourceType)); foreach (ResourceType k in supported) { var rescomp = new CapabilityStatement.ResourceComponent { Type = k, Versioning = CapabilityStatement.ResourceVersionPolicy.Versioned, Interaction = new List <CapabilityStatement.ResourceInteractionComponent> { new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Create }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Update }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Delete }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read }, new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Vread } } }; rc.Resource.Add(rescomp); } cs.Rest.Add(rc); return(cs); }
public static Resource GetStatement(NameValueCollection queryParam) { string modeVal = Utilities.GetQueryValue("mode", queryParam); if (modeVal.ToLower() == "terminology") { return(TerminologyCapability.GetStatement(false)); } CapabilityStatement capabilityStatement = new CapabilityStatement { Url = TERMINZ_CANONICAL, Id = "capability-fhir-server-patients-first", Description = new Markdown(TERMINZ_DESCRIPTION), Name = "Patients First Terminology Server (Terminz)", Publisher = "Patients First Ltd", Date = "2019-05-08", Version = "4.0.0", FhirVersion = FHIRVersion.N4_0_0, //Language = "en-NZ", // review with next version of library - this needs to be a coded element! Status = PublicationStatus.Draft, //capabilityStatement.AcceptUnknown = CapabilityStatement.UnknownContentCode.Both; Experimental = true, Format = new string[] { "json", "xml" }, Software = new CapabilityStatement.SoftwareComponent { Name = "Health Intelligence Platform", Version = "6.9.6.0", ReleaseDate = "2019-05-08" }, Kind = CapabilityStatementKind.Instance, Implementation = new CapabilityStatement.ImplementationComponent { Description = TERMINZ_DESCRIPTION, Url = TERMINZ_CANONICAL } }; ContactDetail cd = new ContactDetail { Name = "Peter Jordan" }; ContactPoint cp = new ContactPoint { System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**" }; cd.Telecom.Add(cp); capabilityStatement.Contact.Add(cd); // Add Extensions for supported Code Systems capabilityStatement.AddExtension(HL7_FHIR_CANONICAL + "/StructureDefinition/capabilitystatement-supported-system", new FhirUri("http://snomed.info/sct")); capabilityStatement.AddExtension(HL7_FHIR_CANONICAL + "/StructureDefinition/capabilitystatement-supported-system", new FhirUri("http://loinc.org")); capabilityStatement.AddExtension(HL7_FHIR_CANONICAL + "/StructureDefinition/capabilitystatement-supported-system", new FhirUri("http://nzmt.org.nz")); // create server object var server = new CapabilityStatement.RestComponent { Mode = CapabilityStatement.RestfulCapabilityMode.Server, Documentation = new Markdown("RESTful Terminology Server") }; server.Interaction.Add(new CapabilityStatement.SystemInteractionComponent { Code = CapabilityStatement.SystemRestfulInteraction.Batch, Documentation = new Markdown("Supported for validate-code and translate operations.") }); // Add CORS security server.Security = new CapabilityStatement.SecurityComponent { Cors = true }; // create resource objects and add them to server object.... // Capability Statement - only if /CapabilityStatement is supported where multiple CS exist // TerminologyCapabilities var resourceTerminologyCapabilities = new CapabilityStatement.ResourceComponent { Type = ResourceType.TerminologyCapabilities, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions var confReadcs = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read, Documentation = new Markdown("Read allows clients to get the logical definition of the Terminology Capability Statement") }; resourceTerminologyCapabilities.Interaction.Add(confReadcs); // Operation Definition var resourceOperationDefinition = new CapabilityStatement.ResourceComponent { Type = ResourceType.OperationDefinition, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions var confReadOd = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read, Documentation = new Markdown("Read allows clients to get the logical definition of the Operation Definition") }; resourceOperationDefinition.Interaction.Add(confReadOd); var confSearchOd = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Operation Definitions on the server") }; resourceOperationDefinition.Interaction.Add(confSearchOd); // add search parameters var spOd0 = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/OperationDefinition-identifier" }; resourceOperationDefinition.SearchParam.Add(spOd0); var spOd1 = new CapabilityStatement.SearchParamComponent { Name = "url", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/OperationDefinition-url" }; resourceOperationDefinition.SearchParam.Add(spOd1); // CodeSystem var resourceCodeSystem = new CapabilityStatement.ResourceComponent { Type = ResourceType.CodeSystem, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions var confRead0 = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read, Documentation = new Markdown("Read allows clients to get the logical definitions of Code Systems") }; resourceCodeSystem.Interaction.Add(confRead0); var confSearch0 = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Code Systems on the server") }; resourceCodeSystem.Interaction.Add(confSearch0); // add search parameters var sp1 = new CapabilityStatement.SearchParamComponent { Name = "code", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-code" }; resourceCodeSystem.SearchParam.Add(sp1); var sp2 = new CapabilityStatement.SearchParamComponent { Name = "date", Type = SearchParamType.Date, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-date" }; //resourceCodeSystem.SearchParam.Add(sp2); var sp3 = new CapabilityStatement.SearchParamComponent { Name = "name", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-name" }; //resourceCodeSystem.SearchParam.Add(sp3); var sp4 = new CapabilityStatement.SearchParamComponent { Name = "reference", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-reference" }; //resourceCodeSystem.SearchParam.Add(sp4); var sp5 = new CapabilityStatement.SearchParamComponent { Name = "status", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-status" }; //resourceCodeSystem.SearchParam.Add(sp5); var sp6 = new CapabilityStatement.SearchParamComponent { Name = "system", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-system" }; resourceCodeSystem.SearchParam.Add(sp6); var sp7 = new CapabilityStatement.SearchParamComponent { Name = "url", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-url" }; resourceCodeSystem.SearchParam.Add(sp7); var sp8 = new CapabilityStatement.SearchParamComponent { Name = "version", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-version" }; resourceCodeSystem.SearchParam.Add(sp8); var sp9 = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-identifier" }; resourceCodeSystem.SearchParam.Add(sp9); var sp1a = new CapabilityStatement.SearchParamComponent { Name = "content-mode", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-content-mode" }; resourceCodeSystem.SearchParam.Add(sp1a); var sp1b = new CapabilityStatement.SearchParamComponent { Name = "supplements", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/CodeSystem-supplements" }; resourceCodeSystem.SearchParam.Add(sp1b); // ValueSet var resourceValueSet = new CapabilityStatement.ResourceComponent { Type = ResourceType.ValueSet, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions var confRead = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read, Documentation = new Markdown("Read allows clients to get the logical definitions of Value Sets") }; resourceValueSet.Interaction.Add(confRead); var confSearch = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Value Sets on the server") }; resourceValueSet.Interaction.Add(confSearch); // add search parameters var sp11 = new CapabilityStatement.SearchParamComponent { Name = "code", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-code" }; resourceValueSet.SearchParam.Add(sp11); var sp12 = new CapabilityStatement.SearchParamComponent { Name = "date", Type = SearchParamType.Date, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-date" }; //resourceValueSet.SearchParam.Add(sp12); var sp13 = new CapabilityStatement.SearchParamComponent { Name = "name", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-name" }; //resourceValueSet.SearchParam.Add(sp13); var sp14 = new CapabilityStatement.SearchParamComponent { Name = "reference", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-reference" }; //resourceValueSet.SearchParam.Add(sp14); var sp15 = new CapabilityStatement.SearchParamComponent { Name = "status", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-status" }; //resourceValueSet.SearchParam.Add(sp15); var sp16 = new CapabilityStatement.SearchParamComponent { Name = "system", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-system" }; resourceValueSet.SearchParam.Add(sp16); var sp17 = new CapabilityStatement.SearchParamComponent { Name = "url", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-url" }; resourceValueSet.SearchParam.Add(sp17); var sp18 = new CapabilityStatement.SearchParamComponent { Name = "version", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-version" }; resourceValueSet.SearchParam.Add(sp18); var sp19 = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ValueSet-identifier" }; resourceValueSet.SearchParam.Add(sp19); // ConceptMap var resourceConceptMap = new CapabilityStatement.ResourceComponent { Type = ResourceType.ConceptMap, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions var confRead2 = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read, Documentation = new Markdown("Read allows clients to get the logical definitions of Concept Maps") }; resourceConceptMap.Interaction.Add(confRead2); var confSearch2 = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Concept Maps on the server") }; resourceConceptMap.Interaction.Add(confSearch2); // add search parameters var sp21 = new CapabilityStatement.SearchParamComponent { Name = "date", Type = SearchParamType.Date, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-date" }; //resourceConceptMap.SearchParam.Add(sp21); var sp22 = new CapabilityStatement.SearchParamComponent { Name = "name", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-name" }; //resourceConceptMap.SearchParam.Add(sp22); var sp23 = new CapabilityStatement.SearchParamComponent { Name = "status", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-status" }; //resourceConceptMap.SearchParam.Add(sp23); var sp24 = new CapabilityStatement.SearchParamComponent { Name = "source", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-source" }; resourceConceptMap.SearchParam.Add(sp24); var sp25 = new CapabilityStatement.SearchParamComponent { Name = "target", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-target" }; resourceConceptMap.SearchParam.Add(sp25); var sp26 = new CapabilityStatement.SearchParamComponent { Name = "url", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-url" }; resourceConceptMap.SearchParam.Add(sp26); var sp27 = new CapabilityStatement.SearchParamComponent { Name = "version", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-version" }; resourceConceptMap.SearchParam.Add(sp27); var sp28 = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/ConceptMap-identifier" }; resourceConceptMap.SearchParam.Add(sp28); // Naming System var resourceNamingSystem = new CapabilityStatement.ResourceComponent { Type = ResourceType.NamingSystem, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions var confReadNs = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.Read, Documentation = new Markdown("Read allows clients to get the logical definitions of Naming Systems") }; resourceNamingSystem.Interaction.Add(confReadNs); var confSearchNs = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Naming Systems on the server") }; resourceNamingSystem.Interaction.Add(confSearchNs); // add search parameters var spNs = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/NamingSystem-identifier" }; resourceNamingSystem.SearchParam.Add(spNs); var spNs2 = new CapabilityStatement.SearchParamComponent { Name = "url", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/NamingSystem-url" }; resourceNamingSystem.SearchParam.Add(spNs2); var spNs3 = new CapabilityStatement.SearchParamComponent { Name = "value", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/NamingSystem-value" }; resourceNamingSystem.SearchParam.Add(spNs3); var spNs4 = new CapabilityStatement.SearchParamComponent { Name = "kind", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/NamingSystem-kind" }; resourceNamingSystem.SearchParam.Add(spNs4); // Location var resourceLocation = new CapabilityStatement.ResourceComponent { Type = ResourceType.Location, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions //var confRead3 = new CapabilityStatement.ResourceInteractionComponent(); //confRead3.Code = CapabilityStatement.TypeRestfulInteraction.Read; //confRead3.Documentation = "Read allows clients to get the logical definitions of the locations"; //resourceLocation.Interaction.Add(confRead3); var confSearch3 = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Locations (NZ Healthcare Facilities) on the server") }; resourceLocation.Interaction.Add(confSearch3); // add search parameters var sp31 = new CapabilityStatement.SearchParamComponent { Name = "address", Type = SearchParamType.Date, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Location-address" }; resourceLocation.SearchParam.Add(sp31); var sp32 = new CapabilityStatement.SearchParamComponent { Name = "address-city", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Location-address-city" }; resourceLocation.SearchParam.Add(sp32); var sp33 = new CapabilityStatement.SearchParamComponent { Name = "address-postalcode", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Location-address-postalcode" }; resourceLocation.SearchParam.Add(sp33); var sp34 = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Location-identifier" }; resourceLocation.SearchParam.Add(sp34); var sp35 = new CapabilityStatement.SearchParamComponent { Name = "name", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Location-name" }; resourceLocation.SearchParam.Add(sp35); var sp36 = new CapabilityStatement.SearchParamComponent { Name = "type", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Location-type" }; resourceLocation.SearchParam.Add(sp36); // Organization var resourceOrganization = new CapabilityStatement.ResourceComponent { Type = ResourceType.Organization, ReadHistory = false, UpdateCreate = false, Versioning = CapabilityStatement.ResourceVersionPolicy.NoVersion }; // add interactions //var confRead4 = new CapabilityStatement.ResourceInteractionComponent(); //confRead4.Code = CapabilityStatement.TypeRestfulInteraction.Read; //confRead4.Documentation = "Read allows clients to get the logical definitions of the locations"; //resourceOrganization.Interaction.Add(confRead4); var confSearch4 = new CapabilityStatement.ResourceInteractionComponent { Code = CapabilityStatement.TypeRestfulInteraction.SearchType, Documentation = new Markdown("Search allows clients to find Organizations on the server") }; resourceOrganization.Interaction.Add(confSearch4); // add search parameters var sp41 = new CapabilityStatement.SearchParamComponent { Name = "address", Type = SearchParamType.Date, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Organization-address" }; resourceOrganization.SearchParam.Add(sp41); var sp42 = new CapabilityStatement.SearchParamComponent { Name = "address-city", Type = SearchParamType.String, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Organization-address-city" }; resourceOrganization.SearchParam.Add(sp42); var sp43 = new CapabilityStatement.SearchParamComponent { Name = "address-postalcode", Type = SearchParamType.Token, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Organization-address-postalcode" }; resourceOrganization.SearchParam.Add(sp43); var sp44 = new CapabilityStatement.SearchParamComponent { Name = "identifier", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Organization-identifier" }; resourceOrganization.SearchParam.Add(sp44); var sp45 = new CapabilityStatement.SearchParamComponent { Name = "name", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Organization-name" }; resourceOrganization.SearchParam.Add(sp45); var sp46 = new CapabilityStatement.SearchParamComponent { Name = "type", Type = SearchParamType.Uri, Definition = HL7_FHIR_CANONICAL + "/SearchParameter/Organization-type" }; resourceOrganization.SearchParam.Add(sp46); // add resources to server object //server.Resource.Add(resourceCapabilityStatement); server.Resource.Add(resourceTerminologyCapabilities); server.Resource.Add(resourceOperationDefinition); server.Resource.Add(resourceCodeSystem); server.Resource.Add(resourceValueSet); server.Resource.Add(resourceConceptMap); server.Resource.Add(resourceNamingSystem); server.Resource.Add(resourceLocation); server.Resource.Add(resourceOrganization); // add operations to server object var opCom1 = new CapabilityStatement.OperationComponent { Name = "lookup", Definition = TERMINZ_CANONICAL + "/OperationDefinition/CodeSystem-lookup" }; server.Operation.Add(opCom1); var opCom1a = new CapabilityStatement.OperationComponent { Name = "validate-code", Definition = TERMINZ_CANONICAL + "/OperationDefinition/CodeSystem-validate-code" }; //opCom5.FhirCommentsElement.Add(new FhirString("Supported in batch request")); server.Operation.Add(opCom1a); var opCom2 = new CapabilityStatement.OperationComponent { Name = "subsumes", Definition = TERMINZ_CANONICAL + "/OperationDefinition/CodeSystem-subsumes" }; server.Operation.Add(opCom2); var opCom3 = new CapabilityStatement.OperationComponent { Name = "find-matches", Definition = HL7_FHIR_CANONICAL + "/OperationDefinition/CodeSystem-find-matches" }; server.Operation.Add(opCom3); var opCom4 = new CapabilityStatement.OperationComponent { Name = "expand", Definition = TERMINZ_CANONICAL + "/OperationDefinition/ValueSet-expand" }; server.Operation.Add(opCom4); var opCom5 = new CapabilityStatement.OperationComponent { Name = "validate-code", Definition = TERMINZ_CANONICAL + "/OperationDefinition/ValueSet-validate-code" }; //opCom5.FhirCommentsElement.Add(new FhirString("Supported in batch request")); server.Operation.Add(opCom5); var opCom6 = new CapabilityStatement.OperationComponent { Name = "translate", Definition = TERMINZ_CANONICAL + "/OperationDefinition/ConceptMap-translate" }; //opCom6.FhirCommentsElement.Add(new FhirString("Supported in batch request")); server.Operation.Add(opCom6); var opCom7 = new CapabilityStatement.OperationComponent { Name = "closure", Definition = HL7_FHIR_CANONICAL + "/OperationDefinition/ConceptMap-closure" }; server.Operation.Add(opCom7); var opCom8 = new CapabilityStatement.OperationComponent { Name = "preferred-id", Definition = HL7_FHIR_CANONICAL + "/OperationDefinition/NamingSystem-preferred-id" }; server.Operation.Add(opCom8); var opCom9 = new CapabilityStatement.OperationComponent { Name = "versions", Definition = HL7_FHIR_CANONICAL + "/OperationDefinition/CapabilityStatement-versions" }; server.Operation.Add(opCom9); // add server to capability statement object capabilityStatement.Rest.Add(server); // create text AddNarrative(capabilityStatement, server); return(capabilityStatement); }
public static CapabilityStatement GenerateCapabilityStatement() { CapabilityStatement cs = new CapabilityStatement(); cs.Name = "Azure HLS Team API Application FHIR Server"; cs.Status = PublicationStatus.Draft; cs.Experimental = true; cs.Publisher = "Microsoft Corporation"; cs.FhirVersion = "3.0.0"; cs.AcceptUnknown = CapabilityStatement.UnknownContentCode.Both; cs.Format = new string[] { "json", "xml" }; cs.Contact = new List <ContactDetail>(); ContactDetail cc = new ContactDetail(); cc.Name = "Steve Ordahl"; cc.Telecom = new List <ContactPoint>(); cc.Telecom.Add(new ContactPoint(ContactPoint.ContactPointSystem.Email, ContactPoint.ContactPointUse.Work, "*****@*****.**")); cs.Contact.Add(cc); CapabilityStatement.RestComponent rc = new CapabilityStatement.RestComponent(); rc.Mode = CapabilityStatement.RestfulCapabilityMode.Server; //security profile rc.Security = new CapabilityStatement.SecurityComponent(); rc.Security.Service = new List <CodeableConcept>(); rc.Security.Service.Add(new CodeableConcept("http://hl7.org/fhir/restful-security-service", "SMART-on-FHIR", "OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)")); rc.Security.Extension = new List <Extension>(); Extension oauthex = new Extension(); oauthex.Extension = new List <Extension>(); oauthex.Url = "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris"; oauthex.Extension.Add(new Extension("token", new FhirUri("https://login.microsoftonline.com/microsoft.onmicrosoft.com/oauth2/token"))); oauthex.Extension.Add(new Extension("authorize", new FhirUri("https://login.microsoftonline.com/microsoft.onmicrosoft.com/oauth2/authorize"))); rc.Security.Extension.Add(oauthex); rc.Security.Cors = true; //All controller resources var supported = System.Enum.GetValues(typeof(ResourceType)); foreach (ResourceType k in supported) { CapabilityStatement.ResourceComponent rescomp = new CapabilityStatement.ResourceComponent(); rescomp.Type = k; rescomp.Versioning = CapabilityStatement.ResourceVersionPolicy.Versioned; rescomp.Interaction = new List <CapabilityStatement.ResourceInteractionComponent>(); rescomp.Interaction.Add(new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Create }); rescomp.Interaction.Add(new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Update }); rescomp.Interaction.Add(new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Delete }); rescomp.Interaction.Add(new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Read }); rescomp.Interaction.Add(new CapabilityStatement.ResourceInteractionComponent() { Code = CapabilityStatement.TypeRestfulInteraction.Vread }); rc.Resource.Add(rescomp); } cs.Rest.Add(rc); return(cs); }
public static CapabilityStatement.ResourceComponent AddCoreSearchParamsResource(CapabilityStatement.ResourceComponent r, IEnumerable <ModelInfo.SearchParamDefinition> availableModelInfo) { if (availableModelInfo != null) { var parameters = availableModelInfo.Where(sp => sp.Resource == r.Type.GetLiteral()) .Select(sp => new CapabilityStatement.SearchParamComponent { Name = sp.Name, Type = sp.Type, Documentation = sp.Description }); r.SearchParam.AddRange(parameters); } return(r); }