(requests, attr_id, value_source_config, case_trigger_info)
return value, case_update
Returns the value of ``value_source_config``, or a generated value
    returned by DHIS2, and a case update if the generated value should
    be saved in a case property.
Returns the value of ``value_source_config``, or a generated value
    returned by DHIS2, and a case update if the generated value should
    be saved in a case property.
Returns the value of value_source_config or a generated value returned by DHIS2 and a case update if the generated value should be saved in a case property .
def get_or_generate_value(requests, attr_id, value_source_config, case_trigger_info):
    """
    Returns the value of ``value_source_config``, or a generated value
    returned by DHIS2, and a case update if the generated value should
    be saved in a case property.
    """
    case_update = {}

    # Instead of adding DHIS2-specific properties to the ValueSource
    # class, pop them here first.
    # Is the attribute generated by DHIS2 (e.g. unique IDs)?
    is_generated = value_source_config.pop("is_generated", False)
    # A dictionary of GET param name: value_source pairs
    generator_params = value_source_config.pop("generator_params", {})

    value = get_value(value_source_config, case_trigger_info)
    if is_blank(value) and is_generated:
        value = generate_value(requests, attr_id, generator_params, case_trigger_info)
        if "case_property" in value_source_config:
            case_update[value_source_config["case_property"]] = value
    return value, case_update
def get_or_generate_value ( requests , attr_id , value_source_config , case_trigger_info ) : case_update = { } # Instead of adding DHIS2-specific properties to the ValueSource # class, pop them here first. # Is the attribute generated by DHIS2 (e.g. unique IDs)? is_generated = value_source_config . pop ( "is_generated" , False ) # A dictionary of GET param name: value_source pairs generator_params = value_source_config . pop ( "generator_params" , { } ) value = get_value ( value_source_config , case_trigger_info ) if is_blank ( value ) and is_generated : value = generate_value ( requests , attr_id , generator_params , case_trigger_info ) if "case_property" in value_source_config : case_update [ value_source_config [ "case_property" ] ] = value return value , case_update