oss-compass / compass-metrics-model

GNU Affero General Public License v3.0
14 stars 8 forks source link

Feat support custom weights and add custom fields for metrics models #41

Closed EdmondFrank closed 1 year ago

EdmondFrank commented 1 year ago

This pull request adds support for custom weights and custom fields to the MetricsModel class in compass_metrics_model/metrics_model.py. The new features allow users to provide their own weights for the various metrics calculated by the model, as well as custom fields that will be included in the resulting metrics data.

The changes include updating the MetricsModel constructor to accept additional parameters for weights and custom fields, as well as adding logic to handle the new parameters throughout the MetricsModel subclasses. Additionally, a new function get_dict_hash() was added to calculate the MD5 hash of a dictionary, which is used to assign a unique identifier to each set of weights or custom fields provided.

The changes are expected to improve the flexibility and usability of the MetricsModel class, allowing users to tailor the model to their specific needs.