/// <summary> /// Deletes the analytic project. /// </summary> /// <param name="matterId">The matter identifier.</param> /// <param name="dataSetId">The data set identifier.</param> /// <param name="projectId">The project identifier.</param> public void DeleteAnalyticProject(long matterId, long dataSetId, long projectId) { mockDocuments = null; analysisSets = null; currentAnalyticSetName = "Training Set 001"; trainingSetCount = 0; resultTrainingSetSummary = new TrainingSetSummary(); MockWorkflowState.Initialize(); }
/// <summary> /// Gets the training set summary. /// </summary> /// <param name="matterId">The matter identifier.</param> /// <param name="dataSetId">The data set identifier.</param> /// <param name="projectId">The project identifier.</param> /// <returns></returns> public TrainingSetSummary GetTrainingSetSummary(long matterId, long dataSetId, long projectId) { if (mockDocuments != null) { var analysisSets = GetAllAnalysisSets(Convert.ToInt64(matterId, CultureInfo.CurrentCulture), Convert.ToInt64(dataSetId, CultureInfo.CurrentCulture), Convert.ToInt64(projectId, CultureInfo.CurrentCulture)); if(resultTrainingSetSummary.RoundsCompleted == 0) { resultTrainingSetSummary.CompletedRoundsSummary = new AnalysisSet(); resultTrainingSetSummary.CompletedRoundsSummary.Type = AnalysisSetType.TrainingSet; } resultTrainingSetSummary.CurrentRoundProgress = UpdateTrainingSetSummary(analysisSets, "current"); } else { var resourceName = string.Format(CultureInfo.InvariantCulture, "{0}.matter_{1}-dataset_{2}-project_{3}-trainingSummary.json", MockDataNameSpace, matterId, dataSetId, projectId); var mockData = GetEmbeddedResource(resourceName); resultTrainingSetSummary = JsonConvert.DeserializeObject<TrainingSetSummary>(mockData); } return resultTrainingSetSummary; }
public List<AnalyticsWorkflowState> UpdateAnalyticWorkflowState(long matterId, long datasetId, long projectId, string binderId, List<AnalyticsWorkflowState> workflowState) { if(workflowState.Count > 1) { mockDocuments = null; mockAnalyticsProjectInfo = null; mockQcSts = null; mockTrainingSetAdditionalDocuments = null; analysisSets = null; addTrainingDocumentIndex = 0; trainingSetCount = 0; mockPredictAllSummaryInfo = null; resultTrainingSetSummary = new TrainingSetSummary(); resultTrainingSetSummary.CompletedRoundsSummary = new AnalysisSet(); resultTrainingSetSummary.CompletedRoundDetails = new List<AnalysisSet>(); resultTrainingSetSummary.CurrentRoundProgress = new AnalysisSet(); MockWorkflowState.Initialize(); MockWorkflowState.ChangeToState = new AnalyticsWorkflowState(); //Ensure data is initialized as expected for the updated workflow state var random = new Random(); //ControlSet AnalyticsWorkflowState state = workflowState.Find(p => p.Name == State.ControlSet); if (state.ReviewStatus == Status.Inprogress) { var controlSetDocs = this.GetDocuments(matterId, datasetId, projectId, "controlset", null); //ReviewStatus inprogress means some controlset documents should be coded if (controlSetDocs.Documents.Find(d => d.Fields[ReviewerCategoryIndex].Value == NotCoded) != null) { foreach (var doc in controlSetDocs.Documents) { doc.Fields[ReviewerCategoryIndex].Value = (random.Next(2) == 0) ? Relevant : NotCoded; } } UpdateControlSetSummary(this.GetAllAnalysisSets(matterId, datasetId, projectId)); } if (state.ReviewStatus == Status.Completed) { var controlSetDocs = this.GetDocuments(matterId, datasetId, projectId, "controlset", null); //ReviewStatus Completed means all controlset documents should be coded if (controlSetDocs.Documents.Find(d => d.Fields[ReviewerCategoryIndex].Value == NotCoded) != null) { foreach (var doc in controlSetDocs.Documents) { doc.Fields[ReviewerCategoryIndex].Value = (random.Next(2) == 0)? NotRelevant : Relevant; } } UpdateControlSetSummary(this.GetAllAnalysisSets(matterId, datasetId, projectId)); } //TrainingSet state = workflowState.Find(p => p.Name == State.TrainingSet); if (state.CreateStatus == Status.Completed) { this.CreateTrainingset(matterId.ToString(CultureInfo.InvariantCulture), datasetId.ToString(CultureInfo.InvariantCulture), projectId.ToString(CultureInfo.InvariantCulture)); //MockWorkflowState.ChangeToState = workflowState.Find(p => p.Name == State.ControlSet); //resultTrainingSetSummary.CompletedRoundsSummary = new AnalysisSet(); //resultTrainingSetSummary.CompletedRoundDetails = new List<AnalysisSet>(); //resultTrainingSetSummary.CompletedRoundsSummary.Type = AnalysisSetType.TrainingSet; //resultTrainingSetSummary.RoundsCompleted = 0; //resultTrainingSetSummary.CurrentRound = 1; } if (state.ReviewStatus == Status.Inprogress) { var trainingSetDocs = this.GetDocuments(matterId, datasetId, projectId, "trainingset", CreateQueryContext(AnalysisSetType.TrainingSet, "Training Set 001")); trainingSetDocs.Documents[0].Fields[ReviewerCategoryIndex].Value = Relevant; trainingSetDocs.Documents[1].Fields[ReviewerCategoryIndex].Value = NotRelevant; trainingSetDocs.Documents[2].Fields[ReviewerCategoryIndex].Value = Skipped; UpdateTrainingSetSummary(this.GetAllAnalysisSets(matterId, datasetId, projectId), "current"); resultTrainingSetSummary.CompletedRoundsSummary = new AnalysisSet(); resultTrainingSetSummary.RoundsCompleted = 0; resultTrainingSetSummary.CurrentRound = 1; } if (state.ReviewStatus == Status.Completed) { var queryContext = CreateQueryContext(AnalysisSetType.TrainingSet, "Training Set 001"); var trainingSetDocs = this.GetDocuments(matterId, datasetId, projectId, "trainingset",queryContext); foreach (var doc in trainingSetDocs.Documents) { doc.Fields[ReviewerCategoryIndex].Value = (random.Next(2) == 0) ? NotRelevant : Relevant; } this.CreateTrainingset(matterId.ToString(CultureInfo.InvariantCulture), datasetId.ToString(CultureInfo.InvariantCulture), projectId.ToString(CultureInfo.InvariantCulture)); queryContext.AnalysisSet.Name = "Training Set 002"; trainingSetDocs = this.GetDocuments(matterId, datasetId, projectId, "trainingset", queryContext); foreach (var doc in trainingSetDocs.Documents) { doc.Fields[ReviewerCategoryIndex].Value = (random.Next(2) == 0) ? NotRelevant : Relevant; } this.CreateTrainingset(matterId.ToString(CultureInfo.InvariantCulture), datasetId.ToString(CultureInfo.InvariantCulture), projectId.ToString(CultureInfo.InvariantCulture)); } //QcSet state = workflowState.Find(p => p.Name == State.QcSet); if (state.CreateStatus == Status.Completed) { this.CreateQcSet(matterId, datasetId, projectId, new QcSet()); } if (state.ReviewStatus == Status.Inprogress) { var queryContext = CreateQueryContext(AnalysisSetType.QcSet, "QCSet01"); var qcSetDocs = this.GetDocuments(matterId, datasetId, projectId, "qcset", queryContext); foreach (var doc in qcSetDocs.Documents) { doc.Fields[ReviewerCategoryIndex].Value = (random.Next(2) == 0) ? Relevant : NotCoded; } } if (state.ReviewStatus == Status.Completed) { var queryContext = CreateQueryContext(AnalysisSetType.QcSet, "QCSet01"); var qcSetDocs = this.GetDocuments(matterId, datasetId, projectId, "qcset", queryContext); foreach (var doc in qcSetDocs.Documents) { doc.Fields[ReviewerCategoryIndex].Value = (random.Next(2) == 0) ? NotRelevant : Relevant; } } //PredictSet state = workflowState.Find(p => p.Name == State.PredictSet); if (state.ReviewStatus == Status.Completed) { if (mockDocuments != null) { foreach (var doc in mockDocuments.Documents) { doc.Fields[PredictedCategoryIndex].Value = doc.Fields[PredictedCategoryIndex].Value == NotCoded ? Relevant : doc.Fields[PredictedCategoryIndex].Value; } } } } return MockWorkflowState.UpdateStates(workflowState); }