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

WIP: Feature/fix infra spatialite #79

Merged
merged 35 commits into from
Sep 22, 2024
Merged

Conversation

codecakes
Copy link
Contributor

@codecakes codecakes commented Sep 22, 2024

Introduces changes to fix spatialite extension loading issue to support data fields in sqlachemy model type POINT. This change directly supports the work in #26

  • Fixes spatialite extension as loadable with the updated dockerfile setup and correct implementation using aiosqlite compatibility
  • Temporary disables integration test. The repository return type needs to be refactored and return type changed to list dto facilities results

Summary by Sourcery

Fix SpatiaLite extension loading issue to support spatial data fields in SQLAlchemy models. Introduce a new PointType for handling geopoint data. Refactor test database setup and temporarily disable integration tests pending refactoring. Update build scripts and Makefile for improved Docker handling.

New Features:

  • Introduce a new PointType class to handle geopoint data types in SQLAlchemy models, enabling support for spatial data fields like POINT.

Bug Fixes:

  • Fix the loading of the SpatiaLite extension in the database setup to support spatial data operations.

Enhancements:

  • Refactor the test database setup to use a new SetUpTestDatabase class, improving the management of test database lifecycle and session handling.

Build:

  • Update the Makefile to include a new set-docker target and modify the docker-run-server target to remove orphan containers.

Tests:

  • Temporarily disable integration tests due to the need for refactoring repository return types and changing return types to list DTO facilities results.

Chores:

  • Update the run.sh script to include additional logging for file listing and database removal.

codecakes and others added 30 commits August 13, 2024 02:20
…om blacksheep framework. most of these layers do not have to be tied to a framework's folder. any other framework can simply consume these layers as well
…heir type annotaitons. added e2e api testing support in start_server and conftest. added unit test configuration setup in pyproject. ignore any db files in project
…st-integration marker WIP. adds support for test markers
…app level infra setup using DI using rodi's Container that sets up database and session
…B. refactored code to use container to setup database using start_test_database and asyncSetUp. WIP: test_fetch_facilities
Unstable, active and WIP: This is where things start taking shape for setting test coverage
`GeoLocationServiceSqlRepoDBTest` to implement issue: #26 ;

- major rewrite of test services for integration test for Sqlite Repo
DB. refactored code to use container to setup database using
start_test_database and asyncSetUp. WIP: test_fetch_facilities
- added sqlite models to support sqlite database. database.py enhances
app level infra setup using DI using rodi's Container that sets up
database and session
@codecakes codecakes added this to the geolocation milestone Sep 22, 2024
@codecakes codecakes self-assigned this Sep 22, 2024
@codecakes codecakes marked this pull request as ready for review September 22, 2024 18:45
Copy link
Contributor

sourcery-ai bot commented Sep 22, 2024

Reviewer's Guide by Sourcery

This pull request introduces changes to fix the spatialite extension loading issue to support the POINT data type in SQLAlchemy models. The changes include updating the Dockerfile setup, implementing correct spatialite extension loading with aiosqlite compatibility, and temporarily disabling an integration test. The PR also adds new functionality to the Provider model and makes adjustments to related tests and configurations.

File-Level Changes

Change Details Files
Implement spatialite extension loading for SQLAlchemy
  • Add event listener to load spatialite extension on database connection
  • Implement async function to load spatialite extension
  • Add error handling and logging for spatialite loading
xcov19/app/database.py
Update Provider model and related infrastructure
  • Implement PointType class for handling geospatial data
  • Update Provider SQLModel with new fields including geopoint
  • Add pydantic validation for PointType
xcov19/infra/models.py
xcov19/domain/models/provider.py
Refactor and update test infrastructure
  • Create SetUpTestDatabase class for managing test database lifecycle
  • Update test fixtures and configurations
  • Temporarily disable integration test for GeoLocationServiceSqlRepoDBTest
xcov19/tests/start_server.py
xcov19/tests/test_services.py
Update build and run configurations
  • Modify Makefile to include new commands and environment variables
  • Update docker-compose.yml with new service name and build arguments
  • Add spatialite-related configurations to run script
Makefile
docker-compose.yml
run.sh

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @codecakes - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • UUID generation at import time may cause duplicate IDs (link)

Overall Comments:

  • Consider re-enabling the integration tests as soon as possible to ensure continued code quality and prevent regressions.
  • Ensure that the addition of the available_doctors field to the Provider model is reflected and handled appropriately throughout the codebase.
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 1 other issue
  • 🟢 Security: all looks good
  • 🟡 Review instructions: 1 issue found
  • 🟡 Testing: 2 issues found
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

xcov19/infra/models.py Outdated Show resolved Hide resolved
xcov19/infra/models.py Show resolved Hide resolved
xcov19/infra/models.py Outdated Show resolved Hide resolved
xcov19/tests/test_services.py Show resolved Hide resolved
xcov19/tests/data/seed_db.py Outdated Show resolved Hide resolved
xcov19/app/database.py Outdated Show resolved Hide resolved
codecakes and others added 2 commits September 23, 2024 00:20
change datatype to reflect column type

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Copy link

Copy link
Contributor Author

@codecakes codecakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sourcery-ai review

@codecakes codecakes merged commit 424f0e9 into main Sep 22, 2024
10 checks passed
@codecakes codecakes deleted the feature/fix-infra-spatialite branch September 22, 2024 19:19
codecakes added a commit that referenced this pull request Sep 22, 2024
Introduces changes to fix spatialite extension loading issue to support
data fields in sqlachemy model type `POINT`. This change directly
supports the work in #26
- Fixes spatialite extension as loadable with the updated dockerfile
setup and correct implementation using aiosqlite compatibility
- Temporary disables integration test. The repository return type needs
to be refactored and return type changed to list dto facilities results

<!-- Generated by sourcery-ai[bot]: start summary -->

Fix SpatiaLite extension loading issue to support spatial data fields in
SQLAlchemy models. Introduce a new `PointType` for handling geopoint
data. Refactor test database setup and temporarily disable integration
tests pending refactoring. Update build scripts and Makefile for
improved Docker handling.

New Features:
- Introduce a new `PointType` class to handle geopoint data types in
SQLAlchemy models, enabling support for spatial data fields like
`POINT`.

Bug Fixes:
- Fix the loading of the SpatiaLite extension in the database setup to
support spatial data operations.

Enhancements:
- Refactor the test database setup to use a new `SetUpTestDatabase`
class, improving the management of test database lifecycle and session
handling.

Build:
- Update the Makefile to include a new `set-docker` target and modify
the `docker-run-server` target to remove orphan containers.

Tests:
- Temporarily disable integration tests due to the need for refactoring
repository return types and changing return types to list DTO facilities
results.

Chores:
- Update the `run.sh` script to include additional logging for file
listing and database removal.

<!-- Generated by sourcery-ai[bot]: end summary -->

---------

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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