Skip to content

remove kwargs from AlgorithmPass #223

@ericbuckley

Description

@ericbuckley

Summary

Remove the AlgorithmPass.kwargs field and replace it with specific fields for fuzzy matching and log odds parameters.

Acceptance Criteria

  • Add log_odds to Algorithm in schema/algorithm.py and models/algorithm.py
  • Add fuzzy_match_threshold to Algorithm in schema/algorithm.py and models/algorithm.py
  • Add fuzzy_match_measure to Algorithm in schema/algorithm.py and models/algorithm.py
  • Add optional fuzzy_match_threshold to AlgorithmPass.evaluators in schema/algorithm.py and models/algorithm.py
  • Add optional fuzzy_match_measure to AlgorithmPass.evaluators in schema/algorithm.py and models/algorithm.py
  • Add true_match_threshold to AlgorithmPass in schema/algorithm.py and models/algorithm.py
  • Update logic in matchers.py to use the new values created above
  • Remove kwargs from AlgorithmPass in schema/algorithm.py and models/algorithm.py
  • Add validation that log_odds are valid features and values are greater than 0
  • Add validation to evaluators to verify that log_odds feature is available before use
  • Add validation to blocking keys to verify that log_odds feature is available before use
  • [] Add validation that fuzzy_match_threshold is between 0 and 1
  • [] Add validation that fuzzy_match_measure is valid
  • All "defaults" options are optional and come with system defaults
  • Add validation that true_match_threshold is less than the sum of the evaluator field log odds
  • Add good descriptive docstrings to describe the new values in the API docs
  • Remove kwargs information from site/reference.md
  • Test cases for all of the above

Details / Tasks

Use the snippet below as a basis for the additions that should be made to account for the deletion of the kwargs attribute. Note, specific require Algorithm/AlgorithmPass attributes have been omitted and replaced with ... as to highlight the additions that are being made.

    {
        ...
        "log_odds": [
            {"feature": "ADDRESS", "value": 8.4},
            ...
        ],
        "defaults": {
          "fuzzy_match_threshold": 0.9,
          "fuzzy_match_measure": "JaroWinkler"
        },
        "passes": [
            {
                ...
                "evaluators": [
                    {
                        "feature": "FIRST_NAME",
                        "func": "func:recordlinker.linking.matchers.compare_probabilistic_fuzzy_match"
                    },
                    {
                        "feature": "LAST_NAME",
                        "func": "func:recordlinker.linking.matchers.compare_probabilistic_fuzzy_match",
                        "fuzzy_match_threshold": 0.95, // [OPTIONAL]
                        "fuzzy_match_measure": "Levenshtein" // [OPTIONAL]
                    }
                ],
                "true_match_threshold": 12.2
            }
        ]
    }

Background / Context

kwargs is too vague and doesn't allow for the validation that we'd like when parsing changes to an Algorithm. Creating independent fields for the values we are trying to capture allows for those changes.

Notes / Comments

This will be a breaking change, and will need to be documented in our release notes accordingly. Specifically, we'll need to state that the algorithm and algorithm pass tables need to be deleted before upgrading to this release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiNew API feature
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions