Example #1
0
        private void AddChildren(AllCohortsNode cohortsNode, DescendancyList descendancy)
        {
            var validSources = CohortSources.ToArray();

            AddToDictionaries(new HashSet <object>(validSources), descendancy);
            foreach (var s in validSources)
            {
                AddChildren(s, descendancy.Add(s));
            }
        }
Example #2
0
        private List <CohortSourceUsedByProjectNode> GetAllCohortProjectUsageNodesFor(Project project)
        {
            //if the current project does not have a number or there are no cohorts associated with it
            if (project.ProjectNumber == null || !ProjectNumberToCohortsDictionary.ContainsKey(project.ProjectNumber.Value))
            {
                return(new List <CohortSourceUsedByProjectNode>());
            }

            List <CohortSourceUsedByProjectNode> toReturn = new List <CohortSourceUsedByProjectNode>();


            foreach (var cohort in ProjectNumberToCohortsDictionary[project.ProjectNumber.Value])
            {
                //get the source of the cohort
                var source = CohortSources.Single(s => s.ID == cohort.ExternalCohortTable_ID);

                //numbers match
                var existing = toReturn.SingleOrDefault(s => s.ObjectBeingUsed.ID == cohort.ExternalCohortTable_ID);

                //make sure we have a record of the source
                if (existing == null)
                {
                    existing = new CohortSourceUsedByProjectNode(project, source);
                    toReturn.Add(existing);
                }

                //add the cohort to the list of known cohorts from this source (a project can have lots of cohorts and even cohorts from different sources)
                var cohortUsedByProject = new ObjectUsedByOtherObjectNode <CohortSourceUsedByProjectNode, ExtractableCohort>(existing, cohort);
                existing.CohortsUsed.Add(cohortUsedByProject);

                DuplicatesByCohortSourceUsedByProjectNode.Add(cohortUsedByProject);
            }

            DuplicatesByProject.AddRange(toReturn);

            //if the project has no cohorts then add a ??? node
            if (!toReturn.Any())
            {
                toReturn.Add(new CohortSourceUsedByProjectNode(project, null));
            }

            return(toReturn);
        }
Example #3
0
 private void GetCohortAvailability()
 {
     Parallel.ForEach(CohortSources.Except(BlackListedSources), GetCohortAvailability);
 }