How rcbtst/files-stats-service-test-app works
This is a FastAPI web application for discovering and downloading files from an external API, persisting their contents and digit counts, and presenting download status, files, and statistics. The main workflow starts through the downloads route: it creates a download record and schedules a background task, which retrieves files in batches, computes statistics, and updates local and remote downloaded markers. Separate routes render paginated file and statistics views. The graph follows documented and indexed references; unsampled templates and page routes are represented at their tree paths.
Main entry points: crud.py Database operations · __init__.py Route setup · downloads.py Download routes · files.py Files route
Components 17
Web interface
- FastAPI app
src/web_app/__init__.py - Route setup
src/web_app/routes/__init__.py - Download routes
src/web_app/routes/downloads.py - Files route
src/web_app/routes/files.py - Statistics route
src/web_app/routes/stats.py - Index route
src/web_app/routes/index.py - Query models
src/web_app/models - HTML templates
src/web_app/templates
Download processing
- Download task
src/web_app/tasks/downloads.py - Digit statistics
src/utils/stats.py
Persistence
- Database operations
src/database/crud.py - Data schema
src/database/schema.py - SQLite database
External integration
- Files API client
src/external_apis/files_api_client.py - Runtime settings
config.py
Other components
- Browser user
- External files API
Connections 29
- Browser user → Download routes: starts downloads
src/web_app/routes/downloads.py - Browser user → Files route: views files
src/web_app/routes/files.py - Browser user → Statistics route: views statistics
src/web_app/routes/stats.py - Browser user → Index route: opens page
- FastAPI app → Route setup: sets up routes
src/web_app/__init__.py - FastAPI app → Download task: starts task
src/web_app/__init__.py - Route setup → Download routes: registers route
src/web_app/routes/__init__.py - Route setup → Files route: registers route
src/web_app/routes/__init__.py - Route setup → Statistics route: registers route
src/web_app/routes/__init__.py - Route setup → Index route: registers route
src/web_app/routes/__init__.py - Download routes → Database operations: creates and reads
src/web_app/routes/downloads.py - Download routes → Download task: schedules task
src/web_app/routes/downloads.py - Files route → Database operations: reads files
src/web_app/routes/files.py - Files route → Query models: validates query
src/web_app/routes/files.py - Statistics route → Database operations: reads statistics
src/web_app/routes/stats.py - Statistics route → Query models: validates query
src/web_app/routes/stats.py - Download routes → HTML templates: renders status
src/web_app/routes/downloads.py - Files route → HTML templates: renders files
src/web_app/routes/files.py - Statistics route → HTML templates: renders statistics
src/web_app/routes/stats.py - Index route → HTML templates: renders page
src/web_app/routes/index.py - Download task → Database operations: reads and updates
src/web_app/tasks/downloads.py - Download task → Files API client: fetches and marks files
src/web_app/tasks/downloads.py - Download task → Digit statistics: calculates counts
src/web_app/tasks/downloads.py - Files API client → External files API: sends API requests
src/external_apis/files_api_client.py - Database operations → Data schema: queries models
src/database/crud.py - Database operations → SQLite database: reads and writes
src/database/crud.py - Data schema → SQLite database: defines tables
- Files API client → Runtime settings: uses settings
src/external_apis/files_api_client.py - Database operations → Runtime settings: database setup