public static InsuranceInfo AddInsurance(Patient pat, string carrierName, string planType = "", long feeSchedNum = 0, int ordinal = 1, bool isMedical = false, EnumCobRule cobRule = EnumCobRule.Basic, long copayFeeSchedNum = 0, int monthRenew = 0, string subscriberID = "1234", ExclusionRule exclusionRule = ExclusionRule.PracticeDefault) { InsuranceInfo ins = new InsuranceInfo(); ins.AddInsurance(pat, carrierName, planType, feeSchedNum, ordinal, isMedical, cobRule, copayFeeSchedNum, monthRenew, subscriberID, exclusionRule); return(ins); }
private static int RemoveItemsUsignIsUnique(ExclusionRule rule, List <LeadGeneration> leadGenerations) { int removeCount = 0; var leadsDistinct = leadGenerations.GroupBy(i => new { i.Source, i.PeopleSoftID, i.CustomerName, i.ContactID, i.ContactFlag, i.Salutation, i.ContactName, i.ContactEmail }) .Select(g => g.First()) .ToList(); removeCount = leadGenerations.RemoveAll(i => !leadsDistinct.Contains(i)); return(removeCount); }
public void AddInsurance(Patient pat, string carrierName, string planType = "", long feeSchedNum = 0, int ordinal = 1, bool isMedical = false, EnumCobRule cobRule = EnumCobRule.Basic, long copayFeeSchedNum = 0, int monthRenew = 0, string subscriberID = "1234", ExclusionRule exclusionRule = ExclusionRule.PracticeDefault) { Carrier carrier = CarrierT.CreateCarrier(carrierName); InsPlan plan = InsPlanT.CreateInsPlan(carrier.CarrierNum, cobRule); InsPlan planOld = plan.Copy(); plan.PlanType = planType; plan.MonthRenew = (byte)monthRenew; plan.FeeSched = feeSchedNum; plan.IsMedical = isMedical; plan.CopayFeeSched = copayFeeSchedNum; plan.ExclusionFeeRule = exclusionRule; InsPlans.Update(plan, planOld); InsSub sub = InsSubT.CreateInsSub(pat.PatNum, plan.PlanNum, subscriberID); PatPlan patPlan = PatPlanT.CreatePatPlan((byte)ordinal, pat.PatNum, sub.InsSubNum); ListCarriers.Add(carrier); ListInsPlans.Add(plan); ListInsSubs.Add(sub); ListPatPlans.Add(patPlan); Pat = pat; }
private static int RemoveItemUsingIsEmpty(ExclusionRule rule, List <LeadGeneration> leadGenerations) { int removeCount = 0; switch (rule.DataType) { case Constant.Source: removeCount = leadGenerations.RemoveAll(i => i.Source == null || i.Source == " "); break; case Constant.PeopleSoftID: removeCount = leadGenerations.RemoveAll(i => i.PeopleSoftID == null || i.PeopleSoftID == " "); break; case Constant.CustomerName: removeCount = leadGenerations.RemoveAll(i => i.CustomerName == null || i.CustomerName == " "); break; case Constant.ContactID: removeCount = leadGenerations.RemoveAll(i => i.ContactID == null || i.ContactID == " "); break; case Constant.ContactFlag: removeCount = leadGenerations.RemoveAll(i => i.ContactFlag == null || i.ContactFlag == " "); break; case Constant.Salutation: removeCount = leadGenerations.RemoveAll(i => i.Salutation == null || i.Salutation == " "); break; case Constant.ContactName: removeCount = leadGenerations.RemoveAll(i => i.ContactName == null || i.ContactName == " "); break; case Constant.ContactEmail: removeCount = leadGenerations.RemoveAll(i => i.ContactEmail == null || i.ContactEmail == " "); break; case Constant.SalesRep: removeCount = leadGenerations.RemoveAll(i => i.SalesRep == null || i.SalesRep == " "); break; case Constant.TypeofBusiness: removeCount = leadGenerations.RemoveAll(i => i.TypeofBusiness == null || i.TypeofBusiness == " "); break; case Constant.CustomerChannel: removeCount = leadGenerations.RemoveAll(i => i.CustomerChannel == null || i.CustomerChannel == " "); break; case Constant.ContactPhoneNumber: removeCount = leadGenerations.RemoveAll(i => i.ContactPhoneNumber == null || i.ContactPhoneNumber == " "); break; case Constant.ContactPhoneType: removeCount = leadGenerations.RemoveAll(i => i.ContactPhoneType == null || i.ContactPhoneType == " "); break; } return(removeCount); }
private static int RemoveItemsUsingContains(ExclusionRule rule, List <LeadGeneration> leadGenerations) { int removeCount = 0; switch (rule.DataType) { case Constant.Source: removeCount = leadGenerations.RemoveAll(i => i.Source != null && i.Source.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.PeopleSoftID: removeCount = leadGenerations.RemoveAll(i => i.PeopleSoftID != null && i.PeopleSoftID.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.CustomerName: removeCount = leadGenerations.RemoveAll(i => i.CustomerName != null && i.CustomerName.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.ContactID: removeCount = leadGenerations.RemoveAll(i => i.ContactID != null && i.ContactID.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.ContactFlag: removeCount = leadGenerations.RemoveAll(i => i.ContactFlag != null && i.ContactFlag.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.Salutation: removeCount = leadGenerations.RemoveAll(i => i.Salutation != null && i.Salutation.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.ContactName: removeCount = leadGenerations.RemoveAll(i => i.ContactName != null && i.ContactName.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.ContactEmail: removeCount = leadGenerations.RemoveAll(i => i.ContactEmail != null && i.ContactEmail.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.SalesRep: removeCount = leadGenerations.RemoveAll(i => i.SalesRep != null && i.SalesRep.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.TypeofBusiness: removeCount = leadGenerations.RemoveAll(i => i.TypeofBusiness != null && i.TypeofBusiness.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.CustomerChannel: removeCount = leadGenerations.RemoveAll(i => i.CustomerChannel != null && i.CustomerChannel.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.ContactPhoneNumber: removeCount = leadGenerations.RemoveAll(i => i.ContactPhoneNumber != null && i.ContactPhoneNumber.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; case Constant.ContactPhoneType: removeCount = leadGenerations.RemoveAll(i => i.ContactPhoneType != null && i.ContactPhoneType.Contains(rule.Value, StringComparison.OrdinalIgnoreCase)); break; } return(removeCount); }
public static InspectContentResponse Inspect(string projectId, string textToInspect, List <String> excludedMatchList) { var dlp = DlpServiceClient.Create(); var byteContentItem = new ByteContentItem { Type = ByteContentItem.Types.BytesType.TextUtf8, Data = Google.Protobuf.ByteString.CopyFromUtf8(textToInspect) }; var contentItem = new ContentItem { ByteItem = byteContentItem }; var infoTypes = new string[] { "PHONE_NUMBER", "EMAIL_ADDRESS", "CREDIT_CARD_NUMBER" }.Select(it => new InfoType { Name = it }); var exclusionRule = new ExclusionRule { MatchingType = MatchingType.FullMatch, Dictionary = new CustomInfoType.Types.Dictionary { WordList = new CustomInfoType.Types.Dictionary.Types.WordList { Words = { excludedMatchList } } } }; var ruleSet = new InspectionRuleSet { InfoTypes = { new InfoType { Name = "EMAIL_ADDRESS" } }, Rules = { new InspectionRule { ExclusionRule = exclusionRule } } }; var config = new InspectConfig { InfoTypes = { infoTypes }, IncludeQuote = true, RuleSet = { ruleSet } }; var request = new InspectContentRequest { Parent = new LocationName(projectId, "global").ToString(), Item = contentItem, InspectConfig = config }; var response = dlp.InspectContent(request); Console.WriteLine($"Findings: {response.Result.Findings.Count}"); foreach (var f in response.Result.Findings) { Console.WriteLine("\tQuote: " + f.Quote); Console.WriteLine("\tInfo type: " + f.InfoType.Name); Console.WriteLine("\tLikelihood: " + f.Likelihood); } return(response); }
public static DeidentifyContentResponse Deidentify(string projectId, string text) { // Instantiate a client. var dlp = DlpServiceClient.Create(); var contentItem = new ContentItem { Value = text }; var wordList = new CustomInfoType.Types.Dictionary.Types.WordList { Words = { new string[] { "*****@*****.**", "*****@*****.**" } } }; var exclusionRule = new ExclusionRule { MatchingType = MatchingType.FullMatch, Dictionary = new CustomInfoType.Types.Dictionary { WordList = wordList } }; var infoType = new InfoType { Name = "EMAIL_ADDRESS" }; var inspectionRuleSet = new InspectionRuleSet { InfoTypes = { infoType }, Rules = { new InspectionRule { ExclusionRule = exclusionRule } } }; var inspectConfig = new InspectConfig { InfoTypes = { infoType }, RuleSet = { inspectionRuleSet } }; var primitiveTransformation = new PrimitiveTransformation { ReplaceWithInfoTypeConfig = new ReplaceWithInfoTypeConfig { } }; var transformation = new InfoTypeTransformations.Types.InfoTypeTransformation { InfoTypes = { infoType }, PrimitiveTransformation = primitiveTransformation }; var deidentifyConfig = new DeidentifyConfig { InfoTypeTransformations = new InfoTypeTransformations { Transformations = { transformation } } }; var request = new DeidentifyContentRequest { Parent = new LocationName(projectId, "global").ToString(), InspectConfig = inspectConfig, DeidentifyConfig = deidentifyConfig, Item = contentItem }; // Call the API. var response = dlp.DeidentifyContent(request); // Inspect the results. Console.WriteLine($"Deidentified content: {response.Item.Value}"); return(response); }
public static InspectContentResponse Inspect(string projectId, string textToInspect) { // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call // the "close" method on the client to safely clean up any remaining background resources. var dlp = DlpServiceClient.Create(); // Specify the type and content to be inspected. var byteContentItem = new ByteContentItem { Type = ByteContentItem.Types.BytesType.TextUtf8, Data = Google.Protobuf.ByteString.CopyFromUtf8(textToInspect) }; var contentItem = new ContentItem { ByteItem = byteContentItem }; // Specify the type of info the inspection will look for. // See https://cloud.google.com/dlp/docs/infotypes-reference for complete list of info types. var infoTypes = new string[] { "DOMAIN_NAME", "EMAIL_ADDRESS" }.Select(it => new InfoType { Name = it }); // Define a custom info type to exclude email addresses var customInfoType = new CustomInfoType { InfoType = new InfoType { Name = "EMAIL_ADDRESS" }, ExclusionType = ExclusionType.Exclude }; // Exclude EMAIL_ADDRESS matches var exclusionRule = new ExclusionRule { ExcludeInfoTypes = new ExcludeInfoTypes { InfoTypes = { new InfoType { Name = "EMAIL_ADDRESS" } } }, MatchingType = MatchingType.PartialMatch }; // Construct a ruleset that applies the exclusion rule to the DOMAIN_NAME infotype. // If a DOMAIN_NAME match is part of an EMAIL_ADDRESS match, the DOMAIN_NAME match will // be excluded. var ruleSet = new InspectionRuleSet { InfoTypes = { new InfoType { Name = "DOMAIN_NAME" } }, Rules = { new InspectionRule { ExclusionRule = exclusionRule } } }; // Construct the configuration for the Inspect request, including the ruleset. var config = new InspectConfig { InfoTypes = { infoTypes }, CustomInfoTypes = { customInfoType }, IncludeQuote = true, RuleSet = { ruleSet } }; // Construct the Inspect request to be sent by the client. var request = new InspectContentRequest { Parent = new LocationName(projectId, "global").ToString(), Item = contentItem, InspectConfig = config }; // Use the client to send the API request. var response = dlp.InspectContent(request); return(response); }
public static InspectContentResponse Inspect(string projectId, string textToInspect) { var dlp = DlpServiceClient.Create(); var byteContentItem = new ByteContentItem { Type = ByteContentItem.Types.BytesType.TextUtf8, Data = Google.Protobuf.ByteString.CopyFromUtf8(textToInspect) }; var contentItem = new ContentItem { ByteItem = byteContentItem }; var patientRule = new DetectionRule.Types.HotwordRule { HotwordRegex = new CustomInfoType.Types.Regex { Pattern = "patient" }, Proximity = new DetectionRule.Types.Proximity { WindowBefore = 10 }, LikelihoodAdjustment = new DetectionRule.Types.LikelihoodAdjustment { FixedLikelihood = Likelihood.VeryLikely } }; var doctorRule = new DetectionRule.Types.HotwordRule { HotwordRegex = new CustomInfoType.Types.Regex { Pattern = "doctor" }, Proximity = new DetectionRule.Types.Proximity { WindowBefore = 10 }, LikelihoodAdjustment = new DetectionRule.Types.LikelihoodAdjustment { FixedLikelihood = Likelihood.Unlikely } }; // Construct exclusion rules var quasimodoRule = new ExclusionRule { Dictionary = new Dictionary { WordList = new Dictionary.Types.WordList { Words = { "Quasimodo" } } }, MatchingType = MatchingType.PartialMatch }; var redactedRule = new ExclusionRule { Regex = new CustomInfoType.Types.Regex { Pattern = "REDACTED" }, MatchingType = MatchingType.PartialMatch }; var infoType = new InfoType { Name = "PERSON_NAME" }; var inspectionRuleSet = new InspectionRuleSet { InfoTypes = { infoType }, Rules = { new InspectionRule { HotwordRule = patientRule }, new InspectionRule { HotwordRule = doctorRule }, new InspectionRule { ExclusionRule = quasimodoRule }, new InspectionRule { ExclusionRule = redactedRule } } }; var inspectConfig = new InspectConfig { InfoTypes = { infoType }, IncludeQuote = true, RuleSet = { inspectionRuleSet } }; var request = new InspectContentRequest { ParentAsProjectName = new ProjectName(projectId), Item = contentItem, InspectConfig = inspectConfig }; var response = dlp.InspectContent(request); Console.WriteLine($"Findings: {response.Result.Findings.Count}"); foreach (var f in response.Result.Findings) { Console.WriteLine("\tQuote: " + f.Quote); Console.WriteLine("\tInfo type: " + f.InfoType.Name); Console.WriteLine("\tLikelihood: " + f.Likelihood); } return(response); }
public static InspectContentResponse Inspect(string projectId, string textToInspect) { // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call // the "close" method on the client to safely clean up any remaining background resources. var dlp = DlpServiceClient.Create(); // Specify the type and content to be inspected. var byteItem = new ByteContentItem { Type = ByteContentItem.Types.BytesType.TextUtf8, Data = Google.Protobuf.ByteString.CopyFromUtf8(textToInspect) }; var contentItem = new ContentItem { ByteItem = byteItem }; // Specify the type of info the inspection will look for. // See https://cloud.google.com/dlp/docs/infotypes-reference for complete list of info types. var infoTypes = new string[] { "PERSON_NAME", "EMAIL_ADDRESS" }.Select(it => new InfoType { Name = it }); // Exclude EMAIL_ADDRESS matches var exclusionRule = new ExclusionRule { ExcludeInfoTypes = new ExcludeInfoTypes { InfoTypes = { new InfoType { Name = "EMAIL_ADDRESS" } } }, MatchingType = MatchingType.PartialMatch }; // Construct a ruleset that applies the exclusion rule to the PERSON_NAME infotype. // If a PERSON_NAME match overlaps with an EMAIL_ADDRESS match, the PERSON_NAME match will // be excluded. var ruleSet = new InspectionRuleSet { InfoTypes = { new InfoType { Name = "PERSON_NAME" } }, Rules = { new InspectionRule { ExclusionRule = exclusionRule } } }; // Construct the configuration for the Inspect request, including the ruleset. var config = new InspectConfig { InfoTypes = { infoTypes }, IncludeQuote = true, RuleSet = { ruleSet } }; // Construct the Inspect request to be sent by the client. var request = new InspectContentRequest { Parent = new LocationName(projectId, "global").ToString(), Item = contentItem, InspectConfig = config }; // Use the client to send the API request. var response = dlp.InspectContent(request); // Parse the response and process results Console.WriteLine($"Findings: {response.Result.Findings.Count}"); foreach (var f in response.Result.Findings) { Console.WriteLine("\tQuote: " + f.Quote); Console.WriteLine("\tInfo type: " + f.InfoType.Name); Console.WriteLine("\tLikelihood: " + f.Likelihood); } return(response); }
public static InspectContentResponse Inspect(string projectId, string textToInspect) { var dlp = DlpServiceClient.Create(); var byteItem = new ByteContentItem { Type = ByteContentItem.Types.BytesType.TextUtf8, Data = Google.Protobuf.ByteString.CopyFromUtf8(textToInspect) }; var contentItem = new ContentItem { ByteItem = byteItem }; var customInfoType = new CustomInfoType { InfoType = new InfoType { Name = "VIP_DETECTOR" }, Regex = new CustomInfoType.Types.Regex { Pattern = "Larry Page|Sergey Brin" }, ExclusionType = ExclusionType.Exclude }; var exclusionRule = new ExclusionRule { ExcludeInfoTypes = new ExcludeInfoTypes { InfoTypes = { customInfoType.InfoType } }, MatchingType = MatchingType.FullMatch }; var ruleSet = new InspectionRuleSet { InfoTypes = { new InfoType { Name = "PERSON_NAME" } }, Rules = { new InspectionRule { ExclusionRule = exclusionRule } } }; var config = new InspectConfig { InfoTypes = { new InfoType { Name = "PERSON_NAME" } }, CustomInfoTypes = { customInfoType }, IncludeQuote = true, RuleSet = { ruleSet } }; var request = new InspectContentRequest { Parent = new LocationName(projectId, "global").ToString(), Item = contentItem, InspectConfig = config }; var response = dlp.InspectContent(request); Console.WriteLine($"Findings: {response.Result.Findings.Count}"); foreach (var f in response.Result.Findings) { Console.WriteLine("\tQuote: " + f.Quote); Console.WriteLine("\tInfo type: " + f.InfoType.Name); Console.WriteLine("\tLikelihood: " + f.Likelihood); } return(response); }
public static InspectContentResponse Inspect(string projectId, string textToInspect, string customDetectorPattern, List <String> excludedSubstringList) { var dlp = DlpServiceClient.Create(); var byteContentItem = new ByteContentItem { Type = ByteContentItem.Types.BytesType.TextUtf8, Data = Google.Protobuf.ByteString.CopyFromUtf8(textToInspect) }; var contentItem = new ContentItem { ByteItem = byteContentItem }; var infoType = new InfoType { Name = "CUSTOM_NAME_DETECTOR" }; var customInfoType = new CustomInfoType { InfoType = infoType, Regex = new CustomInfoType.Types.Regex { Pattern = customDetectorPattern } }; var exclusionRule = new ExclusionRule { MatchingType = MatchingType.PartialMatch, Dictionary = new CustomInfoType.Types.Dictionary { WordList = new CustomInfoType.Types.Dictionary.Types.WordList { Words = { excludedSubstringList } } } }; var ruleSet = new InspectionRuleSet { InfoTypes = { infoType }, Rules = { new InspectionRule { ExclusionRule = exclusionRule } } }; var config = new InspectConfig { CustomInfoTypes = { customInfoType }, IncludeQuote = true, RuleSet = { ruleSet } }; var request = new InspectContentRequest { ParentAsProjectName = new ProjectName(projectId), Item = contentItem, InspectConfig = config }; var response = dlp.InspectContent(request); Console.WriteLine($"Findings: {response.Result.Findings.Count}"); foreach (var f in response.Result.Findings) { Console.WriteLine("\tQuote: " + f.Quote); Console.WriteLine("\tInfo type: " + f.InfoType.Name); Console.WriteLine("\tLikelihood: " + f.Likelihood); } return(response); }