-
Notifications
You must be signed in to change notification settings - Fork 11
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
[C4GT Community]: Implement a repository pattern using sqlite storage for GeolocationQueryService #26
Comments
- Refactors codebase in order to implement requirements for #26 - Restructures some of the dependencies to maintain project structure around domain driven design independent of the framework.
@codecakes is this open and requier's issue #12 to be solved first ? , i would like to contribute to the issue , any deadlines or other info i need to know |
@RISHIKESHk07 Short answer: No. All issues are independent. Go ahead with the PR. Refer to PR #42 to understand what files you would be leveraging upon in order to do this. |
@codecakes did try running |
@codecakes do i install without |
@RISHIKESHk07 The setup has been simplified. See Contributing; Let me know if this worked for you. Brownie point if you raise a PR that fixes this setup instruction in the |
Implements database configuration for sqlite repo in issue #26 by: - Implementing configure_database_session(services, settings) and on_start - Adding support libraries to `pyproject.toml`
…rface and sqlite implementation (#66) Prepares testing support for #26 - adds support for test markers - `make test` works. added test-integration marker and is currently WIP. - refactored unit tests to have dummy functions move to conftest. fix their type annotaitons. added e2e api testing support in start_server and conftest. added unit test configuration setup in pyproject.
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
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
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 --> ## 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. <!-- Generated by sourcery-ai[bot]: end summary --> --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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>
Ticket Contents
Description
Issue #12 covers a high complexity objective to implement
/geo
api endpoint. In order to list facilities, implement a repository to be consumed from GeolocationQueryService.Background:
The project has 3 primary levels:
The project src directory contains the following:
The GeolocationQueryService is an application service consumed by the web api route
geo
. See here.The service needs to query the storage layer via a storage repository. This repository is called by the patient query look up service which is a callable and it calls the repository passing relevant parameters available in the set of:
[Address, LocationQueryJSON, List[FacilitiesResult]]
which are defined indto.py
.In the repository pattern, extend
IProviderStore
interface indomain/models/provider.py
and implement a provider store with implementation in sqlite to allow GeolocationQueryService to fetch healthcare providers in a storage -agnostic manner.See You Wanted Banana and API First design for motivation
Goals
Goals
Expected Outcome
Acceptance Criteria
repository.py
under apps/ moduleImplementation Details
The repository’s role is to handle the persistence of aggregates.
Refer to
dto.py
andprovider.py
in order to understand the flow as described here.The Repository receives aggregate as input parameters so first think and map the necessary DTOs to aggregate. The caller service transforms DTO to aggregates.
The repository takes in and preprocesses
query_id
,cust_id
in addition to geo location coordinates in order to call sqlite db and return a list of records, the return schema for which is defined in #12 ; The repository takes in the aggregateProvider
inprovider.py
and performs a geo-query to filter all records that are within 50 kms of the patient's coordinates.Query against the following tentative table attributes from the repository:
Expected return value
For each query_id and cust_id, filter down the coordinates lat and lng and return the data. Ignore the missing attributes from the attribute column that you cannot find. Let the missing return parameters be optional while maintaining strong consistency with the JSON Type format per attribute.
Mockups/Wireframes
Product Name
project-healthcare
Organisation Name
XCoV19
Domain
Healthcare
Tech Skills Needed
Database, Debugging, Flask, Python, SQL, Test, Testing Library
Mentor(s)
@codecakes
Complexity
High
Category
Backend, Database, Refactoring, Testing
The text was updated successfully, but these errors were encountered: