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
@ -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

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