Skip to content

🏗️ Architect: Decouple Generic and EDC Endpoint Logic#674

Merged
fderuiter merged 5 commits intomainfrom
refactor/solid-endpoints-7525700562347723324
Feb 18, 2026
Merged

🏗️ Architect: Decouple Generic and EDC Endpoint Logic#674
fderuiter merged 5 commits intomainfrom
refactor/solid-endpoints-7525700562347723324

Conversation

@fderuiter
Copy link
Owner

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/studies base path and automatic studyKey injection).

Key changes:

  • Separation of Concerns: GenericEndpoint now handles pure endpoint logic, while EdcEndpointMixin encapsulates EDC specifics.
  • Explicit Dependencies: Endpoints like UsersEndpoint now inherit from EdcListGetEndpoint, making it clear they are EDC resources.
  • Open/Closed Principle: The SDK is now open to extension for non-EDC endpoints (by inheriting GenericEndpoint) without needing to modify the core base class or inherit unwanted EDC logic.
  • Backward Compatibility: BaseEndpoint and ListGetEndpoint (legacy names) are preserved and function as before, but are now composed of the new modular classes.
  • Circular Import Fix: Resolved a circular dependency chain between base.py and the mixins package.

All unit tests passed.


PR created automatically by Jules for task 7525700562347723324 started by @fderuiter

- 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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

fderuiter and others added 3 commits February 18, 2026 18:33
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>
@fderuiter
Copy link
Owner Author

This is failing.

▶ Run poetry run mypy imednet

@google-labs-jules
Copy link
Contributor

This is failing.

▶ Run poetry run mypy imednet

Acknowledged. I have fixed the mypy failure by updating the type hints in imednet/endpoints/registry.py to use GenericEndpoint instead of BaseEndpoint, aligning with the new class hierarchy.

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>
@fderuiter fderuiter marked this pull request as ready for review February 18, 2026 19:17
@fderuiter fderuiter merged commit 83a54f0 into main Feb 18, 2026
13 checks passed
@fderuiter fderuiter deleted the refactor/solid-endpoints-7525700562347723324 branch February 18, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments