Esempio n. 1
0
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                var analyticProject           = new AnalyticsProject();
                var projectDocumentCollection = (ProjectDocumentCollection)message.Body;
                projectDocumentCollection.ShouldNotBe(null);
                projectDocumentCollection.Documents.ShouldNotBe(null);

                var documentIds    = projectDocumentCollection.Documents.Select(p => p.DocId).ToList();
                var documentResult = analyticProject.BulkGetDocumentsByDocIds(_jobParameter.MatterId,
                                                                              _dataset.CollectionId, documentIds);


                var projectDocuments = new List <AnalysisSetDocumentInfo>();
                foreach (var document in projectDocumentCollection.Documents)
                {
                    var projectDocument = new AnalysisSetDocumentInfo
                    {
                        DocumentId        = (int)document.DocId,
                        PredictedCategory = document.PredictedCategory,
                        DocumentScore     = (decimal)document.DocumentScore
                    };
                    var result = documentResult.FirstOrDefault(d => d.Id == document.DocId);
                    if (result == null)
                    {
                        continue;
                    }
                    projectDocument.DocumentReferenceId = result.DocumentID;
                    projectDocuments.Add(projectDocument);
                }

                analyticProject.UpdateFieldsForCategorizeDocuments(_jobParameter.MatterId, _projectInfo,
                                                                   _dataset.CollectionId, WorkAssignment.JobId, projectDocuments);

                IncreaseProcessedDocumentsCount(projectDocumentCollection.Documents.Count()); //Progress Status
            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }
        protected override void ProcessMessage(PipeMessageEnvelope message)
        {
            try
            {
                var analyticProject = new AnalyticsProject();
                var projectDocumentCollection = (ProjectDocumentCollection) message.Body;
                projectDocumentCollection.ShouldNotBe(null);
                projectDocumentCollection.Documents.ShouldNotBe(null);

                var documentIds = projectDocumentCollection.Documents.Select(p => p.DocId).ToList();
                var documentResult = analyticProject.BulkGetDocumentsByDocIds(_jobParameter.MatterId,
                    _dataset.CollectionId, documentIds);


                var projectDocuments = new List<AnalysisSetDocumentInfo>();
                foreach (var document in projectDocumentCollection.Documents)
                {
                    var projectDocument = new AnalysisSetDocumentInfo
                    {
                        DocumentId = (int) document.DocId,
                        PredictedCategory = document.PredictedCategory,
                        DocumentScore = (decimal) document.DocumentScore
                    };
                    var result = documentResult.FirstOrDefault(d => d.Id == document.DocId);
                    if (result == null) continue;
                    projectDocument.DocumentReferenceId = result.DocumentID;
                    projectDocuments.Add(projectDocument);
                }

                analyticProject.UpdateFieldsForCategorizeDocuments(_jobParameter.MatterId, _projectInfo,
                    _dataset.CollectionId, WorkAssignment.JobId, projectDocuments);

                IncreaseProcessedDocumentsCount(projectDocumentCollection.Documents.Count()); //Progress Status

            }
            catch (Exception ex)
            {
                ex.Trace().Swallow();
                ReportToDirector(ex);
            }
        }