public static async Task <Bundle> FetchPatientRecordAsync(this FhirClient client, Uri patient = null, FhirDateTime start = null, FhirDateTime end = null) { var par = new Parameters(); if (start != null) { par.Add("start", start); } if (end != null) { par.Add("end", end); } Resource result; if (patient == null) { result = await client.TypeOperationAsync <Patient>(RestOperation.FETCH_PATIENT_RECORD, par).ConfigureAwait(false); } else { var location = new ResourceIdentity(patient); result = await client.InstanceOperationAsync(location.WithoutVersion().MakeRelative(), RestOperation.FETCH_PATIENT_RECORD, par).ConfigureAwait(false); } return(OperationResult <Bundle>(result)); }
public static Bundle FetchPatientRecord(this FhirClient client, Uri patient = null, FhirDateTime start = null, FhirDateTime end = null) { var par = new Parameters(); if (start != null) { par.Add("start", start); } if (end != null) { par.Add("end", end); } Resource result; if (patient == null) { result = client.TypeOperation <Patient>(Operation.FETCH_PATIENT_RECORD, par); } else { var location = new ResourceIdentity(patient); result = client.InstanceOperation(location.WithoutVersion().MakeRelative(), Operation.FETCH_PATIENT_RECORD, par); } return(expect <Bundle>(result)); }
internal static ResourceEntry CreateResourceEntryFromResource(Resource resource, string location, string category = null, string lastModified = null) { ResourceEntry result = ResourceEntry.Create(resource); if (!String.IsNullOrEmpty(location)) { ResourceIdentity reqId = new ResourceIdentity(location); result.Id = reqId.WithoutVersion(); if (reqId.VersionId != null) { result.SelfLink = reqId; } } if (!String.IsNullOrEmpty(lastModified)) { result.LastUpdated = DateTimeOffset.Parse(lastModified); } if (!String.IsNullOrEmpty(category)) { result.Tags = ParseCategoryHeader(category); } result.Title = "A " + resource.GetType().Name + " resource"; return(result); }
public static OperationOutcome ValidateDelete(this FhirClient client, ResourceIdentity location) { if (location == null) { throw Error.ArgumentNull("location"); } var par = new Parameters().Add("mode", new Code("delete")); return(expect <OperationOutcome>(client.InstanceOperation(location.WithoutVersion().MakeRelative(), Operation.VALIDATE_RESOURCE, par))); }
private ResourceEntry createResourceEntry(string resourceType) { Resource resource = null; if (resourceType == "Binary") { resource = makeBinary(Body, ContentType); } else { resource = parseBody <Resource>(BodyAsString(), ContentType, b => FhirParser.ParseResourceFromXml(b), b => FhirParser.ParseResourceFromJson(b)); } ResourceEntry result = ResourceEntry.Create(resource); var location = Location ?? ContentLocation ?? ResponseUri.OriginalString; if (!String.IsNullOrEmpty(location)) { ResourceIdentity reqId = new ResourceIdentity(location); // Set the id to the location, without the version specific part result.Id = reqId.WithoutVersion(); // If the content location has version information, set to SelfLink to it if (reqId.VersionId != null) { result.SelfLink = reqId; } } if (!String.IsNullOrEmpty(LastModified)) { result.LastUpdated = DateTimeOffset.Parse(LastModified); } if (!String.IsNullOrEmpty(Category)) { result.Tags = HttpUtil.ParseCategoryHeader(Category); } result.Title = "A " + resource.GetType().Name + " resource"; return(result); }
public static ValueSet ExpandValueSet(this FhirClient client, Uri valueset, FhirString filter = null, FhirDateTime date = null) { if (valueset == null) { throw Error.ArgumentNull("valuesetLocation"); } var par = new Parameters(); if (filter != null) { par.Add("filter", filter); } if (date != null) { par.Add("date", date); } ResourceIdentity id = new ResourceIdentity(valueset); return(expect <ValueSet>(client.InstanceOperation(id.WithoutVersion().MakeRelative(), Operation.EXPAND_VALUESET, par))); }
public static async Task <ValueSet> ExpandValueSetAsync(this FhirClient client, Uri valueset, FhirString filter = null, FhirDateTime date = null) { if (valueset == null) { throw Error.ArgumentNull(nameof(valueset)); } var par = new Parameters(); if (filter != null) { par.Add("filter", filter); } if (date != null) { par.Add("date", date); } ResourceIdentity id = new ResourceIdentity(valueset); return((await client.InstanceOperationAsync(id.WithoutVersion().MakeRelative(), RestOperation.EXPAND_VALUESET, par).ConfigureAwait(false)) .OperationResult <ValueSet>()); }
public static async Task <ValidateCodeResult> ValidateCodeAsync(this IFhirClient client, String valueSetId, FhirUri identifier = null, FhirUri context = null, ValueSet valueSet = null, Code code = null, FhirUri system = null, FhirString version = null, FhirString display = null, Coding coding = null, CodeableConcept codeableConcept = null, FhirDateTime date = null, FhirBoolean @abstract = null) { if (valueSetId == null) { throw new ArgumentNullException(nameof(valueSetId)); } var par = new Parameters() .Add(nameof(identifier), identifier) .Add(nameof(context), context) .Add(nameof(valueSet), valueSet) .Add(nameof(code), code) .Add(nameof(system), system) .Add(nameof(version), version) .Add(nameof(display), display) .Add(nameof(coding), coding) .Add(nameof(codeableConcept), codeableConcept) .Add(nameof(date), date) .Add(nameof(@abstract), @abstract); ResourceIdentity location = new ResourceIdentity("ValueSet/" + valueSetId); var result = await client.InstanceOperationAsync(location.WithoutVersion().MakeRelative(), RestOperation.VALIDATE_CODE, par).ConfigureAwait(false); if (result != null) { return(ValidateCodeResult.FromParameters(result.OperationResult <Parameters>())); } else { return(null); } }
private static Parameters validateCodeForValueSetId(FhirClient client, string valueSetId, Parameters par) { ResourceIdentity location = new ResourceIdentity("ValueSet/" + valueSetId); return(expect <Parameters>(client.InstanceOperation(location.WithoutVersion().MakeRelative(), Operation.VALIDATE_CODE, par))); }
public static async Task <OperationOutcome> ValidateDeleteAsync(this FhirClient client, ResourceIdentity location) { if (location == null) { throw Error.ArgumentNull(nameof(location)); } var par = new Parameters().Add("mode", new Code("delete")); return(OperationResult <OperationOutcome>(await client.InstanceOperationAsync(location.WithoutVersion().MakeRelative(), RestOperation.VALIDATE_RESOURCE, par).ConfigureAwait(false))); }
public void WithVersion() { var identity = new ResourceIdentity("http://localhost/some/sub/path/fhir/Patient/B256/"); var newIdentity = identity.WithVersion("3141"); Assert.AreEqual("B256", newIdentity.Id); Assert.AreEqual("3141", newIdentity.VersionId); identity = new ResourceIdentity("http://localhost/some/sub/path/fhir/Organization/3/_history/X98"); newIdentity = identity.WithVersion("3141"); Assert.AreEqual("3", newIdentity.Id); Assert.AreEqual("3141", newIdentity.VersionId); identity = new ResourceIdentity("Organization/3"); newIdentity = identity.WithVersion("3141"); Assert.AreEqual("3", newIdentity.Id); Assert.AreEqual("3141", newIdentity.VersionId); identity = new ResourceIdentity("Organization/3/_history/X98"); newIdentity = identity.WithVersion("3141"); Assert.AreEqual("3", newIdentity.Id); Assert.AreEqual("3141", newIdentity.VersionId); var identity2 = identity.WithoutVersion(); Assert.AreEqual("Organization/3", identity2.ToString()); }