(key_type, regimen_string)
return ret
Given a regimen string, "morning,noon,evening" return a dict of the appropriate update values
    of the casedoc of this representation

    key_type is ART or NONART

    so if art will return 'artregimen': <int>, "dot_a_one": 0, "dot_a_two": "1", etc
    if nonartregimen it'll be 'nonartregimen' and dot_n_one, etc.
Given a regimen string, "morning,noon,evening" return a dict of the appropriate update values
    of the casedoc of this representation
Given a regimen string morning noon evening return a dict of the appropriate update values of the casedoc of this representation
def regimen_dict_from_choice(key_type, regimen_string):
    """
    Given a regimen string, "morning,noon,evening" return a dict of the appropriate update values
    of the casedoc of this representation

    key_type is ART or NONART

    so if art will return 'artregimen': <int>, "dot_a_one": 0, "dot_a_two": "1", etc
    if nonartregimen it'll be 'nonartregimen' and dot_n_one, etc.
    """

    assert key_type in list(type_keys.keys()), 'the key_type must be ART or NONART'

    #ensure regimen_string is in PACT_REGIMEN_CHOICES_DICT
    #get integer day slot from DAY_SLOTS_BY_TIME[str]
    if len(regimen_string) > 0:
        regimen_split = regimen_string.split(',')
        regimen_freq = len(regimen_split)
    else:
        regimen_freq = 0
        regimen_split = []

    day_key_prefix = type_keys[key_type]
    if key_type == DOT_ART:
        key_type_string = CASE_ART_REGIMEN_PROP
    elif key_type == DOT_NONART:
        key_type_string = CASE_NONART_REGIMEN_PROP
    ret = { key_type_string: str(regimen_freq) }
    for x in range(0, 4):
        if x < regimen_freq:
            ret[day_key_prefix % digit_strings[x]] = str(DAY_SLOTS_BY_TIME.get(regimen_split[x], None))
        else:
            ret[day_key_prefix % digit_strings[x]] = ""
    return ret
def regimen_dict_from_choice ( key_type , regimen_string ) : assert key_type in list ( type_keys . keys ( ) ) , 'the key_type must be ART or NONART' #ensure regimen_string is in PACT_REGIMEN_CHOICES_DICT #get integer day slot from DAY_SLOTS_BY_TIME[str] if len ( regimen_string ) > 0 : regimen_split = regimen_string . split ( ',' ) regimen_freq = len ( regimen_split ) else : regimen_freq = 0 regimen_split = [ ] day_key_prefix = type_keys [ key_type ] if key_type == DOT_ART : key_type_string = CASE_ART_REGIMEN_PROP elif key_type == DOT_NONART : key_type_string = CASE_NONART_REGIMEN_PROP ret = { key_type_string : str ( regimen_freq ) } for x in range ( 0 , 4 ) : if x < regimen_freq : ret [ day_key_prefix % digit_strings [ x ] ] = str ( DAY_SLOTS_BY_TIME . get ( regimen_split [ x ] , None ) ) else : ret [ day_key_prefix % digit_strings [ x ] ] = "" return ret