# sri-sun-ray/stcas_qcchecklist architecture

> Architecture diagram of the GitHub repository sri-sun-ray/stcas_qcchecklist, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sri-sun-ray/stcas_qcchecklist
- Repository: https://github.com/sri-sun-ray/stcas_qcchecklist

## Overview

This is a PHP/MySQL station-inspection checklist and report application. Users enter station details and record checklist observations, statuses, remarks, and images; the application stores and retrieves that data, then generates and lists reports. It also supports editable checklist templates and user administration. The sampled code confirms direct database access and a few browser-to-endpoint calls; several endpoints and most JavaScript are unsampled, so unverified connections are omitted.

Main entry points: [`script.js`](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/script.js) (Checklist interface), [`generateReport.php`](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/generateReport.php) (Report generation), [`fetch_observations.php`](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/fetch_observations.php) (Observation retrieval), [`save_observation.php`](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/save_observation.php) (Observation save)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Checklist workflow"]
  node_browser["Checklist interface<br/>[script.js]"]
  node_alternate_ui["Alternate interface<br/>[script_new.js]"]
  node_section_handlers["Section handlers<br/>[section2_0.php]"]
  node_section12["Section 12 handler<br/>[section12_0.php]"]
  node_section13["Section 13 handler<br/>[section13_0.php]"]
  node_observations["Observation retrieval"]
  node_observation_save["Observation save"]
  node_observation_update["Observation update"]
  node_image_upload["Image upload<br/>[upload.php]"]
end

subgraph group_reports["Reports"]
  node_report_generation["Report generation<br/>[generateReport.php]"]
  node_report_listing["Report listing<br/>[viewReports.php]"]
  node_report_data["Report retrieval<br/>[getReportById.php]"]
  node_report_upload["Report upload<br/>[uploadReport.php]"]
end

subgraph group_admin["Administration"]
  node_templates["Row templates"]
  node_login["Login<br/>[login.php]"]
  node_user_admin["User administration<br/>[view_users.php]"]
end

subgraph group_storage["Persistence"]
  node_database[("Station database")]
  node_uploads["Uploaded files"]
end

node_user(("Checklist user"))

node_user -->|"enters checklist"| node_browser
node_browser -->|"requests report"| node_report_generation
node_browser -->|"uploads images"| node_image_upload
node_alternate_ui -->|"uploads spreadsheet"| node_uploads
node_observations -->|"reads observations"| node_database
node_observations -->|"reads image paths"| node_database
node_observation_save -->|"writes observations"| node_database
node_observation_save -->|"stores image"| node_uploads
node_observation_update -.->|"updates observations"| node_database
node_section12 -->|"writes observations"| node_database
node_section13 -->|"writes observations"| node_database
node_report_generation -->|"reads checklist data"| node_database
node_report_generation -->|"checks images"| node_uploads
node_report_listing -->|"reads reports"| node_database
node_report_data -->|"reads report"| node_database
node_report_upload -.->|"stores report metadata"| node_database
node_templates -->|"manages templates"| node_database
node_login -.->|"checks credentials"| node_database
node_user_admin -.->|"manages users"| node_database

click node_browser "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/script.js"
click node_alternate_ui "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/script_new.js"
click node_section_handlers "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/section2_0.php"
click node_section12 "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/section12_0.php"
click node_section13 "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/section13_0.php"
click node_observations "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/fetch_observations.php"
click node_observation_save "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/save_observation.php"
click node_observation_update "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/updateObservations.php"
click node_image_upload "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/upload.php"
click node_report_generation "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/generateReport.php"
click node_report_listing "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/viewReports.php"
click node_report_data "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/getReportById.php"
click node_report_upload "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/uploadReport.php"
click node_templates "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/manage_row_templates.php"
click node_login "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/login.php"
click node_user_admin "https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/view_users.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_alternate_ui,node_section_handlers,node_section12,node_section13,node_observations,node_observation_save,node_observation_update,node_image_upload,node_user toneBlue
class node_report_generation,node_report_listing,node_report_data,node_report_upload toneAmber
class node_templates,node_login,node_user_admin toneMint
class node_database,node_uploads toneRose
```

## Components

### Checklist workflow

- [Checklist interface](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/script.js): `script.js`
- [Alternate interface](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/script_new.js): `script_new.js`
- [Section handlers](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/section2_0.php): `section2_0.php`
- [Section 12 handler](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/section12_0.php): `section12_0.php`
- [Section 13 handler](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/section13_0.php): `section13_0.php`
- [Observation retrieval](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/fetch_observations.php): `fetch_observations.php`
- [Observation save](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/save_observation.php): `save_observation.php`
- [Observation update](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/updateObservations.php): `updateObservations.php`
- [Image upload](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/upload.php): `upload.php`

### Reports

- [Report generation](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/generateReport.php): `generateReport.php`
- [Report listing](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/viewReports.php): `viewReports.php`
- [Report retrieval](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/getReportById.php): `getReportById.php`
- [Report upload](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/uploadReport.php): `uploadReport.php`

### Administration

- [Row templates](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/manage_row_templates.php): `manage_row_templates.php`
- [Login](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/login.php): `login.php`
- [User administration](https://github.com/sri-sun-ray/stcas_qcchecklist/blob/main/view_users.php): `view_users.php`

### Persistence

- **Station database**
- **Uploaded files**

### Other components

- **Checklist user**

## Connections

- Checklist user → Checklist interface: enters checklist
- Checklist interface → Report generation: requests report (evidence: `script.js`)
- Checklist interface → Image upload: uploads images (evidence: `script.js`)
- Alternate interface → Uploaded files: uploads spreadsheet (evidence: `script_new.js`)
- Observation retrieval → Station database: reads observations (evidence: `fetch_observations.php`)
- Observation retrieval → Station database: reads image paths (evidence: `fetch_observations.php`)
- Observation save → Station database: writes observations (evidence: `save_observation.php`)
- Observation save → Uploaded files: stores image (evidence: `save_observation.php`)
- Observation update → Station database: updates observations
- Section 12 handler → Station database: writes observations (evidence: `section12_0.php`)
- Section 13 handler → Station database: writes observations (evidence: `section13_0.php`)
- Report generation → Station database: reads checklist data (evidence: `generateReport.php`)
- Report generation → Uploaded files: checks images (evidence: `generateReport.php`)
- Report listing → Station database: reads reports (evidence: `viewReports.php`)
- Report retrieval → Station database: reads report (evidence: `getReportById.php`)
- Report upload → Station database: stores report metadata
- Row templates → Station database: manages templates (evidence: `manage_row_templates.php`)
- Login → Station database: checks credentials
- User administration → Station database: manages users
