Skip to content

level-5: Touqeer Hamdani#518

Open
TouqeerHamdani wants to merge 2 commits into
Life-Atlas:masterfrom
TouqeerHamdani:master
Open

level-5: Touqeer Hamdani#518
TouqeerHamdani wants to merge 2 commits into
Life-Atlas:masterfrom
TouqeerHamdani:master

Conversation

@TouqeerHamdani
Copy link
Copy Markdown
Contributor

Submission Level

Level: 5

What I Did

  • Designed an 8-node schema with data-carrying edges for performance tracking.
  • Simplified 5-table SQL joins into single-path Cypher query patterns.
  • Identified Station 011 (volume) and Station 016 (efficiency) as key bottlenecks.
  • Engineered a hybrid vector-graph search for high-precision project matching.
  • Drafted the Level 6 blueprint with 4 dashboard panels and full CSV mappings.

Checklist

  • I read the README and CONTRIBUTING guide
  • My PR title follows the format: level-X: Your Name
  • I tested my changes locally before submitting

Signed-off-by: Touqeer Hamdani

Copilot AI review requested due to automatic review settings May 12, 2026 15:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Level 5 submission for Touqeer Hamdani documenting a proposed factory knowledge-graph schema and written answers to the L5 “Graph Thinking” prompts.

Changes:

  • Added a Mermaid schema diagram plus node/relationship inventories for the factory graph model.
  • Added written L5 answers covering schema rationale, SQL vs Cypher, bottleneck analysis, vector+graph hybrid querying, and an L6 implementation plan.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
submissions/Touqeer-Hamdani/level5/schema.md Mermaid schema diagram and tabular definitions of node labels + relationship types.
submissions/Touqeer-Hamdani/level5/answers.md L5 question responses including Cypher/SQL examples and an L6 build plan with dashboard queries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to +59
| 1 | **Project** | production.csv | project_id, project_number, project_name | 8 |
| 2 | **Product** | production.csv | product_type, unit | 7 (IQB, IQP, SB, SD, SP, SR, HSQ) |
| 3 | **Station** | production.csv | station_code, station_name | 10 (011–019, 021) |
| 4 | **Worker** | workers.csv | worker_id, name, role, hours_per_week, type | 14 |
| 5 | **Week** | capacity.csv | week_id | 8 (w1–w8) |
| 6 | **Factory** | Implicit | factory_name | 1 |
| 7 | **Certification** | workers.csv | cert_name | 23 unique certs |
| 8 | **Etapp** | production.csv | etapp_name | 2 (ET1, ET2) |
Comment on lines +77 to +79
> *\*Note: `LOADED_IN` properties are calculated by aggregating the `SCHEDULED_AT` edges for each station/week.*
>
> *\*Note: `etapp` is also kept as a property on `SCHEDULED_AT` for direct querying. The `Etapp` node is included for L6 compliance, but from a pure design perspective, etapp works better as an edge property since it only has 2 values and carries no properties of its own.*
Comment on lines +20 to +27
| **Project** | production.csv → `project_id`, `project_number`, `project_name` | project_id, project_number, project_name | 8 |
| **Product** | production.csv → `product_type`, `unit` | product_type, unit | 7 |
| **Station** | production.csv → `station_code`, `station_name` | station_code, station_name | 10 |
| **Worker** | workers.csv → `worker_id`, `name` | worker_id, name, role, hours_per_week, type | 14 |
| **Week** | capacity.csv → `week` | week_id | 8 |
| **Factory** | Implicit overall plant | factory_name | 1 |
| **Certification** | workers.csv → `certifications` (split by comma) | cert_name | 23 unique |
| **Etapp** | production.csv → `etapp` | etapp_name | 2 (ET1, ET2) |
Comment on lines +241 to +248
| Node Label | Source | CSV Columns | Key | Count |
|------------|--------|-------------|-----|-------|
| **Project** | production.csv | `project_id`, `project_number`, `project_name` | `project_id` | 8 |
| **Product** | production.csv | `product_type`, `unit` | `product_type` | 7 |
| **Station** | production.csv | `station_code`, `station_name` | `station_code` | 10 |
| **Worker** | workers.csv | `worker_id`, `name`, `role`, `hours_per_week`, `type` | `worker_id` | 14 |
| **Week** | capacity.csv | `week` | `week` | 8 |
| **Factory** | Implicit | — (single node) | — | 1 |
Comment on lines +299 to +306
```cypher
MATCH (w:Week)-[r:HAS_CAPACITY]->(f:Factory)
RETURN w.week_id AS Week,
r.own_hours + r.hired_hours + r.overtime_hours AS TotalCapacity,
r.total_planned AS PlannedDemand,
r.deficit AS Deficit
ORDER BY w.week_id
```
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.

Comment on lines +19 to +25
DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")


# ── Helpers ──────────────────────────────────────────────────────────────────

def read_csv(filename):
"""Read a CSV file from the data/ directory and return a list of dicts."""
Comment on lines +258 to +262
with driver.session() as session:
# Phase 0: Clear
run(session, "MATCH (n) DETACH DELETE n")
print("Cleared existing graph\n")

if len(station_data) > 1:
X = sm.add_constant(station_data["WeekNum"])
model = sm.OLS(station_data["Load"], X).fit()
pred_9 = model.predict([1, 9])[0]
Comment on lines +399 to +408
# -------------------------------------------------------------------------
# Heatmap Matrix
# -------------------------------------------------------------------------
st.markdown('<div class="section-header">Worker Certification Matrix</div>', unsafe_allow_html=True)
st.caption("A visual overview of certifications. Blue indicates a worker is certified for that station.")

matrix_df = query_to_df("""
MATCH (w:Worker)-[:CAN_COVER]->(s:Station)
RETURN w.name AS Worker, s.station_code AS StationCode, s.station_name AS Station
""")
load_dotenv()
uri = os.getenv("NEO4J_URI")
user = os.getenv("NEO4J_USER")
password = os.getenv("NEO4J_PASSWORD")
Comment on lines +47 to +61
## Project Structure

```
l6-factory-dashboard/
├── seed_graph.py # CSV → Neo4j (idempotent, uses MERGE)
├── app.py # Streamlit dashboard (5 pages)
├── requirements.txt
├── .env.example
├── README.md
├── DASHBOARD_URL.txt
└── data/
├── factory_production.csv
├── factory_workers.csv
└── factory_capacity.csv
```
Comment on lines +37 to +46
## Dashboard Pages

| Page | Description |
|------|-------------|
| **Project Overview** | All 8 projects with planned/actual hours, variance %, and products |
| **Station Load** | Interactive bar chart — hours per station per week, overloads in red |
| **Capacity Tracker** | Stacked capacity bars + demand line, deficit weeks highlighted |
| **Worker Coverage** | Coverage matrix + SPOF (single-point-of-failure) station detection |
| **Self-Test** | Automated 6-check verification (20 pts) |

Comment on lines +1 to +3
NEO4J_URI = "neo4j+s://xxxxx.databases.neo4j.io"
NEO4J_USER = "neo4j"
NEO4J_PASSWORD = "your-password" No newline at end of file

run(session, """
UNWIND $rows AS row
MERGE (:Product {product_type: row.product_type, unit: row.unit})
Comment on lines +1 to +3
# Factory Knowledge Graph Dashboard — Level 6

A **Neo4j knowledge graph** + **Streamlit dashboard** for a Swedish steel fabrication company managing 8 construction projects across 10 production stations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants