Add importer for clinic system.
- Neu: Laborwerte, die vom Ambulanzsystem ausgegeben wurden, können jetzt auch verarbeitet werden.
This commit is contained in:
55
Tests/Importer/ClinicImporter/ClinicImporterTest.cs
Executable file
55
Tests/Importer/ClinicImporter/ClinicImporterTest.cs
Executable file
@ -0,0 +1,55 @@
|
||||
/* ClinicImporterTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using zaa = zaaReloaded2.Importer.ClinicImporter;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Tests.Importer.ClinicImporter
|
||||
{
|
||||
[TestFixture]
|
||||
class ClinicImporterTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses the demo-output.txt file that is built into the assembly.
|
||||
/// Note that this demo text contains seven time points, only six of
|
||||
/// which are distinct. Thus, the two time points with identical time
|
||||
/// stamps should be merged in the <see cref="Laboratory"/>.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ParseTimePoints()
|
||||
{
|
||||
zaa.ClinicImporter importer = TestHelpers.ClinicImporterFromResource();
|
||||
// Only 6 distinct time points (see method documentation above).
|
||||
Assert.AreEqual(5, importer.Laboratory.TimePoints.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseInvalidInput()
|
||||
{
|
||||
zaa.ClinicImporter importer = new zaa.ClinicImporter();
|
||||
importer.Import("some arbitrary text\r\nthat does not represent\r\na valid lab");
|
||||
Assert.IsFalse(importer.Success);
|
||||
importer.Import("(03.03.1930 13:30:00)\r\n\tNatrium 135 [135 - 145] mmol/l;");
|
||||
Assert.IsTrue(importer.Success);
|
||||
}
|
||||
}
|
||||
}
|
56
Tests/Importer/ClinicImporter/ClinicItemTest.cs
Executable file
56
Tests/Importer/ClinicImporter/ClinicItemTest.cs
Executable file
@ -0,0 +1,56 @@
|
||||
/* LaurisItemTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using zaaReloaded2.LabModel;
|
||||
using zaaReloaded2.Importer.ZaaImporter;
|
||||
|
||||
namespace Tests.Importer.ClinicImporter
|
||||
{
|
||||
/// <summary>
|
||||
/// The ClinicItemTest really just tests the zaaReloaded2.Importer.ZaaImporter.LaurisItem
|
||||
/// class with text formatted by the outpatient clinic system to make sure LaurisItem works
|
||||
/// with clinic-formatted lab data as well.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
class ClinicItemTest
|
||||
{
|
||||
[Test]
|
||||
[TestCase(" Natrium: 137 [135 - 145] mmol/l", "Natrium", 137, "mmol/l", 135, 145, true)]
|
||||
public void ParseClinicWithBothLimits(
|
||||
string laurisString, string name, double value,
|
||||
string unit, double lowerLimit, double upperLimit, bool isNormal)
|
||||
{
|
||||
LaurisItem i = new LaurisItem(laurisString);
|
||||
Assert.AreEqual(name, i.Name, "Name");
|
||||
Assert.AreEqual(unit, i.Unit, "Unit");
|
||||
Assert.IsFalse(i.IsExtreme, "IsExtreme");
|
||||
Assert.IsTrue(i.IsNumerical, "IsNumerical");
|
||||
Assert.AreEqual(value, i.NumericalValue, "NumericalValue");
|
||||
Assert.AreEqual(lowerLimit, i.LowerLimit, "Lower limit");
|
||||
Assert.AreEqual(upperLimit, i.UpperLimit, "Upper limit");
|
||||
Assert.AreEqual(isNormal, i.IsNormal, "IsNormal");
|
||||
Assert.IsTrue(i.HasLimits, "HasLimits");
|
||||
Assert.IsTrue(i.HasLowerLimit, "HasLowerLimit");
|
||||
Assert.IsTrue(i.HasUpperLimit, "HasUpperLimit");
|
||||
}
|
||||
}
|
||||
}
|
45
Tests/Importer/ClinicImporter/ClinicLineTest.cs
Executable file
45
Tests/Importer/ClinicImporter/ClinicLineTest.cs
Executable file
@ -0,0 +1,45 @@
|
||||
/* ClinicLineTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using NUnit.Framework;
|
||||
using zaaReloaded2.LabModel;
|
||||
using zaaReloaded2.Importer.ClinicImporter;
|
||||
|
||||
namespace Tests.Importer.ClinicImporter
|
||||
{
|
||||
[TestFixture]
|
||||
class ClinicLineTest
|
||||
{
|
||||
[Test]
|
||||
public void ParseLine()
|
||||
{
|
||||
string demo = "\tNatrium:\t137\t[135 - 145]\tmmol/l";
|
||||
ClinicLine line = new ClinicLine(demo);
|
||||
Assert.IsTrue(line.IsClinicLine);
|
||||
Assert.AreEqual(137, line.Item.NumericalValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseInvalidLine()
|
||||
{
|
||||
// Missing leading tab
|
||||
string demo = "Natrium:\t137\t[135 - 145]\tmmol/l";
|
||||
ClinicLine line = new ClinicLine(demo);
|
||||
Assert.IsFalse(line.IsClinicLine);
|
||||
}
|
||||
}
|
||||
}
|
67
Tests/Importer/ClinicImporter/TimePointTest.cs
Executable file
67
Tests/Importer/ClinicImporter/TimePointTest.cs
Executable file
@ -0,0 +1,67 @@
|
||||
/* TimePointTest.cs
|
||||
* part of zaaReloaded2
|
||||
*
|
||||
* Copyright 2017 Daniel Kraus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using zaaReloaded2.LabModel;
|
||||
using zaaReloaded2.Importer.ClinicImporter;
|
||||
|
||||
namespace Tests.Importer.ClinicImporter
|
||||
{
|
||||
[TestFixture]
|
||||
class ClinicTimePointTest
|
||||
{
|
||||
[Test]
|
||||
public void ParseValidClinicTimePoint()
|
||||
{
|
||||
ClinicTimePoint tp = new ClinicTimePoint(
|
||||
"(06.09.2017 09:45:00)" + Environment.NewLine +
|
||||
"\tKalium:\t4.6\t[3.5 - 5]\tmmol/l");
|
||||
Assert.IsTrue(tp.IsValidTimePoint);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseInvalidClinicTimePoints()
|
||||
{
|
||||
ClinicTimePoint tp = new ClinicTimePoint("Mit freundlichen Grüßen");
|
||||
Assert.IsFalse(tp.IsValidTimePoint,
|
||||
"Bogus paragraph should be invalid LaurisTimePoint");
|
||||
|
||||
tp.ClinicText = "(22.10.2013 12:30:00)";
|
||||
Assert.IsFalse(tp.IsValidTimePoint,
|
||||
"LaurisTimePoint should be invalid if it consists of time stamp only.");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParseClinicTimePointWithDuplicateItems()
|
||||
{
|
||||
ClinicTimePoint tp = new ClinicTimePoint(
|
||||
"(22.10.2013 12:30:00)" + Environment.NewLine +
|
||||
"\tNatrium:\t137\t[135 - 145]\tmmol/l" + Environment.NewLine +
|
||||
"\tNatrium:\t140\t[135 - 145]\tmmol/l"
|
||||
);
|
||||
Assert.IsTrue(tp.Items.ContainsKey("Natrium"),
|
||||
"LaurisTimePoint should contain 'Natrium' item.");
|
||||
Assert.AreEqual(140, tp.Items["Natrium"].NumericalValue,
|
||||
"LaurisTimePoint does not use last occurrence of 'Natrium'.");
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using zaaReloaded2.Importer.ZaaImporter;
|
||||
using zaaReloaded2.Importer.ClinicImporter;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
@ -38,5 +39,18 @@ namespace Tests
|
||||
importer.Import(r.ReadToEnd());
|
||||
return importer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ClinicImporter object and imports demo-output-clinic.txt.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ClinicImporter ClinicImporterFromResource()
|
||||
{
|
||||
Stream s = typeof(TestHelpers).Assembly.GetManifestResourceStream("Tests.demo-output-clinic.txt");
|
||||
StreamReader r = new StreamReader(s);
|
||||
ClinicImporter importer = new ClinicImporter();
|
||||
importer.Import(r.ReadToEnd());
|
||||
return importer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,10 @@
|
||||
<Compile Include="Controller\Comments\CommentPoolTest.cs" />
|
||||
<Compile Include="Controller\Comments\ItemCommentTest.cs" />
|
||||
<Compile Include="Controller\Elements\CloneTest.cs" />
|
||||
<Compile Include="Importer\ClinicImporter\ClinicItemTest.cs" />
|
||||
<Compile Include="Importer\ClinicImporter\ClinicLineTest.cs" />
|
||||
<Compile Include="Importer\ClinicImporter\TimePointTest.cs" />
|
||||
<Compile Include="Importer\ClinicImporter\ClinicImporterTest.cs" />
|
||||
<Compile Include="Medication\ImporterTest.cs" />
|
||||
<Compile Include="Medication\PrescriptionTest.cs" />
|
||||
<Compile Include="SerializationTest.cs" />
|
||||
@ -144,6 +148,10 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Formatter\FormatterTest-all.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="demo-output-clinic.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
|
90
Tests/demo-output-clinic.txt
Executable file
90
Tests/demo-output-clinic.txt
Executable file
@ -0,0 +1,90 @@
|
||||
# This file contains 5 distinct time points.
|
||||
# This leading text should be ignored.
|
||||
# DO NOT CHANGE THE FOLLOWING TEXT, LEST THE TESTS WILL FAIL!
|
||||
(06.09.2017 09:54:00)
|
||||
Gesamt-Eiweiss (PU): 54 [<= 120] mg/l
|
||||
Gesamt-Eiweiss/Creatinin (PU): 59 [<= 70] mg/g Crea
|
||||
Albumin (PU): 4 [<= 30] mg/l
|
||||
Albumin/Creatinin (PU): 4.4 [<= 30] mg/g Crea
|
||||
Creatinin (PU): 91.1 [29 - 226] mg/dl
|
||||
|
||||
(06.09.2017 09:54:00)
|
||||
Erythrozyten (U): negativ [negativ]
|
||||
Leukozyten (U): + [negativ]
|
||||
Nitrit (U): negativ [negativ]
|
||||
Protein (U): negativ [negativ]
|
||||
Glucose (U): negativ [negativ]
|
||||
Ketonkörper (U): + [negativ]
|
||||
Bilirubin (U): negativ [negativ]
|
||||
Urobilinogen (U): negativ [negativ]
|
||||
pH (U): 6.500 [4.8 - 7.4]
|
||||
spezifisches Gewicht (U): 1.015 [1.00 - 1.04] g/ml
|
||||
Erythrozyten (U): 3 [<= 25] Ery/µl
|
||||
Leukozyten (U): 4 [<= 20] Leu/µl
|
||||
Bakterien (U): 193 Bak/µl
|
||||
Plattenepithelien (U): 25 Epi/µl
|
||||
Übergangsepithelien (U): 0 Uge/µl
|
||||
hyaline Zylinder (U): 0 Zyh/µl
|
||||
|
||||
(06.09.2017 09:52:00)
|
||||
Gesamt-Eiweiss (SU): < 40 [<= 120] mg/l
|
||||
Albumin (SU): < 3 mg/l
|
||||
a1-Microglobulin (SU): < 5 mg/l
|
||||
Immunglobulin G (SU): < 4 mg/l
|
||||
Sammelzeit (U): 24 h
|
||||
Sammelmenge (U): 3200 ml
|
||||
Calcium (SU): 0.26 mmol/l
|
||||
Calcium (SU)/die: 0.83 [2.5 - 8] mmol/d
|
||||
Creatinin (SU): 30.2 mg/dl
|
||||
Harnstoff (SU): 674 [900 - 3000] mg/dl
|
||||
Harnstoff (SU)/die: 21.6 [<= 35] g/d
|
||||
Kalium (SU): 45.4 [20 - 80] mmol/l
|
||||
Kalium (SU)/die: 145.28 [25 - 125] mmol/d
|
||||
Natrium (SU): 28.9 [54 - 150] mmol/l
|
||||
Natrium (SU)/die: 92.5 [40 - 220] mmol/d
|
||||
|
||||
(06.09.2017 09:50:00)
|
||||
Cystatin C (Latex Gen. 2): 1.04 [0.61 - 0.95] mg/l
|
||||
|
||||
(06.09.2017 09:45:00)
|
||||
Natrium: 137 [135 - 145] mmol/l
|
||||
Kalium: 4.6 [3.5 - 5] mmol/l
|
||||
Calcium: 2.4 [2.0 - 2.7] mmol/l
|
||||
anorg. Phosphat: 1.29 [0.87 - 1.45] mmol/l
|
||||
Calcium-Phosphat-Produkt: 3.10 [<= 4.4] mmol²/l²
|
||||
glomerul. Filtrationsr. CKD-EP: 62 ml/min /1,73qm
|
||||
glomerul. Filtrationsr. (MDRD): 59 ml/min /1,73qm
|
||||
Creatinin: 1.06 [0 - 0.95] mg/dl
|
||||
Harnstoff: 52.1 [10 - 50] mg/dl
|
||||
Lactat Dehydrogenase: 175 [<= 250] U/l
|
||||
Cholesterin: 180 [130 - 220] mg/dl
|
||||
Triglyceride: 51 [74 - 172] mg/dl
|
||||
LDL - Cholesterin: 91 [0 - 150] mg/dl
|
||||
HDL - Cholesterin: 79 [>= 35] mg/dl
|
||||
Albumin: 4.5 [3.5 - 5.5] g/dl
|
||||
Leukozyten: 4.7 [5 - 10] n*1000/µl
|
||||
Erythrozyten: 4.09 [4 - 5] n*10E6/µl
|
||||
Hämoglobin: 11.9 [12 - 16] g/dl
|
||||
Hämatokrit: 36.6 [35 - 47] %
|
||||
MCV: 89.5 [82 - 96] fl
|
||||
MCH (HbE): 29.1 [27 - 33] pg
|
||||
MCHC: 32.5 [32 - 36] g/dl
|
||||
Thrombozyten: 302 [150 - 450] n*1000/µl
|
||||
Mittleres Plättchenvolumen: 11.3 [9.6 - 12.0] fl
|
||||
Neutrophile: 2.60 [1.8 - 7.2] n*1000/µl
|
||||
Lymphozyten: 1.35 [1 - 4.05] n*1000/µl
|
||||
Monozyten: 0.47 [0.08 - 0.8] n*1000/µl
|
||||
Eosinophile: 0.2 [0.04 - 0.36] n*1000/µl
|
||||
Basophile: 0.1 [0 - 0.08] n*1000/µl
|
||||
% Neutrophile: 55.1 [41 - 70] %
|
||||
% Lymphozyten: 28.7 [25 - 40] %
|
||||
% Monozyten: 10.0 [2 - 8] %
|
||||
% Eosinophile: 4.7 [0.8 - 6.2] %
|
||||
% Basophile: 1.3 [0 - 1] %
|
||||
Unreife Granulozyten: 0.01 n*1000/µl
|
||||
% Unreife Granulozyten: 0.2 %
|
||||
C-reaktives Protein: 0.02 [0 - 0.5] mg/dl
|
||||
|
||||
(06.09.2017 09:15:00)
|
||||
TSH: 1.30 [0.3 - 4.0] mIU/l
|
||||
PTH intakt: 106.0 [12 - 65] ng/l
|
Reference in New Issue
Block a user