static IEnumerable <KeyValuePair <AllocationGroups, int> > GetBaseCounts() { var allBlocks = ArmData.GetAllBlocks(); var returnVar = new List <KeyValuePair <AllocationGroups, int> >(allBlocks.Count); foreach (var a in allBlocks) { returnVar.Add(new KeyValuePair <AllocationGroups, int>(a.Key, a.Value.Ratios.Values.Sum())); } return(returnVar); }
static IEnumerable <KeyValuePair <AllocationGroups, int> > GetBaseCounts(RandomisationArm arm) { var allBlocks = ArmData.GetAllBlocks(); var returnVar = new List <KeyValuePair <AllocationGroups, int> >(allBlocks.Count); foreach (var a in allBlocks) { if (a.Value.Ratios.TryGetValue(arm, out int v)) { returnVar.Add(new KeyValuePair <AllocationGroups, int>(a.Key, v)); } } return(returnVar); }
static AllocationBlock CreateNewAllocationBlock(Participant participant, RandomisationStrata strata, out BlockComponent component, ITrialDataContext context) { var block = GetNextAllocationGroup(participant, strata, context); component = ArmData.GetRatio(block); if (participant.Centre == null) { participant.Centre = context.StudyCentres.Find(participant.CentreId); } var returnVar = new AllocationBlock { Id = context.AllocationBlocks.GetNextId(participant.CentreId, participant.Centre.MaxIdForSite), AllocationGroup = block, GroupRepeats = component.Repeats, RandomisationCategory = strata }; context.AllocationBlocks.Add(returnVar); return(returnVar); }