Add Lauris paragraph parser.

This commit is contained in:
Daniel Kraus
2015-06-29 21:50:27 +02:00
parent 39f63835be
commit 443f3ac4e1
11 changed files with 404 additions and 159 deletions

View File

@ -126,5 +126,14 @@ namespace Tests
Assert.IsFalse(i.HasUpperLimit, "HasUpperLimit");
// TODO: Define the behavior of LabItem.IsNormal if no normal value known
}
[TestCase("Albumin (SU)/die: 149.9 [<= 30] mg/d; ", Material.SU)]
[TestCase("Gesamt-Eiweiss/Creatinin (PU): 281 [<= 70] mg/g Crea;", Material.U)]
[TestCase("Cystatin C (N Latex): 2.37 [0.57 - 0.96] mg/l; ", Material.B)]
public void ParseLaurisMaterial(string laurisString, Material expectedMaterial)
{
LabItem i = new LabItem(laurisString);
Assert.AreEqual(expectedMaterial, i.Material);
}
}
}

36
Tests/LaurisParagraphTest.cs Executable file
View File

@ -0,0 +1,36 @@
/* LaurisParagraphTest.cs
* part of zaaReloaded2
*
* Copyright 2015 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.Models;
namespace Tests
{
[TestFixture]
class LaurisParagraphTest
{
[Test]
public void ParseParagraph()
{
string demo = "Klinische Chemie: Natrium: 139 [135 - 145] mmol/l;  " +
"Kalium: 5.2 [3.5 - 5] mmol/l;  Calcium: 2.4 [2.0 - 2.7] mmol/l;";
LaurisParagraph lp = new LaurisParagraph(demo);
Assert.AreEqual(139, lp.Items["Natrium"].NumericalValue);
Assert.AreEqual(2.4, lp.Items["Calcium"].NumericalValue);
}
}
}

View File

@ -59,6 +59,7 @@
<ItemGroup>
<Compile Include="Dictionaries\DictionaryTest.cs" />
<Compile Include="LabItemTest.cs" />
<Compile Include="LaurisParagraphTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="LineParserTest.cs" />
<Compile Include="Dictionaries\TestDictionary.cs" />
@ -76,6 +77,9 @@
<ItemGroup>
<EmbeddedResource Include="Dictionaries\test_dictionary.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="demo-output.txt" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>

17
Tests/demo-output.txt Executable file
View File

@ -0,0 +1,17 @@
[22.10.2013 12:30:00]
Aerobe Kultur: Enterokokken ;  Wachstum: 10 ;
Auftragskommentare: Untersuchungsmaterial:: Mittelstrahlurin (nativ) ;  Befundstatus Auftrag: Endbefund ;
Urinproteine quantitativ: Gesamt-Eiweiss (PU): 135 [<= 120] mg/l;  Gesamt-Eiweiss/Creatinin (PU): 281 [<= 70] mg/g Crea;  Albumin (PU): 57 [<= 30] mg/l;  Albumin/Creatinin (PU): 118.8 [<= 30] mg/g Crea;
Urin - Klin. Chemie: Creatinin (PU): 48.0 [40 - 278] mg/dl;
Urinproteine quantitativ: Gesamt-Eiweiss (SU): 184 [<= 120] mg/l;  Gesamt-Eiweiss (SU)/die: 340 [<= 150] mg/d;  Albumin (SU): 81 mg/l;  Albumin (SU)/die: 149.9 [<= 30] mg/d;  a1-Microglobulin (SU): 35.3 mg/l;  a1-Microglobulin (SU)/die: 65.3 [<= 20] mg/d;  Immunglobulin G (SU): 8 mg/l;  Immunglobulin G (SU)/die: 14.8 [<= 15] mg/d;
Urin - Klin. Chemie: Sammelzeit (U): 24 h;  Sammelmenge (U): 1850 ml;
Klinische Chemie: Natrium: 139 [135 - 145] mmol/l;  Kalium: 5.2 [3.5 - 5] mmol/l;  Calcium: 2.4 [2.0 - 2.7] mmol/l;  anorg. Phosphat: 0.58 [0.87 - 1.45] mmol/l;  Calcium-Phosphat-Produkt: 1.39 [<= 4.4] mmol²/l²;  Glucose: 112 [74 - 106] mg/dl;  glomerul. Filtrationsr. CKD-EP: 42 ml/min /1,73qm;  glomerul. Filtrationsr. (MDRD): 42 ml/min /1,73qm;  Creatinin: 1.84 [0 - 1.17] mg/dl;  Harnstoff: 54.3 [10 - 50] mg/dl;  Harnsäure: 4.6 [3.4 - 7] mg/dl;  Gesamt-Bilirubin: 0.7 [0.1 - 1.2] mg/dl;  GOT (ASAT): 303.0 [<= 50] U/l;  GPT (ALAT): 508.0 [<= 50] U/l;  GGT: 489.0 [<= 60] U/l;  Alk. Phosphatase: 56 [40 - 130] U/l;  Lactat Dehydrogenase: 320 [<= 250] U/l;  CK gesamt: 52 [<= 190] U/l;  Amylase: 62 [<= 110] U/l;  Cholesterin: 120 [130 - 220] mg/dl;  Triglyceride: 94 [74 - 172] mg/dl;  LDL - Cholesterin: 56 [0 - 150] mg/dl;  HDL - Cholesterin: 45 [>= 35] mg/dl;  Eisen: 215 [59 - 158] µg/dl;  Gesamt-Eiweiss: 5.7 [6.6 - 8.7] g/dl;  Albumin: 4.0 [3.5 - 5.5] g/dl;
Gerinnung: Niedermol. Heparin (Anti-Xa): 0.99 U/ml;
Hämatologie: Leukozyten: 2.9 [5 - 10] n*1000/µl;  Erythrozyten: 3.23 [4 - 6] n*10E6/µl;  Hämoglobin: 10.1 [14 - 18] g/dl;  Hämatokrit: 30.8 [42 - 50] %;  MCV: 95.4 [82 - 94] fl;  MCH (HbE): 31.3 [27 - 33] pg;  MCHC: 32.8 [32 - 36] g/dl;  Thrombozyten: 112 [150 - 450] n*1000/µl;  Mittleres Plättchenvolumen: 11.1 [9.7 - 11.9] fl;  Neutrophile: 74.4 [41 - 70] %;  Lymphozyten: 13.0 [25 - 40] %;  Monozyten: 11.3 [2 - 8] %;  Eosinophile: 1.0 [0.8 - 6.2] %;  Basophile: 0.3 [0 - 1] %;  Neutrophile: 2.18 [1.8 - 7.2] n*1000/µl;  Lymphozyten: 0.38 [1 - 4.05] n*1000/µl;  Monozyten: 0.33 [0.08 - 0.8] n*1000/µl;  Eosinophile: 0.0 [0.04 - 0.36] n*1000/µl;  Basophile: 0.0 [0 - 0.08] n*1000/µl;  Unreife Granulozyten: 0.3 %;
Urinproteine quantitativ: Gesamt-Eiweiss (SU): 186 [<= 120] mg/l;  Gesamt-Eiweiss (SU)/die: 344 [<= 150] mg/d;  Albumin (SU): 79 mg/l;  Albumin (SU)/die: 146.2 [<= 30] mg/d;
Urin - Klin. Chemie: Sammelzeit (U): 24 h;  Sammelmenge (U): 1850 ml;  Creatinin-Clearance (SU)/min: 46 [98 - 156] ml/min;  Harnstoff-Clearance (SU)/min: 21 [60 - 80] ml/min;  glomeruläre Filtrationsrate: 34 ml/min;  Calcium (SU): 0.79 mmol/l;  Calcium (SU)/die: 1.46 [2.5 - 8] mmol/d;  Creatinin (SU): 65.5 mg/dl;  Harnstoff (SU): 904 [900 - 3000] mg/dl;  Harnstoff (SU)/die: 16.7 [<= 35] g/d;  Kalium (SU): 24.4 [20 - 80] mmol/l;  Kalium (SU)/die: 45.14 [25 - 125] mmol/d;  Natrium (SU): 133.2 [54 - 150] mmol/l;  Natrium (SU)/die: 246.4 [40 - 220] mmol/d;
Serumproteine und Tumormarker: Ferritin: 3754 [30 - 400] µg/l;  Transferrin: 217 [200 - 380] mg/dl;  Transferrinsättigung: 70.2 [16 - 45] %;  Haptoglobin: < 10 [34 - 200] mg/dl;  C-reaktives Protein: < 0.01 [0 - 0.5] mg/dl;  Cystatin C (N Latex): 2.37 [0.57 - 0.96] mg/l;
Akutbestimmungen / TDM / Drogen: Tacrolimus (FK506): 10.7 µg/l;
Klinische Chemie: Natrium: 140 [135 - 145] mmol/l;  Kalium: 5.2 [3.5 - 5] mmol/l;  Calcium: 2.3 [2.0 - 2.7] mmol/l;  anorg. Phosphat: 0.59 [0.87 - 1.45] mmol/l;  Chlorid: 109 [94 - 110] mmol/l;  Glucose: 114 [74 - 106] mg/dl;  glomerul. Filtrationsr. CKD-EP: 42 ml/min /1,73qm;  glomerul. Filtrationsr. (MDRD): 42 ml/min /1,73qm;  Creatinin: 1.85 [0 - 1.17] mg/dl;  Harnstoff: 56.1 [10 - 50] mg/dl;  Cholinesterase: 3387 [5320 - 12920] U/l;  Lactat Dehydrogenase: 318 [<= 250] U/l;  Gesamt-Eiweiss: 5.7 [6.6 - 8.7] g/dl;  Albumin: 3.9 [3.5 - 5.5] g/dl;
Serumproteine und Tumormarker: C-reaktives Protein: < 0.01 [0 - 0.5] mg/dl;
Akutbestimmungen / TDM / Drogen: PO2 (art.): 64.0 [70 - 100] mmHg;  PCO2 (art.): 36.3 [36 - 44] mmHg;  pH: 7.393 [7.36 - 7.44] ;  Basenabweichung: -2.4 [-2 - 2] mmol/l;  aktuelles Bicarbonat: 21.6 [22 - 26] mmol/l;  Standard Bicarbonat: 22.4 [22 - 26] mmol/l;  Sauerstoffsättigung (art.): 95.8 [95 - 99] %;