How mdwiki-td/tdc works
Project Type and Purpose
• TDC is a web-based platform built to support coordinators in managing translation projects for WikiProject Medicine. It integrates a variety of tools for tracking translation progress, managing user data, and administrating different translation-related components.
• The system is implemented in PHP and is structured as a collection of modules that handle tasks like retrieving recent translations, updating user or QID information, adding new pages, and managing campaign data.
Analyzing the File Structure
• Key top-level directories include:
• Tables: Contains SQL-related files (e.g., sql_tables.php, tables.php, langcode.php) that likely define the database schema or utility functions for running SQL queries.
• actions: Holds several PHP files (e.g., mdwiki_sql.php) that serve as intermediaries between the application logic and the database. These files encapsulate SQL queries for reading (SELECT) and writing (INSERT/UPDATE/DELETE) data.
• api_or_sql: Contains endpoints (such as index.php, process_data.php, recent_data.php) that provide API access to underlying SQL operations.
• auth: Manages authentication, which will involve SQL SELECT queries (to verify user credentials) and possibly SQL WRITE operations (to update user data or track login activity).
• coordinator: Has extensive subdirectories (admin, tools, etc.) for specific functional modules – for campaigns, emails, QIDs, settings, and more. Each module here is intended for both administrative oversight and data manipulation, indicating SQL query use both for SELECT (to retrieve current settings, lists, and reports) and WRITE actions (to add or update records).
• Configuration and workflow files (GitHub actions, .yaml files) support CI/CD but do not directly impact SQL operations.
Specific Tools/Modules Using SQL SELECT and SQL WRITE
• Tables Module:
• Tables/sql_tables.php and Tables/tables.php: These likely include the definitions and possibly even the execution of SQL commands to create or reference tables. Although not a typical “tool” in runtime, they directly set up the structure upon which SQL SELECT/WRITE commands operate.
• Actions Module:
• actions/mdwiki_sql.php: This file appears dedicated to handling SQL operations concerning wiki-related translation data. Expect it to handle SELECT queries when retrieving translation records (for display in reports) and WRITE operations when inserting or updating translation statuses.
• Other files in the actions folder (like html.php, html_side1.php, and functions.php) may also call SQL operations indirectly through common utility functions.
• API or SQL Module:
• api_or_sql/index.php, process_data.php, and recent_data.php: These endpoints function as the application’s API layer for SQL operations.
° recent_data.php is interpreted as a module primarily executing SQL SELECT queries to return the latest translation information.
° process_data.php is likely used to perform SQL WRITE operations—for example, inserting or updating translation records based on user actions or automated processes.
° include.php serves as the common inclusion tool to facilitate SQL operations in these files.
• Auth Module:
• auth/index.php and related files (config.php, user_infos.php): Upon authentication, these are expected to run SQL SELECT queries (to validate user credentials and fetch profile data) as well as SQL WRITE queries (to update last login timestamps or user activity logs).
• Coordinator Modules (Admin & Tools):
• The coordinator folder comprises several admin and tool submodules such as:
° Admin/Campaigns (index.php, post.php): Use SQL SELECT to list current campaigns and SQL WRITE for inserting or modifying campaign details.
° Admin/Emails (index.php, edit_user.php, post.php, sugust.php): Perform SQL SELECT to present current email lists, and SQL WRITE to update or add new email data.
° Admin/Qids and Qids_Others (index.php, post.php, edit_qid.php): Retrieve existing QID assignments via SELECT and update them via WRITE.
° Admin/Add (index.php, post.php): Facilitates adding new translation pages where it uses SQL WRITE to save new page entries, while likely also using SELECT to confirm data.
° Admin/Settings (index.php, post.php): Reads current settings using SELECT queries and updates configuration parameters via SQL WRITE.
° Additional modules (full_translators, translated, tt, wikirefs_options) similarly rely on a combination of SQL SELECT (to populate UI lists and reports) and SQL WRITE (for new entries or modifications).
a. Main Components to Represent:
• Frontend/UI Components:
• User pages including coordinators’ dashboards, admin panels, and login pages.
• Backend/API Layer:
• Actions and api_or_sql endpoints where the core business logic runs.
• Auth module for authentication.
• Administrative Modules:
• All coordinator/admin sub-modules (Campaigns, Emails, QIDs, etc.) which interface with the frontend UI.
• Database:
b. Relationships and Interactions:
• WRITE operations (e.g., in process_data.php, admin/post.php files) with “SQL WRITE.”
• Auth and Admin modules similarly to the Database, indicating different flows for data retrieval and updates.
c. Architectural Patterns:
• Modules that conform to RESTful API principles (particularly in the api_or_sql and actions directories) and note any MVC-like partitioning in the coordinator modules.
d. Technologies and Frameworks:
• PHP is the primary language used.
• Although not explicitly detailed, the use of GitHub actions implies CI/CD integration.
• If any SQL abstraction libraries or frameworks are present (check auth/vendor_load.php for potential composer dependencies), note their role in mediating SQL operations.
Final Remarks
• Don’t hesitate to add brief text annotations or legends that clarify the technical choices and the flow of data, which is especially useful for modules in the admin area.