private void btnShowTestResults_Click(object sender, EventArgs e) { // get test results for patient Bundle results = client.Search <DiagnosticReport>(new string[] { $"patient={patient.Id}" }); foreach (Bundle.EntryComponent entryComponent in results.Entry) { // add the DiagnosticReport to the list... DiagnosticReport report = entryComponent.Resource as DiagnosticReport; string testReportId = report.Id; string test = report.GetExtension("http://wales.nhs.uk/fhir/extensions/DiagnosticReport-WrrsReportTitle").Value.ToString(); string effectiveDate = ((FhirDateTime)report.Effective).ToDateTime().Value.ToString("dd-MMM-yyyy"); string organisation = ""; DiagnosticReport.PerformerComponent firstOrDefault = report.Performer.FirstOrDefault(); if (firstOrDefault != null) { organisation = firstOrDefault.Actor.Display; } var lvi = new ListViewItem(testReportId); lvi.SubItems.Add(test); lvi.SubItems.Add(effectiveDate); lvi.SubItems.Add(organisation); lstTestResults.Items.Add(lvi); } }
/// <summary> /// Deserialize JSON into a FHIR DiagnosticReport /// </summary> public static void DeserializeJson(this DiagnosticReport current, ref Utf8JsonReader reader, JsonSerializerOptions options) { string propertyName; while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return; } if (reader.TokenType == JsonTokenType.PropertyName) { propertyName = reader.GetString(); if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug) { Console.WriteLine($"DiagnosticReport >>> DiagnosticReport.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"DiagnosticReport: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
public void DifferentSectionTitlesGiveDifferentSectionHandles() { var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); var sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle); Assert.AreNotEqual(sectionOneHandle, sectionTwoHandle); }
public void SameSectionTitleGivesSameSectionHandle() { var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); var sectionOneHandleTwo = DiagnosticReport.GetSection(k_SectionOneTitle); Assert.AreEqual(sectionOneHandle, sectionOneHandleTwo); }
private void lstTestResults_SelectedIndexChanged(object sender, EventArgs e) { if (lstTestResults.SelectedItems.Count == 1) { string diagnosticReportId = lstTestResults.SelectedItems[0].Text; string fhirRef = $"DiagnosticReport/{diagnosticReportId}"; DiagnosticReport diagnosticReport = client.Read <DiagnosticReport>(fhirRef); _htmlPanel.Text = diagnosticReport.Text.Div; //cboObservations.Items.Clear(); Dictionary <string, string> obsDictionary = new Dictionary <string, string>(); foreach (Resource resource in diagnosticReport.Contained) { if (resource.TypeName == "Observation") { Observation observation = (Observation)resource; CodeableConcept firstOrDefault = observation.Category.FirstOrDefault(); Coding orDefault = firstOrDefault?.Coding.FirstOrDefault(); if (orDefault != null && (firstOrDefault != null && orDefault.Code == "laboratory")) { string observationCode = observation.Code.Coding.FirstOrDefault().Code; string observationDisplay = observation.Code.Coding.FirstOrDefault().Display; if (!obsDictionary.ContainsKey(observationCode)) { obsDictionary.Add(observationCode, observationDisplay); } } } } cboObservations.DataSource = new BindingSource(obsDictionary, null); cboObservations.DisplayMember = "Value"; cboObservations.ValueMember = "Key"; } }
public async Task <IActionResult> CreateDiagnosticAsync(string patientReference, string practitionerReference) { DiagnosticReport diagReport = new DiagnosticReport(); var identifier = new Identifier("UptSystem", "UPTValue"); diagReport.Identifier.Add(identifier); ResourceReference patientRef = new ResourceReference(patientReference); diagReport.Subject = patientRef; PerformerComponent performerComponent = new PerformerComponent(); performerComponent.Actor = new ResourceReference(practitionerReference); // multiple doctors reference can be added here diagReport.Performer.Add(performerComponent); diagReport.Issued = DateTimeOffset.Now; var response = await _client.CreateAsync(diagReport); if (response == null) { return(BadRequest()); } return(Created($"{BASEURL}/DiagnosticReport/{response.Id}", "Created with succes!")); }
public void CheckGeneratedEventsOverTwentyAreReported() { const string k_ExpectedOutput = @"==== Last 20 Events ==== Event 11: Event Body 11 Event 12: Event Body 12 Event 13: Event Body 13 Event 14: Event Body 14 Event 15: Event Body 15 Event 16: Event Body 16 Event 17: Event Body 17 Event 18: Event Body 18 Event 19: Event Body 19 Event 20: Event Body 20 Event 21: Event Body 21 Event 22: Event Body 22 Event 23: Event Body 23 Event 24: Event Body 24 Event 25: Event Body 25 Event 26: Event Body 26 Event 27: Event Body 27 Event 28: Event Body 28 Event 29: Event Body 29 Event 30: Event Body 30 "; for (int i = 0; i <= 30; i++) { DiagnosticReport.AddEventEntry($"Event {i}", $"Event Body {i}"); } var report = DiagnosticReport.GenerateReport(); Assert.AreEqual(k_ExpectedOutput, report); }
public override DiagnosticReport CreateDiagnosticReport(DiagnosticReport report) { report.ApplicationInfo = new ApplicationInfo(false); var attachments = new List <DiagnosticAttachmentInfo>(); foreach (var att in report.Attachments) { // User wishes to attach configuration if (att.FileName == "SanteDB.config") { // Compress using (MemoryStream ms = new MemoryStream()) { using (GZipStream gz = new GZipStream(ms, CompressionMode.Compress)) ApplicationContext.Current.Configuration.Save(gz); attachments.Add(new DiagnosticBinaryAttachment() { Content = ms.ToArray(), FileDescription = "Configuration file", FileName = "SanteDB.config.gz", Id = "config", ContentType = "application/x-gzip" }); } } else if (att is DiagnosticBinaryAttachment bin && bin.Content.Length > 0) { attachments.Add(att); }
public static void WriteDiagnosticReport(this TextWriter writer, DiagnosticReport report) { foreach (var d in report) { writer.WriteDiagnostic(d); } }
public DiagnosticReport CreateDiagnosticReport() { Hl7.Fhir.Model.Coding coding = new Hl7.Fhir.Model.Coding { System = "http://loinc.org", Code = "51990-0", Display = "Basic Metabolic Panel" }; List <Hl7.Fhir.Model.Coding> CodingList = new List <Hl7.Fhir.Model.Coding> { coding }; var code = new CodeableConcept { Coding = CodingList }; ResourceReference reff = new ResourceReference { Reference = "Patient/099e7de7-c952-40e2-9b4e-0face78c9d80" }; DiagnosticReport dr = new DiagnosticReport { Code = code, Status = DiagnosticReport.DiagnosticReportStatus.Final, Subject = reff, }; //dr.ResourceType = "DiagnosticReport"; return(dr); }
void SimpleNarrative() { const String prefix = "SimpleNarrativeOnlyReport"; this.DeleteExamples(prefix); Bundle b; { BreastRadiologyDocument doc = this.MakeDoc(); { BreastRadComposition index = doc.Index; index.Resource.DateElement = doc.Date; index.Resource.Status = CompositionStatus.Final; index.Resource.Title = "Simple Narrative Only Breast Radiology Report"; DiagnosticReport diagnosticReport = new DiagnosticReport { Id = "Report" }; BreastRadReport report = index.Report.Set(new BreastRadReport(doc, diagnosticReport)); DiagnosticReport r = report.Resource; r.Status = DiagnosticReport.DiagnosticReportStatus.Final; r.Category.Add(new CodeableConcept("http://terminology.hl7.org/CodeSystem/observation-category", "imaging")); r.Code = new CodeableConcept("http://loinc.org", "10193-1"); r.Conclusion = "Report Narrative conclusion."; report.SetConclusionCode(BiRadsAssessmentCategoriesVS.Code_Category2); } b = doc.Write(); String path = this.ExamplePath(prefix, b); b.SaveJson(path); this.SplitExampleBundle(b, prefix); } }
public void CheckGenerateReportWithMultipleSectionsAndEntries() { const string k_ExpectedOutput = @"==== Section One ==== Entry Header: Entry Body Entry Header 2: Entry Body 2 Entry Header 3: Entry Body 3 ==== Section Two ==== Entry Header 4: Entry Body 4 Entry Header 5: Entry Body 5 Entry Header 6: Entry Body 6 ==== Last 20 Events ==== "; var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); DiagnosticReport.AddSectionEntry(sectionOneHandle, "Entry Header", "Entry Body"); DiagnosticReport.AddSectionEntry(sectionOneHandle, "Entry Header 2", "Entry Body 2"); DiagnosticReport.AddSectionEntry(sectionOneHandle, "Entry Header 3", "Entry Body 3"); var sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle); DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Entry Header 4", "Entry Body 4"); DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Entry Header 5", "Entry Body 5"); DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Entry Header 6", "Entry Body 6"); var report = DiagnosticReport.GenerateReport(); Assert.AreEqual(k_ExpectedOutput, report); }
public void CheckFullReport() { const string k_ExpectedOutput = @"==== Section One ==== Section One Entry One: Simple ==== Section Two ==== Section Two Entry One: Simple Section Two Entry Two: (2) FOO=BAR BAZ=100 ==== Last 20 Events ==== Event 11: Event Body 11 Event 12: Event Body 12 Event 13: Event Body 13 Event 14: Event Body 14 Event 15: Event Body 15 Event 16: Event Body 16 Event 17: Event Body 17 Event 18: Event Body 18 Event 19: Event Body 19 Event 20: Event Body 20 Event 21: Event Body 21 Event 22: Event Body 22 Event 23: Event Body 23 Event 24: Event Body 24 Event 25: Event Body 25 Event 26: Event Body 26 Event 27: Event Body 27 Event 28: Event Body 28 Event 29: Event Body 29 Event 30: Event Body 30 "; var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); DiagnosticReport.AddSectionEntry(sectionOneHandle, "Section One Entry One", "Simple"); for (int i = 0; i <= 30; i++) { DiagnosticReport.AddEventEntry($"Event {i}", $"Event Body {i}"); } var sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle); DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Section Two Entry One", "Simple"); DiagnosticReport.AddSectionBreak(sectionTwoHandle); DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Section Two Entry Two", @"(2) FOO=BAR BAZ=100 "); var report = DiagnosticReport.GenerateReport(); Debug.Log(report); Assert.AreEqual(k_ExpectedOutput, report); }
public override DiagnosticReport CreateDiagnosticReport(DiagnosticReport report) { var persister = ApplicationServiceContext.Current.GetService <IDataPersistenceService <DiagnosticReport> >(); if (persister == null) { throw new InvalidOperationException("Cannot find appriopriate persister"); } return(persister.Insert(report, TransactionMode.Commit, AuthenticationContext.Current.Principal)); }
public void CheckSimpleReportGenerationIsCorrect() { const string k_ExpectedOutput = "==== Section One ====\n\n==== Last 20 Events ====\n"; var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); var report = DiagnosticReport.GenerateReport(); Assert.IsFalse(String.IsNullOrEmpty(report)); Assert.AreEqual(k_ExpectedOutput, report); }
public void GetDiagnosticReport() { bool b = false; DiagnosticReport report = _decoder.GetDiagnosticReport(_message); try { if (report?.SendingApplication != "cobasIT1000") { Assert.Fail(); } if (report?.PatientInternalId != "0003") { Assert.Fail(); } if (report?.FamilyName != "Fab") { Assert.Fail(); } if (report?.GivenName != "Cesc") { Assert.Fail(); } if (report?.Sex != "M") { Assert.Fail(); } if (report?.DateOfBirth.Value.ToString("yyyyMMdd") != "19890811") { Assert.Fail(); } if (report?.AnalyzerName != "ACI II UU13013667") { Assert.Fail(); } if (report?.AnalyzerDateTime.Value.ToString("yyyyMMddHHmmss") != "20130514114122") { Assert.Fail(); } if (report?.OperatorId != "ROCHE") { Assert.Fail(); } b = true; } catch (Exception ex) { Debug.WriteLine(ex.Message); } Assert.IsTrue(b); }
public void GetDiagnosticReport() { bool b = false; DiagnosticReport report = _decoder.GetDiagnosticReport(_message); try { if (report?.SendingApplication != "ICU-4 Glucose") { Assert.Fail(); } if (report?.PatientInternalId != "PT222-55-7777") { Assert.Fail(); } if (report?.FamilyName != "Patient") { Assert.Fail(); } if (report?.GivenName != "Janet") { Assert.Fail(); } if (report?.Sex != "F") { Assert.Fail(); } if (report?.DateOfBirth.Value.ToString("yyyy-MM-dd") != "1960-08-29") { Assert.Fail(); } if (report?.AnalyzerName != "ICU-4 Glucose") { Assert.Fail(); } if (report?.AnalyzerDateTime.Value.ToString("yyyy-MM-dd") != "2001-11-01") { Assert.Fail(); } if (report?.OperatorId != "OP777-88-9999") { Assert.Fail(); } b = true; } catch (Exception ex) { Debug.WriteLine(ex.Message); } Assert.IsTrue(b); }
public BoundProgram(ImmutableArray <VariableSymbol> globalVariables, FunctionSymbol?globalFunction, FunctionSymbol?mainFunction, ImmutableDictionary <FunctionSymbol, BoundBlockStatement> functions, AssemblyDefinition mainAssembly, ImmutableArray <AssemblyDefinition> referencAssemblies, ImmutableDictionary <TypeSymbol, TypeReference> resolvedTypes, DiagnosticReport diagnostics, bool isValid) : base(isValid) { GlobalVariables = globalVariables; GlobalFunction = globalFunction; MainFunction = mainFunction; Functions = functions; MainAssembly = mainAssembly; ReferencAssemblies = referencAssemblies; ResolvedTypes = resolvedTypes; Diagnostics = diagnostics; }
/// <summary> /// Display method /// </summary> /// <author>ALVES Quentin</author> /// <note>Display a diagnostic report on console</note> /// <param name="report" >Query diagnostic report to display</param> public void Display(DiagnosticReport report) { if (report != null && report.HasDiagnostics) { this.Display(this.Style.Text, $"Report emitted from {report.Emitter} :\n"); foreach (var diag in report.Diagnostics) { this.Display(diag); } } }
public void CheckGeneratedEventsAreReported() { const string k_ExpectedOutput = @"==== Last 20 Events ==== Event One: Event Body One "; DiagnosticReport.AddEventEntry("Event One", "Event Body One"); var report = DiagnosticReport.GenerateReport(); Assert.AreEqual(k_ExpectedOutput, report); }
public DiagnosticReportModel(DiagnosticReport report) { DiagnosticReportId = report.Id; CodeDisplay = report.Code.Coding.FirstOrDefault()?.Display; if (report.Effective?.TypeName == "dateTime") { var effectiveInstant = (FhirDateTime)report.Effective; EffectiveDate = effectiveInstant.ToDateTimeOffset(); } PerformerDisplay = report.Performer.Display; Status = report.Status.ToString(); }
public void SectionReportsStayInCreatedOrder() { var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); var sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle); var reportOne = DiagnosticReport.GenerateReport(); DiagnosticReport.StartReport(); sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle); sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle); var reportTwo = DiagnosticReport.GenerateReport(); Assert.AreNotEqual(reportOne, reportTwo); }
/// <summary> /// Init object. /// </summary> public override void Init(BreastRadiologyDocument doc, Base baseResource = null) { DiagnosticReport resource = (DiagnosticReport)baseResource; if (resource == null) { resource = new DiagnosticReport(); } base.Init(doc, resource); //+ Constructor this.Resource.Code = FixedValue_DiagnosticReportCode(); // DefineBase.cs:177 SetProfileUrl("http://hl7.org/fhir/us/breast-radiology/StructureDefinition/BreastRadReport"); // DefineBase.cs:238 //- Constructor }
public void ParseLargeComposite() { XmlReader xr = XmlReader.Create(new StreamReader(@"..\..\..\..\..\publish\diagnosticreport-example.xml")); ErrorList errors = new ErrorList(); DiagnosticReport rep = (DiagnosticReport)FhirParser.ParseResource(xr, errors); validateDiagReportAttributes(errors, rep); JsonTextReader jr = new JsonTextReader(new StreamReader(@"..\..\..\..\..\publish\diagnosticreport-example.json")); errors.Clear(); rep = (DiagnosticReport)FhirParser.ParseResource(jr, errors); validateDiagReportAttributes(errors, rep); }
public void When_generating_drives_report_with_flag() { var report = DiagnosticReport.Generate(DiagnosticReportType.Drives); report.ShouldNotBeNull(); report.Length.ShouldBeGreaterThan(100); report.ShouldStartWith("/\r\n|Diagnostic Report generated at:"); report.ShouldNotContain("\r\n|\r\n|System|..."); report.ShouldNotContain("\r\n|\r\n|Process|..."); report.ShouldContain("\r\n|\r\n|Drives|..."); report.ShouldNotContain("\r\n|\r\n|Assemblies|..."); report.ShouldNotContain("\r\n|\r\n|Networking|..."); report.ShouldNotContain("|\r\n|\t. Windows IP Configuration\r\n|"); report.ShouldEndWith("\\"); }
public override DiagnosticReport GetServerDiagnosticReport() { var retVal = new DiagnosticReport(); retVal.ApplicationInfo = new DiagnosticApplicationInfo(Assembly.GetEntryAssembly()); retVal.CreatedByKey = Guid.Parse(AuthenticationContext.SystemUserSid); retVal.Threads = new List <DiagnosticThreadInfo>(); try { if (Process.GetCurrentProcess()?.Threads == null) { this.m_traceSource.TraceEvent(EventLevel.Warning, "Threading information is not available for this instance"); } else { foreach (ProcessThread thd in Process.GetCurrentProcess().Threads.OfType <ProcessThread>().Where(o => o != null)) { retVal.Threads.Add(new DiagnosticThreadInfo() { Name = thd.Id.ToString(), CpuTime = thd.UserProcessorTime, WaitReason = null, State = thd.ThreadState.ToString(), TaskInfo = thd.ThreadState == ThreadState.Wait ? thd.WaitReason.ToString() : "N/A" }); } } } catch (Exception e) { this.m_traceSource.TraceEvent(EventLevel.Error, "Error gathering thread information: {0}", e); } retVal.ApplicationInfo.Assemblies = AppDomain.CurrentDomain.GetAssemblies().Select(o => new DiagnosticVersionInfo(o)).ToList(); retVal.ApplicationInfo.EnvironmentInfo = new DiagnosticEnvironmentInfo() { Is64Bit = Environment.Is64BitOperatingSystem && Environment.Is64BitProcess, OSVersion = String.Format("{0} v{1}", System.Environment.OSVersion.Platform, System.Environment.OSVersion.Version), ProcessorCount = Environment.ProcessorCount, UsedMemory = GC.GetTotalMemory(false), Version = Environment.Version.ToString(), }; retVal.ApplicationInfo.Applets = ApplicationServiceContext.Current.GetService <IAppletManagerService>().Applets.Select(o => o.Info).ToList(); retVal.ApplicationInfo.ServiceInfo = ApplicationServiceContext.Current.GetService <IServiceManager>().GetAllTypes().Where(o => o.GetInterfaces().Any(i => i.FullName == typeof(IServiceImplementation).FullName) && !o.IsGenericTypeDefinition && !o.IsAbstract && !o.IsInterface).Select(o => new DiagnosticServiceInfo(o)).ToList(); return(retVal); }
public void ValidateResourceWithIncorrectChildElement() { FhirDateTime dt = new FhirDateTime(); dt.Value = "Ewout Kramer"; Observation o = new Observation { Applies = dt }; DiagnosticReport rep = new DiagnosticReport(); rep.Contained = new List <Resource> { o }; validateErrorOrFail(rep); }
public void When_generating_full_report_with_flag() { // ReSharper disable once RedundantArgumentDefaultValue var report = DiagnosticReport.Generate(DiagnosticReportType.Full); report.ShouldNotBeNull(); report.Length.ShouldBeGreaterThan(1000); report.ShouldStartWith("/\r\n|Diagnostic Report generated at:"); report.ShouldContain("\r\n|\r\n|System|..."); report.ShouldContain("\r\n|\r\n|Process|..."); report.ShouldContain("\r\n|\r\n|Drives|..."); report.ShouldContain("\r\n|\r\n|Assemblies|..."); report.ShouldContain("\r\n|\r\n|Networking|..."); report.ShouldContain("|\r\n|\t. Windows IP Configuration\r\n|"); report.ShouldEndWith("\\"); }
private void OnDiagnosticsReported(ImpinjReader reader, DiagnosticReport report) { uint[] reportMetricsList = report.Metrics.ToArray(); // Warning!!! Accessing diagnostic codes will not be supported in future releases. if (reportMetricsList[0] == 100) // End of Cycle { Console.WriteLine("xArray=" + reader.Address + " CycleTime=" + (int)reportMetricsList[1] / 1000 + "ms"); // Store latest Cycle time if (CycleLengths.ContainsKey(reader.Address)) { CycleLengths[reader.Address] = (int)reportMetricsList[1]; } else { CycleLengths.Add(reader.Address, (int)reportMetricsList[1]); } } }
public void ValidateResourceWithIncorrectElement() { FhirDateTime dt = new FhirDateTime(); dt.Value = "Ewout Kramer"; Observation o = new Observation { Applies = dt }; DiagnosticReport rep = new DiagnosticReport(); rep.Contained = new List <Resource> { o }; var errors = dt.Validate(); Assert.IsTrue(errors.Count == 1); }