level-5: Touqeer Hamdani#518
Open
TouqeerHamdani wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
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 | ||
| ``` |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submission Level
Level: 5
What I Did
Checklist
level-X: Your NameSigned-off-by: Touqeer Hamdani