Streaming Endpoints for VA-Spec Annotations #574
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the endpoints in
score_sets.pythat return annotated variant data for a score set. Instead of returning the entire result as a single JSON object, these endpoints now stream results as newline-delimited JSON (NDJSON), improving performance and scalability for large datasets. The implementation introduces a reusable streaming generator and updates endpoint documentation, response headers, and eager loading of related data.Streaming and API Response Refactor:
_stream_generated_annotations, a generator function that streams annotation results as NDJSON, including progress logging and summary information. This function is now used by all three annotation endpoints. (F51675eeR479)/annotated-variants/pathogenicity-evidence-line,/functional-impact-statement,/functional-study-result) to return aStreamingResponsewith NDJSON instead of a single JSON object, and added appropriate response headers for metadata and CORS. (F51675eeR568, F51675eeR681, F51675eeR792, F51675eeR874)Query and Performance Improvements:
.joinand.optionswithcontains_eagerandselectinloadfor more efficient eager loading of related data (e.g., publications, users, licenses, experiments). (F51675eeR624, F51675eeR735, F51675eeR850)Documentation and Typing:
TypedDictresponse types for each annotation stream to clarify response structure. (F51675eeR479, F51675eeR648, F51675eeR759)Code Clean-up and Import Sorting: