Fix parsing joint lines with time point and lab items.
- VERBESSERT: Unkonventionell ausgegebene Laborwerte (v.a. Cyclosporin-A vor Gabe) wurden nicht richtig erkannt.
This commit is contained in:
parent
c83b8726cc
commit
a29ee55003
@ -118,6 +118,23 @@ namespace Tests.Formatter
|
||||
document.Range().Text);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FormatCyclosporine()
|
||||
{
|
||||
ZaaImporter importer = new ZaaImporter();
|
||||
importer.Import(
|
||||
"(17.09.2015 10:44:00) Cyclosporin-A vor Gabe: 130 µg/l; CK gesamt: 123 [<= 170] U/l; Cholesterin: 211");
|
||||
Document document = new Document();
|
||||
f.Formatter formatter = new f.Formatter(document);
|
||||
formatter.Laboratory = importer.Laboratory;
|
||||
formatter.Settings = new zaaReloaded2.Controller.Settings(
|
||||
new List<ElementBase>() { new Items("CsA (C0) \"(Ziel-Talspiegel: <> µg/l)\"") });
|
||||
formatter.Run();
|
||||
Assert.AreEqual(
|
||||
"Laborwerte vom 17.09.2015 10:44:00:\rCsA (C0) 130 µg/l\r\r",
|
||||
document.Range().Text);
|
||||
}
|
||||
|
||||
string GetResourceText(string resource)
|
||||
{
|
||||
try
|
||||
|
@ -196,11 +196,12 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
|
||||
void ParseParagraph(string paragraph)
|
||||
{
|
||||
if (_timeStampRegex.IsMatch(paragraph))
|
||||
Match m = _timeStampRegex.Match(paragraph);
|
||||
if (m.Success)
|
||||
{
|
||||
DateTime dt;
|
||||
if (DateTime.TryParseExact(
|
||||
_timeStampRegex.Match(paragraph).Groups["datetime"].Value,
|
||||
m.Groups["datetime"].Value,
|
||||
"dd.MM.yyyy HH:mm",
|
||||
CultureInfo.InvariantCulture,
|
||||
DateTimeStyles.AllowWhiteSpaces,
|
||||
@ -208,8 +209,24 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
{
|
||||
TimeStamp = dt;
|
||||
}
|
||||
|
||||
// Put the remainder of the line back to the
|
||||
// 'paragraph' parameter to deal with exceptional
|
||||
// lines such as
|
||||
// "(17.09.2015 10:44:00) Cyclosporin-A vor Gabe: 130 µg/l;"
|
||||
// We need to add a dummy caption because this is
|
||||
// the normal format of a paragraph generated from Lauris.
|
||||
if (m.Groups["tail"].Success)
|
||||
{
|
||||
paragraph = "DUMMY CAPTION: " + m.Groups["tail"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
paragraph = String.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!String.IsNullOrEmpty(paragraph))
|
||||
{
|
||||
LaurisParagraph lp = new LaurisParagraph(
|
||||
paragraph,
|
||||
@ -236,7 +253,7 @@ namespace zaaReloaded2.Importer.ZaaImporter
|
||||
/// paragraph of a LaurisText.
|
||||
/// </summary>
|
||||
static readonly Regex _timeStampRegex = new Regex(
|
||||
@"^(Labor:?)?\s*\(?\s*(?<datetime>\d\d\.\d\d\.\d\d\d\d\s+\d\d:\d\d)");
|
||||
@"^(Labor:?)?\s*\(?\s*(?<datetime>\d\d\.\d\d\.\d\d\d\d\s+\d\d:\d\d)(:00\)\s*(?<tail>.+)?)?$");
|
||||
IList<String> _paragraphs;
|
||||
Parameters _parameterDictionary;
|
||||
Units _unitDictionary;
|
||||
|
Loading…
Reference in New Issue
Block a user