How apdn7/analysisplatform works
Main components
• User’s Browser (UI Layer)
– Static assets (CSS/JS under ap/static)
– HTML templates (Jinja2 under ap/templates)
– Third-party JS libs (Plotly, D3, Sigma.js, jQuery, etc.)
• Web Server (Flask App)
– Entry point: main.py, config.py, startup scripts
– Blueprint modules:
• ap/api/*: REST controllers + services supplying JSON endpoints for each visualization (aggregate_plot, analyze, heatmap, etc.)
• ap/[aggregate_plot|analyze|…]/*: server-side controllers & business logic for rendering pages and data processing
• ap/common: shared utilities (DB connectors in pydn/dblib, caching, logging, scheduling, SSE, error handling)
• ap/etl: pull & transform pipelines for data ingestion
• ap/script: one-off scripts (migration, setup, R-process calls, etc.)
• ap/setting_module: configuration UIs & services, backup/restore jobs
• background jobs scheduler (ap/common/jobs + ap/common/scheduler)
• translations (ap/translations) for i18n
• Database Layer
– Local SQLite instance (init/app.sqlite3) or external DBs via pydn/dblib (MySQL, PostgreSQL, SQL Server, Oracle, Snowflake)
– Schema migrations via Alembic (migrations/)
• External Services
– Factory data sources: CSV/TSV files, external databases
– Oracle Instant Client (optional), network-accessible DB servers
• Background/Batch Layer
– Scheduled ETL jobs (ap/etl invoked by scheduler)
– Long-running tasks (backup/restore, polling frequency)
• Configuration/Deployment
– startup.ini, basic_config.yml, tile_interface_analysis_platform.yml, other tile_interface configs
– start_ap.bat / start_ap.py: installer & embeddable Python bootstrap
Relationships and data flows
– Browser → HTTP GET/POST → Flask controllers (ap/api & ap/*/controllers)
– Controllers → Business services (ap/api/*/services.py, ap/*/services)
– Services → Common utilities and DB connectors (ap/common, pydn/dblib)
– DB connectors → Database (SQLite or remote)
– Responses → JSON or rendered HTML → Browser (JS charts consumed by static assets)
– Scheduler → ETL pipelines → Database
– Scripts (ap/script) → one-time DB or config migrations
Architectural patterns
– Layered MVC-style:
• Controllers (request routing)
• Services (business logic)
• Data access (common/db layer)
– Modular “plugin” structure per visualization type under both ap/api and ap/
– Shared ‘common’ library for cross-cutting concerns (caching, logging, errors)
– Background job scheduling decoupled from request cycle
– Configuration-driven UI (tile interfaces defined in YAML + templates)
Relevant technologies
– Python 3.6+ with Flask & Jinja2
– Alembic for migrations
– pydn/dblib for multi-DB support
– JavaScript: Plotly, D3, Sigma.js, jQuery, Select2, etc.
– CSS frameworks & custom styles for each plot
– SSE for real-time updates