(drug_type, doc_dict)
return string_from_regimen_props(freq, props=props, suppress_errors=True)
For a dict of doc properties and a given drug_type (ART, NONART), calculate/confirm the
    regimen string of the times of doses.
For a dict of doc properties and a given drug_type (ART, NONART), calculate/confirm the
    regimen string of the times of doses.
For a dict of doc properties and a given drug_type ( ART NONART ) calculate / confirm the regimen string of the times of doses .
def regimen_string_from_doc(drug_type, doc_dict):
    """
    For a dict of doc properties and a given drug_type (ART, NONART), calculate/confirm the
    regimen string of the times of doses.
    """
    assert drug_type in list(type_keys.keys()), "the drug type must be art or nonart"
    prefix = type_keys[drug_type]

    if drug_type == DOT_ART:
        try:
            freq = int(doc_dict.get(CASE_ART_REGIMEN_PROP, ''))
        except ValueError:
            return None
    elif drug_type == DOT_NONART:
        try:
            freq = int(doc_dict.get(CASE_NONART_REGIMEN_PROP, ''))
        except ValueError:
            return None

    props = []
    for digit in digit_strings:
        key = prefix % digit
        prop = doc_dict.get(key, '')
        if prop != '' and prop is not None:
            try:
                props.append(int(prop))
            except:
                pass

    return string_from_regimen_props(freq, props=props, suppress_errors=True)
def regimen_string_from_doc ( drug_type , doc_dict ) : assert drug_type in list ( type_keys . keys ( ) ) , "the drug type must be art or nonart" prefix = type_keys [ drug_type ] if drug_type == DOT_ART : try : freq = int ( doc_dict . get ( CASE_ART_REGIMEN_PROP , '' ) ) except ValueError : return None elif drug_type == DOT_NONART : try : freq = int ( doc_dict . get ( CASE_NONART_REGIMEN_PROP , '' ) ) except ValueError : return None props = [ ] for digit in digit_strings : key = prefix % digit prop = doc_dict . get ( key , '' ) if prop != '' and prop is not None : try : props . append ( int ( prop ) ) except : pass return string_from_regimen_props ( freq , props = props , suppress_errors = True )