Skip to content

Implement MPI client functions for new schema #10

@ericbuckley

Description

@ericbuckley

Summary

Add the get_block_data and insert_matched_patient functions to a new module, data_access.py for the new schema.

Acceptance Criteria

  • Implementations of the above functions
  • Unit tests for the above functions to show it works as expected

Details / Tasks

No need to use the existing function signatures for the reimplementation, as there are some readability issues with passing nested lists; going forward, use these signatures

def get_block_data(
    session: orm.Session, 
    data: typing.Dict,
    algo_config: typing.List[typing.Dict],
) -> typing.List[Patient]:
    pass

def insert_matched_patient(
    session: orm.Session,
    data: typing.Dict,
    algo_config: typing.List[typing.Dict],
    person_id: typing.Optional[int],
    external_person_id: typing.Optional[str],
    commit: bool = True,
) -> Patient:
    pass

Notes / Comments

When inserting a patient, abstract the functions necessary for creating the patient row along with creating new blocking keys. Its likely with this design that we'll need a way to generate new blocking keys when an algorithm changes, so keeping that functionality separate will open doors for future expansion.

Metadata

Metadata

Assignees

Labels

apiNew API feature

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions