Implement blacklisting feature.

- NEU: Parameter können im Thesaurus als "blacklisted" markiert werden und werden dann bei Verwendung einer Wildcard ("*") nicht berücksichtigt.
This commit is contained in:
Daniel Kraus 2015-08-06 07:47:44 +02:00
parent b6c33971bd
commit edaf88c4cd
6 changed files with 50 additions and 11 deletions

View File

@ -148,7 +148,7 @@ namespace zaaReloaded2.Controller.Elements
foreach (TimePointFormatter tpf in formatter.WorkingTimePoints.Values) foreach (TimePointFormatter tpf in formatter.WorkingTimePoints.Values)
{ {
List<ItemFormatter> newItems = tpf.ItemFormatters.Values List<ItemFormatter> newItems = tpf.ItemFormatters.Values
.Where(i => !i.HasBeenUsed && i.LabItem.QualifiedName.StartsWith(material)) .Where(i => !i.HasBeenUsed && !i.IsBlacklisted && i.LabItem.QualifiedName.StartsWith(material))
.ToList(); .ToList();
newItems.ForEach(i => i.HasBeenUsed = true); newItems.ForEach(i => i.HasBeenUsed = true);
items.AddRange(newItems); items.AddRange(newItems);

View File

@ -48,6 +48,23 @@ namespace zaaReloaded2.Formatter
/// </summary> /// </summary>
public bool HasBeenUsed { get; set; } public bool HasBeenUsed { get; set; }
/// <summary>
/// Gets or sets a flag that tells the formatter to include or
/// not include the material indicator in the formatted output.
/// Default is true.
/// </summary>
/// <remarks>
/// For example, items that are selected with a wildcard may
/// contain the material info, while expressly chosen items
/// may not.
/// </remarks>
public bool IncludeMaterial { get; set; }
/// <summary>
/// Gets whether the Item is marked as blacklisted in the thesaurus.
/// </summary>
public bool IsBlacklisted { get { return LabItem.IsBlacklisted; } }
#endregion #endregion
#region Constructor #region Constructor
@ -58,6 +75,7 @@ namespace zaaReloaded2.Formatter
/// <param name="labItem">LabItem to wrap in this ItemFormatter.</param> /// <param name="labItem">LabItem to wrap in this ItemFormatter.</param>
public ItemFormatter(LabItem labItem, ReferenceStyle referenceStyle) public ItemFormatter(LabItem labItem, ReferenceStyle referenceStyle)
{ {
IncludeMaterial = true;
LabItem = labItem; LabItem = labItem;
ReferenceStyle = referenceStyle; ReferenceStyle = referenceStyle;
} }
@ -133,11 +151,13 @@ namespace zaaReloaded2.Formatter
value = LabItem.Value; value = LabItem.Value;
} }
string name = IncludeMaterial ? LabItem.QualifiedName : LabItem.Name;
// Insert the formatted text into the document. // Insert the formatted text into the document.
formatter.Write( formatter.Write(
String.Format( String.Format(
"{0} {1}{2}{3}", "{0} {1}{2}{3}",
LabItem.QualifiedName, name,
value, value,
unit, unit,
reference reference

View File

@ -74,7 +74,8 @@ namespace zaaReloaded2.Importer.ZaaImporter
if (parameterDictionary != null) if (parameterDictionary != null)
{ {
Name = parameterDictionary.GetCanonicalName(OriginalName); Name = parameterDictionary.GetCanonicalName(OriginalName);
AlwaysPrintLimits = parameterDictionary.GetForceReferenceDisplay(Name); AlwaysPrintLimits = parameterDictionary.GetForceReferenceDisplay(OriginalName);
IsBlacklisted = parameterDictionary.GetIsBlacklisted(OriginalName);
} }
if (unitDictionary != null) if (unitDictionary != null)
{ {

View File

@ -205,6 +205,12 @@ namespace zaaReloaded2.LabModel
public Material Material { get; protected set; } public Material Material { get; protected set; }
/// <summary>
/// Gets whether the LabItem is marked as blacklisted
/// in the thesaurus.
/// </summary>
public bool IsBlacklisted { get; protected set; }
#endregion #endregion
#region Constructors #region Constructors

View File

@ -1,5 +1,5 @@
# LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH" # LAURIS-NAME "KANONISCHER NAME" MATERIAL "IMMER REFERENZBEREICH" "BLACKLIST"
# =========== ================== ======== ======================= # =========== ================== ======== ======================= ===========
"Übergangsepithelien (U)" Übergangsep. U "Übergangsepithelien (U)" Übergangsep. U
"a1-Microglobulin (SU)" a1-Microglobulin SU "a1-Microglobulin (SU)" a1-Microglobulin SU
"a1-Microglobulin (SU)/die" a1-Microglobulin SU "a1-Microglobulin (SU)/die" a1-Microglobulin SU
@ -28,8 +28,8 @@ CK gesamt" CK S
"Creatinin (SU)" Krea SU "Creatinin (SU)" Krea SU
Creatinin Krea S Creatinin Krea S
"Creatinin-Clearance (SU)/min" CrCl SU "Creatinin-Clearance (SU)/min" CrCl SU
"Cyclosporin-A vor Gabe" "CsA (C0)" S X "Cyclosporin-A vor Gabe" "CsA (C0)" S X
"Cystatin C (N Latex)" "Cystatin C" S X "Cystatin C (N Latex)" "Cystatin C" S X
Eisen Fe S Eisen Fe S
Eosinophile Eos E Eosinophile Eos E
"Erythrozyten (U)" Ery U "Erythrozyten (U)" Ery U
@ -43,7 +43,7 @@ Gesamt-Eiweiss Protein S
"Gesamt-Eiweiss/Creatinin (PU)" TPCR U "Gesamt-Eiweiss/Creatinin (PU)" TPCR U
GGT GGT S GGT GGT S
"glomeruläre Filtrationsrate" GFR SU "glomeruläre Filtrationsrate" GFR SU
"glomerul. Filtrationsr. (MDRD)" "eGFR (MDRD)" S "glomerul. Filtrationsr. (MDRD)" "eGFR (MDRD)" S --- X
"glomerul. Filtrationsr. CKD-EP" "eGFR (CKD-EPI)" S "glomerul. Filtrationsr. CKD-EP" "eGFR (CKD-EPI)" S
"Glucose (U)" Glukose U "Glucose (U)" Glukose U
Glucose Glukose S Glucose Glukose S
@ -51,7 +51,7 @@ Glucose Glukose S
"GPT (ALAT)" GPT S "GPT (ALAT)" GPT S
Hämatokrit Hkt E Hämatokrit Hkt E
Hämoglobin Hb E Hämoglobin Hb E
Haptoglobin Haptoglobin S X Haptoglobin Haptoglobin S X
Harnsäure Harnsäure S Harnsäure Harnsäure S
"Harnstoff (SU)" Hst SU "Harnstoff (SU)" Hst SU
"Harnstoff (SU)/die" Hst/Tag SU "Harnstoff (SU)/die" Hst/Tag SU
@ -104,8 +104,8 @@ Unreife Granulozyten" Gran E
"Thromboplastinzeit n. Quick" Quick Z "Thromboplastinzeit n. Quick" Quick Z
PTT aPTT Z PTT aPTT Z
"Ratio int. norm." INR Z "Ratio int. norm." INR Z
"Komplementfaktor C3c" C3c S X "Komplementfaktor C3c" C3c S X
"Komplementfaktor C4" C4 S X "Komplementfaktor C4" C4 S X
"Anti-DNAse B" "Anti-DNAse B" S "Anti-DNAse B" "Anti-DNAse B" S
Anti-Streptolysin ASL S Anti-Streptolysin ASL S
"PTH intakt" iPTH S "PTH intakt" iPTH S

View File

@ -95,6 +95,18 @@ namespace zaaReloaded2.Thesaurus
return LookUpValue(laurisName, 3, false); return LookUpValue(laurisName, 3, false);
} }
/// <summary>
/// Checks whether an item is marked as blacklisted in the
/// thesaurus.
/// </summary>
/// <param name="laurisName">Laboratory item to lok up;
/// this must be an original Lauris string.</param>
/// <returns>True if the item is marked as blacklisted,
/// false if not. Default is false.</returns>
public bool GetIsBlacklisted(string laurisName)
{
return LookUpValue(laurisName, 4, false);
}
#endregion #endregion
#region Overrides #region Overrides