🏗️ Architect: Decouple Generic and EDC Endpoint Logic#674
Conversation
- Extract `EdcEndpointMixin` to `imednet/core/endpoint/edc_mixin.py` to decouple EDC-specific logic from the base endpoint. - Introduce `GenericEndpoint` in `imednet/core/endpoint/base.py` for pure HTTP/Context handling without EDC assumptions. - Maintain `BaseEndpoint` as a legacy composite of `GenericEndpoint` and `EdcEndpointMixin` for backward compatibility. - Create explicit `GenericListEndpoint`, `EdcListEndpoint`, and corresponding `Get/PathGet` variants in `imednet/core/endpoint/mixins/bases.py`. - Update all resource endpoints (e.g., `UsersEndpoint`, `RecordsEndpoint`) to explicitly inherit from `Edc*` base classes, clarifying their dependency on the EDC domain. - Fix circular import issues by placing `EdcEndpointMixin` outside the `mixins` package. - Update test fixtures in `tests/conftest.py` to correctly patch `Paginator` on the new `GenericListEndpoint`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Apply black formatting to resolve CI check failure. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Remove unused `BaseEndpoint` import from `imednet/core/endpoint/mixins/bases.py`. - Fix import sorting in `tests/integration/test_airflow_dag.py`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Run isort manually to fix import ordering in tests/integration/test_airflow_dag.py. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
This is failing. ▶ Run poetry run mypy imednet |
Acknowledged. I have fixed the mypy failure by updating the type hints in |
Update ENDPOINT_REGISTRY type hint to use GenericEndpoint instead of BaseEndpoint. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This PR refactors the SDK's endpoint architecture to adhere to SOLID principles. It decouples the generic HTTP/Context management from the specific logic required for iMednet EDC resources (like the
/api/v1/edc/studiesbase path and automaticstudyKeyinjection).Key changes:
GenericEndpointnow handles pure endpoint logic, whileEdcEndpointMixinencapsulates EDC specifics.UsersEndpointnow inherit fromEdcListGetEndpoint, making it clear they are EDC resources.GenericEndpoint) without needing to modify the core base class or inherit unwanted EDC logic.BaseEndpointandListGetEndpoint(legacy names) are preserved and function as before, but are now composed of the new modular classes.base.pyand themixinspackage.All unit tests passed.
PR created automatically by Jules for task 7525700562347723324 started by @fderuiter