public void SetSecurity(List <Coding> codingList, IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); NullCheck(codingList, "codingList"); CreateMeta(fhirResource.R4); fhirResource.R4.Meta.Security = codingList; }
public void SetSource(Uri uri, IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); NullCheck(uri, "uri"); CreateMeta(fhirResource.R4); fhirResource.R4.Meta.Source = uri.ToString(); }
public void SetProfile(IEnumerable <string> profileList, IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); NullCheck(profileList, "profileList"); CreateMeta(fhirResource.R4); fhirResource.R4.Meta.Profile = profileList; }
public IList <FhirContainedResource> GetContainedResourceDictionary(IFhirResourceR4 fhirResource) { List <FhirContainedResource> ResultList = new List <FhirContainedResource>(); Resource Resource = fhirResource.R4; if (Resource is DomainResource DomainResource) { foreach (Resource ContainedResource in DomainResource.Contained) { Bug.Common.Enums.ResourceType?ResourceType = IResourceNameToTypeMap.GetResourceType(ContainedResource.ResourceType.GetLiteral()); if (ResourceType.HasValue) { ResultList.Add(new FhirContainedResource(this.FhirVersion, ResourceType.Value, ContainedResource.Id) { R4 = ContainedResource }); } else { throw new ApplicationException($"Attempt to parse an unknown resource type of {ContainedResource.ResourceType.GetLiteral()} which was contained within a {Resource.ResourceType.GetLiteral()} parent resource of FHIR version {this.FhirVersion.GetCode()}."); } } } return(ResultList); }
public byte[] SerializeToJsonBytes(IFhirResourceR4 fhirResource, Bug.Common.Enums.SummaryType summaryType = Bug.Common.Enums.SummaryType.False) { SummaryTypeMap Map = new SummaryTypeMap(); try { FhirJsonSerializer FhirJsonSerializer = new FhirJsonSerializer(new SerializerSettings() { Pretty = false, AppendNewLine = false }); return(FhirJsonSerializer.SerializeToBytes(fhirResource.R4, Map.GetForward(summaryType))); } catch (Exception oExec) { throw new Bug.Common.Exceptions.FhirFatalException(System.Net.HttpStatusCode.InternalServerError, oExec.Message); } }
public string?GetVersion(IFhirResourceR4 fhirResource) { if (fhirResource is null) { throw new ArgumentNullException(paramName: nameof(fhirResource)); } if (fhirResource.R4 is null) { throw new ArgumentNullException(paramName: nameof(fhirResource.R4)); } if (fhirResource.R4?.Meta is null) { return(null); } else { return(fhirResource.R4?.Meta?.VersionId); } }
public IEnumerable <ITypedElement>?Select(IFhirResourceR4 fhirResource, string Expression) { ITypedElement TypedElement = fhirResource.R4.ToTypedElement(); FhirPathCompiler.DefaultSymbolTable.AddFhirExtensions(); //var oFhirEvaluationContext = new Hl7.Fhir.FhirPath.FhirEvaluationContext(TypedElement); var oFhirEvaluationContext = new Hl7.Fhir.FhirPath.FhirEvaluationContext(fhirResource.R4); //The resolve() function then also needs to be provided an external resolver delegate that performs the resolve //that delegate can be set as below. Here I am providing my own implementation 'IPyroFhirPathResolve.Resolver' oFhirEvaluationContext.ElementResolver = IFhirPathResolve.Resolver; try { return(TypedElement.Select(Expression, oFhirEvaluationContext)); } catch (Exception Exec) { throw new Bug.Common.Exceptions.FhirFatalException(System.Net.HttpStatusCode.InternalServerError, $"Unable to evaluate the SearchParameter FhirPath expression of: {Expression} for FHIR {FhirVersion.R4.GetCode()}. See inner exception for more info.", Exec); } }
public void SetVersion(string versionId, IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); CreateMeta(fhirResource.R4); fhirResource.R4.Meta.VersionId = versionId; }
public DateTimeOffset?GetLastUpdated(IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); return(fhirResource.R4?.Meta?.LastUpdated); }
public void SetLastUpdated(DateTimeOffset dateTimeOffset, IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); CreateMeta(fhirResource.R4); fhirResource.R4.Meta.LastUpdated = dateTimeOffset; }
public string GetName(IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); return(fhirResource.R4.ResourceType.GetLiteral()); }
public string SetFhirId(string id, IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); return(fhirResource.R4.Id = id); }
public string?GetFhirId(IFhirResourceR4 fhirResource) { NullCheck(fhirResource.R4, "resource"); return(fhirResource.R4.Id); }