def handle(self, *args, **options): """ python manage.py generate_cohort 2015 1,2,3 100588 """ year = args[0] months = args[1].split(',') if len(args) > 2: apr_id_start = args[2] else: apr_id_start = RegistryEntry.get_max_apr_id()+1 from ampath import livebirths for month in months: livebirths.full_monthly_cohort_generation(year=int(year), month=int(month), apr_starting_id=int(apr_id_start)) apr_id_start = RegistryEntry.get_max_apr_id()+1
def handle(self, *args, **options): """ python manage.py faces_cohort 100588 """ apr_id_start = int(args[0]) months = ( (1, 2014), (2, 2014), (3, 2014), (4, 2014), (5, 2014), (6, 2014), (7, 2014), (8, 2014), (9, 2014), (10, 2014), (11, 2014), (12, 2014), ) for batch in months: cohorts.full_monthly_cohort_generation(batch[0], batch[1], apr_id_start, True) apr_id_start = RegistryEntry.get_max_apr_id()+1
def full_monthly_cohort_generation(month=1, year=2014, apr_starting_id=None, save=False): """ Standard full method for generating the monthly cohorts that the management command will call in to. """ hei_encs = get_hei_encounters(month=month, year=year) cur_apr_id = apr_starting_id for enc in hei_encs: next_entry = process_hei_encounter(enc, cur_apr_id, save=save) if next_entry.voided == False and next_entry.apr_id != None: # logger.info("Incrementing current apr_id, just used %s" % (cur_apr_id,)) cur_apr_id += 1 cur_apr_id = RegistryEntry.get_max_apr_id() + 1 process_nonlive_encounters(month=1, year=2014, apr_starting_id=cur_apr_id, save=save)
def handle(self, *args, **options): print RegistryEntry.get_max_apr_id()