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

Refactor splitter.py, add helper functions, ready for FMTM integration #14

Merged
merged 16 commits into from
Dec 2, 2023

Conversation

spwoodcock
Copy link
Member

Fixes #1 Fixes #3

I significantly refactored to fix up a few things:

  • DB session handling, uses existing session from fastapi, or a single new session.
  • DB url is configurable (we can pass in the FMTM DB).
  • Added the database models to this repo. I made it so that the tables are created by this repo, splitting done, then tables deleted again. This way we don't need the table models in FMTM either, simplifying the codebase.
  • Init the AOI as a geodataframe within the class init (puts the validation in one place).
  • More flexible input types, particularly for geojson (can be geojson string, FeatureCollection type, or a geojson file on the filesystem).
  • Testing for all split types.
    (I think that was it!)

I also added helper functions for the three splitting types, for more flexible usage.
They are called by the CLI and can be imported for use in say FMTM.

@spwoodcock spwoodcock self-assigned this Dec 2, 2023
@github-actions github-actions bot added docs Improvements or additions to documentation dependency Includes a dependency change devops labels Dec 2, 2023
@spwoodcock
Copy link
Member Author

Note to self: I also need to update the CI workflow to use test_compose instead now as this needs an underlying db.

@robsavoye robsavoye merged commit 8ed9ef0 into main Dec 2, 2023
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Includes a dependency change devops docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to specify building count on the command line Make database connection configurable
2 participants