static AllocationGroups GetNextAllocationGroup(Participant participant, RandomisationStrata strata, ITrialDataContext context) { AllocationGroups returnVar = (participant.Centre ?? (participant.Centre = context.StudyCentres.Find(participant.CentreId))).DefaultAllocation; if (returnVar == AllocationGroups.India3ArmUnbalanced) { var alloc = context.BalancedAllocations.First(a => a.RandomisationCategory == strata && a.StudyCentreId == participant.CentreId); if (!alloc.IsEqualised) { var catQuery = from p in context.Participants where p.CentreId == participant.CentreId && p.Block.RandomisationCategory == strata select p; if ((double)catQuery.Count() / catQuery.Count(p => p.TrialArm == RandomisationArm.DanishBcg) <= 3) { alloc.IsEqualised = true; context.SaveChanges(true); if (context.BalancedAllocations.All(a => a.IsEqualised && a.StudyCentreId == participant.CentreId)) { participant.Centre.DefaultAllocation = AllocationGroups.India3ArmBalanced; } } } if (alloc.IsEqualised) { return(AllocationGroups.India3ArmBalanced); } } return(returnVar); }
public static int[] SeedVaccineIds(AllocationGroups group) { var returnList = new List <int>(5) { Opv.Id, HepB.Id }; switch (group) { case AllocationGroups.NotApplicable: throw new ArgumentException("NotApplicatble should never be used as an allocationGroup"); case AllocationGroups.India2Arm: returnList.Add(RussianBcg.Id); break; case AllocationGroups.India3ArmBalanced: case AllocationGroups.India3ArmUnbalanced: returnList.Add(RussianBcg.Id); returnList.Add(DanishBcg.Id); break; case AllocationGroups.Brazil2Arm: returnList.Add(BcgMoreau.Id); break; case AllocationGroups.Danish2Arm: returnList.Add(DanishBcg.Id); break; case AllocationGroups.GreenSignal2Arm: returnList.Add(BcgGreenSignal.Id); break; case AllocationGroups.Japan2Arm: returnList.Add(BcgJapan.Id); break; case AllocationGroups.Uganda3Arm: returnList.Add(BcgJapan.Id); returnList.Add(RussianBcg.Id); break; } var returnVar = new int[returnList.Count]; returnList.CopyTo(returnVar); return(returnVar); }
public static BlockComponent GetRatio(AllocationGroups group) { return(GetAllBlocks()[group]); }