/// <summary>
        /// Generation interactions based on a #
        /// </summary>
        /// <param name="profiles">the number of profiles to create</param>
        /// <returns>Give back a list of the speicfic type of interactions generated</returns>
        public static new List <Profile> GenerateProfilesByCount(int profiles, object configuration)
        {
            try
            {
                SampleDataCache.InitializeFakeDataHelpers();

                //SampleDataCache.RandomDateTime birthDayrdt = new SampleDataCache.RandomDateTime(1955, 1, 1, new DateTime(2000, 1, 1));

                List <Profile> listContacts = new List <Profile>();

                for (int i = 0; i < profiles; i++)
                {
                    ////generate our fake data
                    Contact a = new Contact();

                    int maleorfemale = SampleDataCache.RandomContactGenerator.Next(1, 100);

                    a.FirstName = maleorfemale < 50 ? SampleDataCache.Malenames[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Malenames.Count - 1)] : SampleDataCache.Femalenames[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Femalenames.Count - 1)];

                    a.LastName = SampleDataCache.Lastnames[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Lastnames.Count - 1)];

                    a.PrimaryLanguageCode = SampleDataCache.Languages[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Languages.Count - 1)];

                    SampleDataCache.AddressInfo addressInfo = SampleDataCache.AddressInfos[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.AddressInfos.Count - 1)];

                    a.Address1City            = addressInfo.City;
                    a.Address1Country         = addressInfo.Country;
                    a.Address1Line1           = addressInfo.Address;
                    a.Telephone1              = addressInfo.Areacode + "-" + addressInfo.Telephone; //(business)
                    a.MobilePhone             = addressInfo.Areacode + "-" + addressInfo.Telephone;
                    a.Telephone2              = addressInfo.Areacode + "-" + addressInfo.Telephone; //(home)
                    a.Address1PostalCode      = addressInfo.Zipcode;
                    a.Address1StateOrProvince = addressInfo.State;
                    a.Age            = SampleDataCache.RandomContactGenerator.Next(18, 100);
                    a.EmailAddress1  = a.FirstName + "_" + a.LastName + "@testlive.com";
                    a.FullName       = a.FirstName + " " + a.LastName;
                    a.GenderCode     = maleorfemale < 50 ? (int)ContactGenderCode.Male : (int)ContactGenderCode.Female;
                    a.Salutation     = maleorfemale < 50 ? "Mr." : "Mrs.";
                    a.CDMContactType = ContactType.Standard;
                    a.BirthDate      = birthDayRandomGenerator.Next();

                    listContacts.Add(a);
                }

                return(listContacts);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }
