-
Notifications
You must be signed in to change notification settings - Fork 3
Add Flask API routes for registry CLI commands #65
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
Add Flask API routes for registry CLI commands #65
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #65 +/- ##
==========================================
+ Coverage 63.83% 70.42% +6.59%
==========================================
Files 9 9
Lines 719 886 +167
==========================================
+ Hits 459 624 +165
- Misses 260 262 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a JSON/HTTP API layer to expose existing registry CLI workflows via Flask routes, while keeping the existing web UI database access read-only and performing API writes through a separate writable registry session.
Changes:
- Added helper utilities in
sample_registry/app.pyfor API request parsing, error responses, and sample table ingestion/validation. - Implemented multiple
POST /api/*endpoints that wrapSampleRegistrywrite operations and return JSON responses. - Added
check_sample_accession()validation helper inSampleRegistryfor sample-based API operations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| sample_registry/app.py | Adds API utilities, sets up writable registry context, and implements new /api/* write endpoints while keeping the UI DB connection read-only. |
| sample_registry/registrar.py | Adds check_sample_accession() to validate sample existence for modify flows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Description
sample_registry/app.py:api_registry()context manager to create a writableSampleRegistryfromSQLALCHEMY_WRITE_URI,api_request_data(),api_error(), andapi_sample_table_from_request()to parse/validateSampleTablepayloads.sample_registry/app.py:POST /api/register_run,POST /api/register_illumina_file,POST /api/register_samples,POST /api/register_annotations,POST /api/unregister_samples,POST /api/modify_run,POST /api/modify_sample, andPOST /api/modify_annotation, each using the writable registry and returning JSON success/error responses.SQLALCHEMY_DATABASE_URIwith?mode=rowhile storing the original URI inSQLALCHEMY_WRITE_URIfor API writes.check_sample_accessiontosample_registry/registrar.pyto validate sample existence (used by several new API routes), and importedSampleTable,SampleRegistry, andIlluminaFastqwhere needed.Testing
Codex Task