@staticmethod
def _order_mapping(alterations):
    """Creates mapping of alterations to consecutive numeric values.

        Format: {type}_{value} --> {index}. Used when pivoting matrix, to ensure
        priority is followed when converting from long format to matrix.
        """
    order_mapping, colors = {}, []
    for data_type, val_order in alterations:
        for val, color in val_order:
            key = data_type + '_' + val
            order_mapping[key] = len(order_mapping)
            colors.append(color)
    return order_mapping, colors