Example #2
0
        /// <summary>
        /// Generation interactions based on a #
        /// </summary>
        /// <param name="profiles">the number of profiles to create</param>
        /// <returns>Give back a list of the speicfic type of interactions generated</returns>
        public static new List <Profile> GenerateProfilesByCount(int profiles, object configuration)
        {
            try
            {
                SampleDataCache.InitializeFakeDataHelpers();

                List <Profile>       listPatients = new List <Profile>();
                List <RelatedPerson> listRelatedPersons;
                List <Practitioner>  listPractitioners;

                //SampleDataCache.RandomDateTime birthDayrdt = new SampleDataCache.RandomDateTime(1955, 1, 1, new DateTime(2000, 1, 1));

                for (int i = 0; i < profiles; i++)
                {
                    ////generate our fake data
                    Patient a = new Patient();

                    a.PatientConfiguration = ((PatientConfiguration)(configuration));

                    int maleorfemale = SampleDataCache.RandomContactGenerator.Next(1, 100);

                    a.FirstName = maleorfemale < 50 ? SampleDataCache.Malenames[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Malenames.Count - 1)] : SampleDataCache.Femalenames[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Femalenames.Count - 1)];
                    a.LastName  = SampleDataCache.Lastnames[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Lastnames.Count - 1)];

                    SampleDataCache.AddressInfo addressInfo = SampleDataCache.AddressInfos[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.AddressInfos.Count - 1)];

                    // Now set the Emergency and Primary Contact etc
                    string practitionersfile  = a.PatientConfiguration.PractionerFileName;
                    string relatedpersonsfile = a.PatientConfiguration.RelatedPersonsFileName;

                    if (!string.IsNullOrEmpty(relatedpersonsfile))
                    {
                        listRelatedPersons = RelatedPerson.ImportProfiles(relatedpersonsfile);

                        if (listRelatedPersons != null)
                        {
                            Profile emergencyContact = listRelatedPersons[SampleDataCache.RandomContactGenerator.Next(0, listRelatedPersons.Count - 1)];
                            Profile primaryContact   = listRelatedPersons[SampleDataCache.RandomContactGenerator.Next(0, listRelatedPersons.Count - 1)];

                            a.EmergencyContactId = emergencyContact.ContactId;
                            a.PrimaryContactId   = primaryContact.ContactId;

                            a.EmergencyContactRelationshipTypeId = SampleDataCache.RelatedPersonTypes[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.RelatedPersonTypes.Count - 1)];
                            a.PrimaryContactRelationshipTypeId   = SampleDataCache.RelatedPersonTypes[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.RelatedPersonTypes.Count - 1)];
                        }
                    }

                    if (!string.IsNullOrEmpty(practitionersfile))
                    {
                        listPractitioners = Practitioner.ImportProfiles(practitionersfile);

                        if (listPractitioners != null)
                        {
                            Profile primaryPractitioner = listPractitioners[SampleDataCache.RandomContactGenerator.Next(0, listPractitioners.Count - 1)];

                            a.PrimaryPractitionerId = primaryPractitioner.ContactId;
                        }
                    }

                    if (a.PatientConfiguration.AllergyIntoleranceCount > 0)
                    {
                        for (int iAllergies = 0; iAllergies < a.PatientConfiguration.AllergyIntoleranceCount; iAllergies++)
                        {
                            AllergyIntolerance ai = new AllergyIntolerance();
                            a.AllergyIntolerances.Add(ai);
                        }
                    }

                    if (a.PatientConfiguration.NutritionOrderCount > 0)
                    {
                        for (int iNutritionOrders = 0; iNutritionOrders < a.PatientConfiguration.NutritionOrderCount; iNutritionOrders++)
                        {
                            NutritionOrder no = new NutritionOrder();
                            a.NutritionOrders.Add(no);
                        }
                    }


                    if (a.PatientConfiguration.ConditionCount > 0)
                    {
                        for (int iConditions = 0; iConditions < a.PatientConfiguration.ConditionCount; iConditions++)
                        {
                            Condition condition = new Condition();

                            condition.VerificationStatus = HealthCDMEnums.RandomEnumInt <HealthCDMEnums.Condition_Verificationstatus>();
                            a.Conditions.Add(condition);
                        }
                    }

                    if (a.PatientConfiguration.DeviceCount > 0)
                    {
                        for (int iDevice = 0; iDevice < a.PatientConfiguration.DeviceCount; iDevice++)
                        {
                            Device device = new Device();
                            a.Devices.Add(device);
                        }
                    }

                    if (a.PatientConfiguration.ProcedureCount > 0)
                    {
                        for (int iProcedure = 0; iProcedure < a.PatientConfiguration.ProcedureCount; iProcedure++)
                        {
                            Procedure procedure = new Procedure();
                            a.Procedures.Add(procedure);
                        }
                    }

                    if (a.PatientConfiguration.ReferralCount > 0)
                    {
                        for (int iReferral = 0; iReferral < a.PatientConfiguration.ReferralCount; iReferral++)
                        {
                            ReferralRequest request = new ReferralRequest();
                            a.ReferralRequests.Add(request);
                        }
                    }

                    if (a.PatientConfiguration.MedicationCount > 0)
                    {
                        for (int iMedication = 0; iMedication < a.PatientConfiguration.MedicationCount; iMedication++)
                        {
                            MedicationRequest medication = new MedicationRequest();
                            a.MedicationRequests.Add(medication);
                        }
                    }

                    a.PrimaryLanguageCode = SampleDataCache.Languages[SampleDataCache.RandomContactGenerator.Next(0, SampleDataCache.Languages.Count - 1)];


                    a.Address1City            = addressInfo.City;
                    a.Address1Country         = addressInfo.Country;
                    a.Address1Line1           = addressInfo.Address;
                    a.Telephone1              = addressInfo.Areacode + "-" + addressInfo.Telephone; //(business)
                    a.MobilePhone             = addressInfo.Areacode + "-" + addressInfo.Telephone;
                    a.Telephone2              = addressInfo.Areacode + "-" + addressInfo.Telephone; //(home)
                    a.Address1PostalCode      = addressInfo.Zipcode;
                    a.Address1StateOrProvince = addressInfo.State;
                    a.Age                  = SampleDataCache.RandomContactGenerator.Next(18, 100);
                    a.EmailAddress1        = a.FirstName + "_" + a.LastName + "@testlive.com";
                    a.FullName             = a.FirstName + " " + a.LastName;
                    a.GenderCode           = maleorfemale < 50 ? (int)ContactGenderCode.Male : (int)ContactGenderCode.Female;
                    a.Salutation           = maleorfemale < 50 ? "Mr." : "Mrs.";
                    a.CDMContactType       = ContactType.Patient;
                    a.PatientMedicalNumber = GenerateMedicalNumber();
                    a.BirthDate            = birthDayRandomGenerator.Next();

                    listPatients.Add(a);
                }

                return(listPatients);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }