(export_item)
return {
        "type": "expression",
        "column_id": get_column_name(export_item.readable_path, add_hash=False),
        "display_name": export_item.readable_path,
        "datatype": export_item.datatype or 'string',
        "expression": inner_expression,
    }
Converts an ExportItem (from exports module) to a UCR indicator definition.
    :param export_item:
    :return: a dict ready to be inserted into a UCR data source
Converts an ExportItem (from exports module) to a UCR indicator definition.
    :param export_item:
    :return: a dict ready to be inserted into a UCR data source
Converts an ExportItem ( from exports module ) to a UCR indicator definition . : param export_item : : return : a dict ready to be inserted into a UCR data source
def _export_item_to_ucr_indicator(export_item):
    """
    Converts an ExportItem (from exports module) to a UCR indicator definition.
    :param export_item:
    :return: a dict ready to be inserted into a UCR data source
    """
    if isinstance(export_item, CaseIndexItem):
        # dereference indices
        inner_expression = {
            "type": "nested",
            # this pulls out the entire CommCareCaseIndex object
            "argument_expression": {
                "type": "array_index",
                "array_expression": {
                    # filter indices down to those with the correct case type
                    "type": "filter_items",
                    "items_expression": {
                        "type": "property_name",
                        "property_name": "indices"
                    },
                    "filter_expression": {
                        "type": "boolean_expression",
                        "expression": {
                            "type": "property_name",
                            "property_name": "referenced_type"
                        },
                        "operator": "eq",
                        "property_value": export_item.case_type
                    }
                },
                # return the first (assumes only 0 or 1)
                "index_expression": {
                    "type": "constant",
                    "constant": 0
                }
            },
            # this pulls out the referenced case ID from the object
            "value_expression": {
                "type": "property_name",
                "property_name": "referenced_id"
            }
        }
    else:
        inner_expression = {
            "type": "property_path",
            'property_path': [p.name for p in export_item.path],
        }
    return {
        "type": "expression",
        "column_id": get_column_name(export_item.readable_path, add_hash=False),
        "display_name": export_item.readable_path,
        "datatype": export_item.datatype or 'string',
        "expression": inner_expression,
    }
def _export_item_to_ucr_indicator ( export_item ) : if isinstance ( export_item , CaseIndexItem ) : # dereference indices inner_expression = { "type" : "nested" , # this pulls out the entire CommCareCaseIndex object "argument_expression" : { "type" : "array_index" , "array_expression" : { # filter indices down to those with the correct case type "type" : "filter_items" , "items_expression" : { "type" : "property_name" , "property_name" : "indices" } , "filter_expression" : { "type" : "boolean_expression" , "expression" : { "type" : "property_name" , "property_name" : "referenced_type" } , "operator" : "eq" , "property_value" : export_item . case_type } } , # return the first (assumes only 0 or 1) "index_expression" : { "type" : "constant" , "constant" : 0 } } , # this pulls out the referenced case ID from the object "value_expression" : { "type" : "property_name" , "property_name" : "referenced_id" } } else : inner_expression = { "type" : "property_path" , 'property_path' : [ p . name for p in export_item . path ] , } return { "type" : "expression" , "column_id" : get_column_name ( export_item . readable_path , add_hash = False ) , "display_name" : export_item . readable_path , "datatype" : export_item . datatype or 'string' , "expression" : inner_expression , }