def unique_proportion(_metrics):
    """Computes the proportion of unique non-null values out of all non-null values"""
    total_values = _metrics.get("table.row_count")
    unique_values = _metrics.get("column.distinct_values.count")
    null_count = _metrics.get("column_values.nonnull.unexpected_count")

    # Ensuring that we do not divide by 0, returning 0 if all values are nulls (we only consider non-nulls unique values)
    if total_values > 0 and total_values != null_count:
        return unique_values / (total_values - null_count)
    else:
        return 0