public async Task <IApiResponse <TestResult> > SubmitTestAsync(ITestRequest testRequest, int retryInterval, CancellationToken cancellationToken) { if (testRequest == null) { throw new ArgumentNullException(nameof(testRequest)); } if (cancellationToken == null) { throw new ArgumentNullException(nameof(cancellationToken)); } ValiadateRetryInterval(retryInterval); var submitTestResult = await _connection.Execute <SubmitTestResult>( new ApiRequest(testRequest, "0.1/test", HttpMethod.Post), cancellationToken).ConfigureAwait(false); if (submitTestResult.Success) { // Always wait first await Task.Delay(TimeToWait(retryInterval), cancellationToken); var testResult = await GetTestAsync(submitTestResult.Body.TestId, cancellationToken).ConfigureAwait(false); return(testResult); } else { return(Helper.CreateFailedResponse <TestResult>(string.Empty, submitTestResult.StatusCode)); } }
public Task <IApiResponse <SubmitTestResult> > SubmitTest(ITestRequest testRequest, CancellationToken cancellationToken) { if (testRequest == null) { throw new ArgumentNullException(nameof(testRequest)); } if (cancellationToken == null) { throw new ArgumentNullException(nameof(cancellationToken)); } var message = _connection.Execute <SubmitTestResult>( new ApiRequest(testRequest, "0.1/test", HttpMethod.Post), cancellationToken); return(message); }
/// <summary> /// Creates and hydrates the 'Pathology Test Results' section. /// </summary> /// <returns>A hydrated 'PathologyTestResult' object.</returns> public static PathologyTestResult CreatePathologyResults(Boolean mandatorySectionsOnly) { DateTimeNow = DateTime.Now; // Pathology test result PathologyTestResult pathologyTestResult = BaseCDAModel.CreatePathologyTestResult(); // Test Result Name pathologyTestResult.TestResultName = BaseCDAModel.CreateCodableText("104950002", CodingSystem.SNOMED, "Sulfhaemoglobin measurement"); // Diagnostic Service pathologyTestResult.DiagnosticService = DiagnosticServiceSectionID.Chemistry; // Overall Pathology Test Result Status pathologyTestResult.OverallTestResultStatus = BaseCDAModel.CreateCodableText(HL7ResultStatus.FinalResultsResultsStoredAndVerifiedCanOnlyBeChangedWithACorrectedResult); // Observation Date Time pathologyTestResult.ObservationDateTime = new ISO8601DateTime(DateTimeNow); if (!mandatorySectionsOnly) { // Clinical Information Provided pathologyTestResult.ClinicalInformationProvided = "Hepatitus"; //Pathological Diagnosis pathologyTestResult.PathologicalDiagnosis = new List <ICodableText> { BaseCDAModel.CreateCodableText("17621005", CodingSystem.SNOMED, "Normal"), BaseCDAModel.CreateCodableText("263654008", CodingSystem.SNOMED, "Abnormal") }; // Conclusion pathologyTestResult.Conclusion = "Test Result Group Conclusion"; // Test Result Representation pathologyTestResult.TestResultRepresentation = BaseCDAModel.CreateEncapsulatedData(); pathologyTestResult.TestResultRepresentation.ExternalData = BaseCDAModel.CreateExternalData(MediaType.PDF, AttachmentFileNameAndPath, "Test Result Representation"); // // Demonstrating Text for EncapsulatedData // //pathologyTestResult.TestResultRepresentation = BaseCDAModel.CreateEncapsulatedData(); //pathologyTestResult.TestResultRepresentation.Text = "Lipase 150 U/L (RR < 70)"; // Test Comment pathologyTestResult.TestComment = "Test Result Group Comment"; // Test request details one ITestRequest testRequestDetailsOne = BaseCDAModel.CreateTestRequest(); // Requester Order Identifier testRequestDetailsOne.RequesterOrderIdentifier = BaseCDAModel.CreateInstanceIdentifier("1.2.36.1.2001.1005.52.8003620833333789", "10523479"); // LaboratoryTestResultIdentifier testRequestDetailsOne.LaboratoryTestResultIdentifier = BaseCDAModel.CreateInstanceIdentifier(BaseCDAModel.CreateGuid(), "Laboratory Test Result Identifier"); // Tests Requested Name testRequestDetailsOne.TestsRequestedName = new List <ICodableText> { BaseCDAModel.CreateCodableText("401324008", CodingSystem.SNOMED, "Urinary microscopy, culture and sensitivities"), BaseCDAModel.CreateCodableText("401324008", CodingSystem.SNOMED, "Urinary microscopy, culture and sensitivities"), }; // Test Request Details pathologyTestResult.TestRequestDetails = new List <ITestRequest> { testRequestDetailsOne }; // Result Group (PATHOLOGY TEST RESULT GROUP) pathologyTestResult.ResultGroup = new List <ITestResultGroup> { CreateTestResultGroup(mandatorySectionsOnly) }; } else { // Reporting Pathologist pathologyTestResult.ReportingPathologist = CreateReportingPathologist(mandatorySectionsOnly); } pathologyTestResult.TestSpecimenDetail = new List <SpecimenDetail> { CreateTestSpecimenDetail(mandatorySectionsOnly) }; return(pathologyTestResult); }
public async Task <IApiResponse <TestResult> > SubmitTestAsync(ITestRequest testRequest, CancellationToken cancellationToken) { return(await SubmitTestAsync(testRequest, DefaultRetryInterval, cancellationToken)); }
public async Task <IApiResponse <TestResult> > SubmitTestAsync(ITestRequest testRequest, int retryInterval) { return(await SubmitTestAsync(testRequest, retryInterval, default(CancellationToken))); }
public Task <IApiResponse <SubmitTestResult> > SubmitTest(ITestRequest testRequest) { return(SubmitTest(testRequest, default(CancellationToken))); }