public ProcessResult Process(ElementNode node, ProcessContext context = null, Dictionary <string, object> settings = null) { if (string.IsNullOrEmpty(node?.Value?.ToString())) { return(new ProcessResult()); } if (node.IsDateNode()) { return(DateTimeUtility.RedactDateNode(node, EnablePartialDatesForRedact)); } if (node.IsDateTimeNode() || node.IsInstantNode()) { return(DateTimeUtility.RedactDateTimeAndInstantNode(node, EnablePartialDatesForRedact)); } if (node.IsAgeDecimalNode()) { return(DateTimeUtility.RedactAgeDecimalNode(node, EnablePartialAgesForRedact)); } if (node.IsPostalCodeNode()) { return(PostalCodeUtility.RedactPostalCode(node, EnablePartialZipCodesForRedact, RestrictedZipCodeTabulationAreas)); } node.Value = null; var result = new ProcessResult(); result.AddProcessRecord(AnonymizationOperations.Redact, node); return(result); }
public static ProcessResult RedactAgeDecimalNode(ElementNode node, bool enablePartialAgesForRedact = false) { var processResult = new ProcessResult(); if (!node.IsAgeDecimalNode() || string.IsNullOrEmpty(node?.Value?.ToString())) { return(processResult); } if (enablePartialAgesForRedact) { if (int.Parse(node.Value.ToString()) > s_ageThreshold) { node.Value = null; } } else { node.Value = null; } processResult.AddProcessRecord(AnonymizationOperations.Redact, node); return(processResult); }
public static void RedactAgeDecimalNode(ElementNode node, bool enablePartialAgesForRedact = false) { if (!node.IsAgeDecimalNode()) { return; } if (enablePartialAgesForRedact) { if (int.Parse(node.Value.ToString()) > s_ageThreshold) { node.Value = null; } } else { node.Value = null; } }
public void Process(ElementNode node) { if (node.IsDateNode()) { DateTimeUtility.RedactDateNode(node, EnablePartialDatesForRedact); } else if (node.IsDateTimeNode() || node.IsInstantNode()) { DateTimeUtility.RedactDateTimeAndInstantNode(node, EnablePartialDatesForRedact); } else if (node.IsAgeDecimalNode()) { DateTimeUtility.RedactAgeDecimalNode(node, EnablePartialAgesForRedact); } else if (node.IsPostalCodeNode()) { PostalCodeUtility.RedactPostalCode(node, EnablePartialZipCodesForRedact, RestrictedZipCodeTabulationAreas); } else { node.Value = null; } }