Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove kwargs from AlgorithmPass #223

Open
16 tasks
ericbuckley opened this issue Feb 21, 2025 · 0 comments
Open
16 tasks

remove kwargs from AlgorithmPass #223

ericbuckley opened this issue Feb 21, 2025 · 0 comments
Labels
feature New feature or request
Milestone

Comments

@ericbuckley
Copy link
Collaborator

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 that fuzzy_match_threshold is between 0 and 1
  • Add validation that fuzzy_match_measure is valid
  • 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},
            ...
        ],
        "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.

@ericbuckley ericbuckley added this to the v25.4.0 milestone Feb 21, 2025
@ericbuckley ericbuckley added the feature New feature or request label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant