How mribrahem/publish_py works
This is a Flask application providing translation-support tools for mdwiki. Its principal workflow accepts a ContentTranslation publish request, validates and formats it, refines the wikitext, publishes it to Wikipedia, and can link the result to Wikidata while recording publish data. Other substantial capabilities include OAuth login and token management, CX token retrieval, reference repair, reporting APIs, and coordinator/admin tools. The graph reflects documented behavior and shown call relationships; less-sampled feature wiring is left unasserted.
Main entry points: worker.py Publish processing · token_manager.py Token lifecycle · pages_query_service.py Page queries · routes.py Publish endpoint
Components 24
Web entrypoints
- Flask application
src/main_app/__init__.py - Translation results
src/main_app/public/routes/td/results_2026
Translation publishing
- Publish endpoint
src/main_app/public/routes/publish/routes.py - Publish processing
src/main_app/public/routes/publish/worker.py - Publish records
src/main_app/public/routes/publish/to_db.py - MediaWiki API
src/main_app/services/clients/oauth_client.py - Reference repair
src/main_app/public/routes/refs/routes.py - Text API client
src/main_app/services/clients/text_api.py - HTML processing
src/main_app/services/new_html_services
Identity and tokens
- OAuth routes
src/main_app/public/auth/routes.py - OAuth flow
src/main_app/services/auth/flow.py - Token lifecycle
src/main_app/services/auth/token_manager.py - CX token endpoint
src/main_app/public/routes/cxtoken/routes.py
Data and reporting
- User token service
src/main_app/database/services/users/user_token_service.py - Application database
src/main_app/extensions/data_base.py - Domain records
src/main_app/database/models/pages.py - Reporting API
src/main_app/public/routes/api/routes.py - Top statistics
src/main_app/public/routes/api/top_stats_routes.py - Page queries
src/main_app/database/services/pages/pages_query_service.py
Operations tools
- Coordinator tools
src/main_app/coordinators/routes - Admin tools
src/main_app/admin
Other components
- Tool user
- Wikipedia
- Wikidata
Connections 24
- Tool user → Publish endpoint: submits content
README.md - Publish endpoint → Publish processing: processes edit
src/main_app/public/routes/publish/routes.py - Publish processing → Publish records: records result
src/main_app/public/routes/publish/worker.py - Publish processing → MediaWiki API: uses API client
src/main_app/public/routes/publish/worker.py - MediaWiki API → Wikipedia: publishes edits
README.md - Publish processing → Wikidata: links articles
README.md - Tool user → Reference repair: requests repairs
- Reference repair → Text API client: uses client
src/main_app/public/routes/refs/routes.py - Tool user → OAuth routes: starts login
src/main_app/public/auth/routes.py - OAuth routes → OAuth flow: delegates OAuth
src/main_app/public/auth/routes.py - OAuth flow → Token lifecycle: manages credentials
- Token lifecycle → User token service: reads and writes
src/main_app/services/auth/token_manager.py - Token lifecycle → Application database: persists tokens
- Tool user → CX token endpoint: requests CX token
README.md - CX token endpoint → User token service: looks up credentials
src/main_app/public/routes/cxtoken/routes.py - Tool user → Reporting API: requests reports
- Reporting API → Top statistics: routes statistics
src/main_app/public/routes/api/routes.py - Top statistics → Page queries: queries statistics
- Page queries → Domain records: queries records
src/main_app/database/services/pages/pages_query_service.py - Page queries → Application database: reads data
src/main_app/database/services/pages/pages_query_service.py - Tool user → Coordinator tools: manages translations
- Tool user → Admin tools: administers tools
- Tool user → Translation results: views results
- Tool user → HTML processing: requests HTML