private static void AddFundAndFirmType(InvestmentActivity accession, InvestorHashTableSet investors) { if (string.IsNullOrEmpty(accession.ActivistInvestorName)) { return; } var transformed = accession.ActivistInvestorName.Replace(" ", "").ToLower(); Investor possibleMatch = null; if (investors.FirmNameAsKey.TryGetValue(transformed, out var firmNameMatch)) { possibleMatch = firmNameMatch; } else if (investors.FundNameAsKey.TryGetValue(transformed, out var fundNameMatch)) { possibleMatch = fundNameMatch; } if (possibleMatch != null) { accession.ActivistInvestorId = possibleMatch.Id.Substring(2); //CLEA 2.xxx system accession.ActivistInvestorFundType = possibleMatch.FundType; accession.ActivistInvestorFirmType = possibleMatch.FirmType; return; } }
private static FileAnalysisResult AnalyzeFile(string file, IReadOnlyDictionary <string, InvestmentActivity> alteryxInvestmentSet, IReadOnlyDictionary <string, int> supervised, InvestorHashTableSet investors) { InvestmentActivity investmentActivity = EdgarAnalyzer.Analyze(file); Supervised trainingDatum = null; Helper.MergeAccession(investmentActivity, alteryxInvestmentSet); AddFundAndFirmType(investmentActivity, investors); if (supervised.TryGetValue(investmentActivity.AccessionNumber, out var typeId)) { trainingDatum = new Supervised(investmentActivity.AccessionNumber, investmentActivity.PurposeOfTransaction, typeId, investmentActivity.TypeOfReportingPerson); investmentActivity.PurposeAnalyzedByML = false; investmentActivity.PurposeOfTransactionTypeId = typeId; } return(new FileAnalysisResult() { Investment = investmentActivity, Supervised = trainingDatum }); }
private static FileAnalysisBatchResult AnalyzeSliceOfFiles(int start, int limit, IReadOnlyList <string> files, IReadOnlyDictionary <string, InvestmentActivity> originAccessions, IReadOnlyDictionary <string, int> supervised, InvestorHashTableSet investors, AtratinusConfiguration config) { IList <InvestmentActivity> investments = new List <InvestmentActivity>(); IList <Supervised> trainingData = new List <Supervised>(); var report = new FullQualityReport(); for (int fileIndex = start; fileIndex < limit; fileIndex++) { var analysis = AnalyzeFile(files[fileIndex], originAccessions, supervised, investors); var fileReport = QualityGate.Measure(analysis.Investment, config); report.ConsiderQualityReport(files[fileIndex], fileReport); if (!fileReport.ShouldBeConsidered) { continue; } if (analysis.Supervised != null) { trainingData.Add(analysis.Supervised); } investments.Add(analysis.Investment); } return(new FileAnalysisBatchResult() { Accessions = investments, TrainingData = trainingData, QualityReport = report }); }