def _create_data_schema_map()

in getting_started/utils/lookout_equipment_utils.py [0:0]


def _create_data_schema_map(component_fields_map: Dict):
    """
    Generate a dictionary with the JSON format expected by Lookout for Equipment
    to be used as the schema for a dataset at ingestion, training time and
    inference time
    
    PARAMS
    ======
        component_fields_map: dict
            A dictionary containing a field maps for the dataset schema

    RETURNS
    =======
        data_schema: dict
            A dictionnary containing the detailed schema built from the original
            dictionary mapping
    """
    # The root of the schema is a "Components" tag:
    data_schema = dict()
    component_schema_list = list()
    data_schema['Components'] = component_schema_list

    # We then loop through each first level tag from the dictionary:
    for component_name in component_fields_map:
        # We create a schema for the current component:
        component_schema = _create_component_schema(
            component_name, 
            component_fields_map[component_name]
        )
        
        # And update the overall dictionary:
        component_schema_list.append(component_schema)

    return data_schema