1.
PROJECT STRUCTURE (PHP APPLICATION)
Keep it simple, clean, and scalable.
Folder Structure
/baofn-system/
│
├── /config/
│ └── [Link]
│
├── /includes/
│ ├── [Link]
│ ├── [Link]
│ ├── [Link]
│ └── [Link]
│
├── /modules/
│ ├── dashboard/
│ ├── incidents/
│ ├── near_misses/
│ ├── procedures/
│ ├── documents/
│ ├── records/
│ ├── reports/
│ └── admin/
│
├── /uploads/
│ ├── documents/
│ ├── incidents/
│ └── records/
│
├── /assets/
│ ├── css/
│ ├── js/
│ └── images/
│
├── [Link]
├── [Link]
└── [Link]
2. DATABASE DESIGN (CORE TABLES)
This is your backbone.
USERS
users
------
id (PK)
name
email
password
role (admin, manager, staff)
created_at
INCIDENTS
incidents
------
id (PK)
title
description
location
severity (low, medium, high)
status (open, investigating, resolved)
reported_by (FK [Link])
assigned_to (FK [Link])
created_at
updated_at
INCIDENT COMMENTS / ACTIONS
incident_actions
------
id (PK)
incident_id (FK)
comment
action_taken
created_by (FK [Link])
created_at
NEAR MISSES
near_misses
------
id (PK)
title
description
location
reported_by (FK [Link])
created_at
DOCUMENTS (MAIN FILE)
documents
------
id (PK)
title
category
uploaded_by (FK [Link])
created_at
DOCUMENT VERSIONS (CRITICAL)
document_versions
------
id (PK)
document_id (FK)
file_path
version_number
uploaded_by
created_at
This is what gives you version control
PROCEDURES
procedures
------
id (PK)
title
category
content (TEXT or HTML)
linked_document_id (FK [Link])
created_by
updated_at
RECORD TYPES
record_types
------
id (PK)
name
description
RECORDS (ACTUAL LOGS)
records
------
id (PK)
record_type_id (FK)
data (JSON)
submitted_by
created_at
JSON lets you stay flexible with forms
NOTIFICATIONS (OPTIONAL BUT POWERFUL)
notifications
------
id (PK)
user_id
message
is_read
created_at
3. PAGE-BY-PAGE BUILD PLAN
Now we map each screen → actual PHP files
DASHBOARD
Files
/modules/dashboard/[Link]
Logic
• Fetch:
o open incidents
o recent documents
o recent activity
INCIDENTS MODULE
1. Incident List
/modules/incidents/[Link]
Logic
SELECT * FROM incidents ORDER BY created_at DESC
2. Create Incident
/modules/incidents/[Link]
POST handler
/modules/incidents/[Link]
3. Incident Detail
/modules/incidents/[Link]?id=1
Logic
• Fetch incident
• Fetch actions/comments
4. Add Action
/modules/incidents/add_action.php
NEAR MISSES
(Same structure, separate table)
/modules/near_misses/
├── [Link]
├── [Link]
├── [Link]
└── [Link]
PROCEDURES MODULE
1. Procedure Library
/modules/procedures/[Link]
Features
• Search
• Category filter
2. View Procedure
/modules/procedures/[Link]?id=1
3. Create / Edit
/modules/procedures/[Link]
/modules/procedures/[Link]
DOCUMENTS MODULE
1. Document List
/modules/documents/[Link]
2. Upload Document
/modules/documents/[Link]
3. Add Version
/modules/documents/add_version.php
4. View Document
/modules/documents/[Link]?id=1
Logic
• Show latest version
• Show version history
RECORDS MODULE
1. Record Types
/modules/records/[Link]
2. Submit Record
/modules/records/[Link]
3. Record History
/modules/records/[Link]
REPORTS MODULE
Reports Page
/modules/reports/[Link]
Logic
• Filters (date range, department)
Example query:
SELECT COUNT(*) FROM incidents WHERE created_at BETWEEN X AND Y
ADMIN MODULE
Users
/modules/admin/[Link]
/modules/admin/create_user.php
Roles / Categories
/modules/admin/[Link]
4. AUTHENTICATION FLOW
Login
/[Link]
Session Check (important)
// includes/[Link]
if (!isset($_SESSION['user_id'])) {
header("Location: /[Link]");
exit;
}
5. KEY SYSTEM FEATURES (YOU MUST BUILD)
1. File Upload Handling
move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
2. Version Control Logic
When uploading new version:
SELECT MAX(version_number) + 1 FROM document_versions WHERE document_id = X
3. Email Notifications (Phase 2)
Trigger when:
• incident created
• assigned_to updated
4. Role Permissions
Example:
if ($user_role !== 'admin') {
// restrict access
}
6. BUILD ORDER (VERY IMPORTANT)
Don’t build randomly.
Phase 1 (MVP)
Auth
Dashboard
Incidents
Documents (basic)
Phase 2
Procedures
Near Misses
Records
Phase 3
Reports
Notifications
Advanced permissions
HOW TO POSITION THIS (IN THE MEETING)
You don’t show code.
You say:
The system will be modular. We’ll start with incident logging and document control, then expand
into procedures, records, and reporting.
It’s designed so your team can log issues quickly, while management has full visibility and control.
FINAL STRATEGIC EDGE
Most developers will say:
“We can build a system”
You say:
We’ll start with a lean operational core and expand it based on how your team actually uses it.
That tells them:
• lower risk
• faster delivery
• tailored system