def run(): inject_mode = sys.argv[-1] if inject_mode == 'randomtriage': generate_triage() elif inject_mode == 'pat': print "Loading some case data for pat patient" careteam = CareTeam.objects.filter(patient__user__username='******')[0] num = 10 assign_interactions(careteam, num) elif inject_mode == 'historical': for careteam in CareTeam.objects.all().exclude(patient__user__username='******'): num_cases= random.randint(0,5) print "\tgenerating %d baseline interactions" % (num_cases) assign_interactions(careteam, num_cases) add_long_cases() #adds the longer commented case elif inject_mode == 'initial': inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-question","Patient daily measurements incomplete","Missing data alert: Missing weight and temperature","Home Monitor"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","%s has a runny nose","is it bad?","Caregiver"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","urgent","What order should I instruct the patient to take their anti nausea meds?","Caregiver"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","not feeling well","%s has been reporting severe constipation the past few days","Caregiver"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","help","Do I need to fast before my next visit?","patient"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","not a big deal","Do I need to take all these meds you gave me?","Caregiver"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","bleeding gums","was about to brush my teeth when I saw it","patient"],) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","more skin problems for %s","Thanks for the tip on the last skin issue!","caregiver"],) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","%s has severe diarrhea","%s was up most of the night, was able to stay hydrated, but am worried.","Caregiver"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","fever","at what temperature should I know to call for help?","patient"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-issue","is it bad?","not sure if this is hives or a rash","Caregiver"]) elif inject_mode == 'monitoring': inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-question","Patient has not submitted daily measurements","Missing data alert","Home Monitor"]) inject_casemonitor(CareTeam.objects.filter(patient__user__username='******')[0],\ ["ashand-question","Patient has vomited 2 times in the past 24 hours","Daily reading alert","Home Monitor"])
def run(): #reset the database #call_command('reset_db', interactive=False) #call_command('syncdb', interactive=False) #load all the demo categories for cases #load_fixtures() for provarr in provider_arr: #firstname, lastname, job_title, affiliation create_provider(provarr[0], provarr[1],provarr[2],provarr[3]) print "created all providers" for pt_cg_list in care_pair_arr: ptarr = pt_cg_list[0] cgarr = pt_cg_list[1] pt = create_patient(ptarr[0],ptarr[1],ptarr[2],ptarr[3]) cg = create_caregiver(cgarr[0],cgarr[1],cgarr[2],cgarr[3]) create_careteam(pt, caregiver_user=cg) # #create patients # for ptarr in patient_arr: # create_patient(ptarr[0],ptarr[1],ptarr[2],ptarr[3]) # print "Created test patients. Total %d" % Patient.objects.all().count() # # # # # print "Creating care teams..." # #create careteam around all patients and link providers to them # for patient in Patient.objects.all(): # create_careteam(patient) #before making the case, we need to get all the user objects of the people in the careteam. #first the providers: revision_no = 0 for team in CareTeam.objects.all(): provs = team.providers.all() caregivers = team.caregivers.all() users = [team.patient.user] #get the user objects from the providers on this careteam for prov in provs: #when you do an all on the providers, provider objects, so we need to flip over to the User instead. users.append(prov.user) for cg in caregivers: users.append(cg) num_cases= random.randint(0,10) print "\tgenerating %d baseline interactions" % (num_cases) assign_interactions(team, num_cases) #create fictitious cases and case activity by patients and providers. #for num in range(0,MAX_INITIAL_CASES): #case = create_case(users[random.randint(0,len(users)-1)], users, num) #team.add_case(case) #num_revisions = random.randint(0,MAX_REVISIONS) #print "New case created for patient %s, case %d" % (team.patient, num) #for rev in range(0,num_revisions): # print "\tApplying revision %d - %d" % (rev, revision_no) # modding_user = users[random.randint(0,len(users)-1)] # if random.random() >= .25: # #let's bias towards doing work on a case # work_case(case,modding_user) # else: # resolve_or_close_case(case, modding_user, revision_no) # # revision_no += 1 print "Generating triage patients" #generate_triage() print "adding long cases to dorothy day" add_long_cases()