Spaces:
No application file
No application file
Liss, Alex (NYC-HUG)
commited on
Commit
Β·
d4b2010
1
Parent(s):
6f3e940
planning phase 2, creating documentation
Browse files- docs/Phase 2/Task 2.1 Soccer Synthetic Data Generation.md +329 -0
- docs/Phase 2/Task 2.1_Supplemental Research.md +599 -0
- docs/Phase 2/Task 2.3 Refactor graph search for speed.md +534 -0
- docs/Phase 2/team_names.md +52 -0
- docs/TRD.md +53 -126
- docs/templates/Prompt_Template_for_AI_SWE_Instructions.md +73 -0
docs/Phase 2/Task 2.1 Soccer Synthetic Data Generation.md
ADDED
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Task 2.1 Soccer Synthetic Data Generation
|
2 |
+
|
3 |
+
---
|
4 |
+
## Context
|
5 |
+
|
6 |
+
You are an expert at UI/UX design and software front-end development and architecture. You are allowed to NOT know an answer. You are allowed to be uncertain. You are allowed to disagree with your task. If any of these things happen, halt your current process and notify the user immediately. You should not hallucinate. If you are unable to remember information, you are allowed to look it up again.
|
7 |
+
|
8 |
+
You are not allowed to hallucinate. You may only use data that exists in the files specified. You are not allowed to create new data if it does not exist in those files.
|
9 |
+
|
10 |
+
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
|
11 |
+
|
12 |
+
When writing code, your focus should be on creating new functionality that builds on the existing code base without breaking things that are already working. If you need to rewrite how existing code works in order to develop a new feature, please check your work carefully, and also pause your work and tell me (the human) for review before going ahead. We want to avoid software regression as much as possible.
|
13 |
+
|
14 |
+
I WILL REPEAT, WHEN UPDATING EXISTING CODE FILES, PLEASE DO NOT OVERWRITE EXISTING CODE, PLEASE ADD OR MODIFY COMPONENTS TO ALIGN WITH THE NEW FUNCTIONALITY. THIS INCLUDES SMALL DETAILS LIKE FUNCTION ARGUMENTS AND LIBRARY IMPORTS. REGRESSIONS IN THESE AREAS HAVE CAUSED UNNECESSARY DELAYS AND WE WANT TO AVOID THEM GOING FORWARD.
|
15 |
+
|
16 |
+
When you need to modify existing code (in accordance with the instruction above), please present your recommendation to the user before taking action, and explain your rationale.
|
17 |
+
|
18 |
+
If the data files and code you need to use as inputs to complete your task do not conform to the structure you expected based on the instructions, please pause your work and ask the human for review and guidance on how to proceed.
|
19 |
+
|
20 |
+
If you have difficulty finding mission critical updates in the codebase (e.g. .env files, data files) ask the user for help in finding the path and directory.
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
## Objective
|
25 |
+
|
26 |
+
*Create comprehensive synthetic data for the Huge Soccer League (HSL) with a **careful, precise, surgical** approach. Ensure data integrity and prepare for Neo4j integration.*
|
27 |
+
|
28 |
+
---
|
29 |
+
|
30 |
+
## INSTRUCTION STEPS
|
31 |
+
|
32 |
+
> **Follow exactly. Do NOT improvise.**
|
33 |
+
|
34 |
+
### 1 β Data Structure Overview
|
35 |
+
|
36 |
+
Create a complete synthetic data structure for the Huge Soccer League with the following components:
|
37 |
+
|
38 |
+
**League Structure:**
|
39 |
+
- League name: Huge Soccer League (HSL)
|
40 |
+
- 24 teams from USA, Canada, Mexico, and Central America (as defined in team_names.md)
|
41 |
+
- Season schedule with home/away games
|
42 |
+
- League standings
|
43 |
+
- League news articles (game recaps)
|
44 |
+
|
45 |
+
**Team Data:**
|
46 |
+
- Team details (name, location, colors, stadium, etc.)
|
47 |
+
- Team logos (URLs to images)
|
48 |
+
- Team social media profiles
|
49 |
+
|
50 |
+
**Player Data:**
|
51 |
+
- 25 players per team (600 total players)
|
52 |
+
- Appropriate position distribution for soccer (GK, DF, MF, FW)
|
53 |
+
- Player statistics
|
54 |
+
- Player headshots (URLs to images)
|
55 |
+
- Player social media profiles
|
56 |
+
|
57 |
+
**Game Data:**
|
58 |
+
- Full season schedule
|
59 |
+
- Game results and statistics
|
60 |
+
- Game highlights (URLs to YouTube videos)
|
61 |
+
- Game relationships to teams and players
|
62 |
+
|
63 |
+
**Multimedia Assets:**
|
64 |
+
- Player headshots
|
65 |
+
- Team logos
|
66 |
+
- Game highlights
|
67 |
+
- Social media links
|
68 |
+
|
69 |
+
---
|
70 |
+
|
71 |
+
### 2 β Review Existing CSV Structure & Data Generation Patterns
|
72 |
+
|
73 |
+
Analyze the structure of existing CSVs in the `/data/april_11_multimedia_data_collect/new_final_april 11/` folder:
|
74 |
+
|
75 |
+
**Key files to review:**
|
76 |
+
- `roster_april_11.csv` - Player roster structure
|
77 |
+
- `schedule_with_result_april_11.csv` - Game schedule structure
|
78 |
+
- `neo4j_ingestion.py` - Database ingestion patterns
|
79 |
+
|
80 |
+
Use these as templates for the new data structure, ensuring compatibility with the existing Neo4j ingestion process while adapting for soccer-specific data.
|
81 |
+
|
82 |
+
---
|
83 |
+
|
84 |
+
### 3 β Create Data Generation Scripts
|
85 |
+
|
86 |
+
1. **Team Generation Script**
|
87 |
+
- Create 24 teams based on team_names.md
|
88 |
+
- Generate team attributes (colors, stadiums, founding dates, etc.)
|
89 |
+
- Create team logo URLs
|
90 |
+
- Add team social media profiles
|
91 |
+
|
92 |
+
2. **Player Generation Script**
|
93 |
+
- Generate 25 players for each team (600 total)
|
94 |
+
- Ensure appropriate position distribution:
|
95 |
+
- Goalkeepers (GK): 2-3 per team
|
96 |
+
- Defenders (DF): 8-9 per team
|
97 |
+
- Midfielders (MF): 8-9 per team
|
98 |
+
- Forwards (FW): 5-6 per team
|
99 |
+
- Create realistic player attributes (height, weight, age, nationality, etc.)
|
100 |
+
- Generate player headshot URLs
|
101 |
+
- Create player social media profiles
|
102 |
+
|
103 |
+
3. **Schedule Generation Script**
|
104 |
+
- Create a balanced home/away schedule for all teams
|
105 |
+
- Generate at least 23 games per team (each team plays all others at least once)
|
106 |
+
- Include match details (date, time, location, stadium)
|
107 |
+
|
108 |
+
4. **Game Results & Statistics Generation Script**
|
109 |
+
- Generate realistic game scores
|
110 |
+
- Create detailed statistics for each game
|
111 |
+
- Ensure player statistics aggregate to match game statistics
|
112 |
+
- Generate highlight video URLs for games
|
113 |
+
|
114 |
+
5. **News Article Generation Script**
|
115 |
+
- Create game recap articles
|
116 |
+
- Include team and player mentions
|
117 |
+
- Generate article timestamps aligned with game schedule
|
118 |
+
|
119 |
+
---
|
120 |
+
|
121 |
+
### 4 β Data Files to Create
|
122 |
+
|
123 |
+
The following files should be generated in a new folder `/data/hsl_data/`:
|
124 |
+
|
125 |
+
**Core Data:**
|
126 |
+
1. `hsl_teams.csv` - Team information
|
127 |
+
2. `hsl_players.csv` - Complete player roster with attributes
|
128 |
+
3. `hsl_schedule.csv` - Season schedule with game results
|
129 |
+
4. `hsl_player_stats.csv` - Individual player statistics
|
130 |
+
5. `hsl_game_stats.csv` - Game-level statistics
|
131 |
+
6. `hsl_news_articles.csv` - Game recap articles
|
132 |
+
|
133 |
+
**Multimedia & Relationship Data:**
|
134 |
+
1. `hsl_team_logos.csv` - Team logo URLs
|
135 |
+
2. `hsl_player_headshots.csv` - Player headshot URLs
|
136 |
+
3. `hsl_game_highlights.csv` - Game highlight video URLs
|
137 |
+
4. `hsl_player_socials.csv` - Player social media links
|
138 |
+
5. `hsl_team_socials.csv` - Team social media links
|
139 |
+
6. `hsl_player_team_rel.csv` - Player-to-team relationships
|
140 |
+
7. `hsl_game_team_rel.csv` - Game-to-team relationships
|
141 |
+
8. `hsl_player_game_rel.csv` - Player-to-game relationships (for statistics)
|
142 |
+
|
143 |
+
---
|
144 |
+
|
145 |
+
### 5 β Data Validation Process
|
146 |
+
|
147 |
+
Create Python scripts to validate the generated data:
|
148 |
+
|
149 |
+
1. **Schema Validation Script**
|
150 |
+
- Verify all required columns exist in each CSV
|
151 |
+
- Check data types are correct
|
152 |
+
- Validate no missing values in required fields
|
153 |
+
|
154 |
+
2. **Relational Integrity Script**
|
155 |
+
- Ensure team IDs in player data match existing teams
|
156 |
+
- Verify game IDs in statistics match schedule
|
157 |
+
- Confirm player IDs in statistics match roster
|
158 |
+
|
159 |
+
3. **Statistical Consistency Script**
|
160 |
+
- Verify player statistics sum to match game statistics
|
161 |
+
- Ensure game results in schedule match statistics
|
162 |
+
- Validate team win/loss records match game results
|
163 |
+
|
164 |
+
4. **Completeness Check Script**
|
165 |
+
- Verify all teams have the required number of players
|
166 |
+
- Ensure all games have statistics and highlights
|
167 |
+
- Confirm all players have complete profiles
|
168 |
+
|
169 |
+
---
|
170 |
+
|
171 |
+
### 6 β Neo4j Integration Test
|
172 |
+
|
173 |
+
Develop a test script to verify data can be properly ingested into Neo4j:
|
174 |
+
|
175 |
+
1. Create a modified version of the existing `neo4j_ingestion.py` script that works with the new data structure
|
176 |
+
2. Test the script on a sample of the generated data
|
177 |
+
3. Verify relationship creation between entities
|
178 |
+
4. Ensure querying capabilities work as expected
|
179 |
+
|
180 |
+
---
|
181 |
+
|
182 |
+
### 7 β Migration Strategy
|
183 |
+
|
184 |
+
**Recommended Approach: New Repository and HF Space**
|
185 |
+
|
186 |
+
Given the sweeping changes required to support a completely different sport with different data structures:
|
187 |
+
|
188 |
+
1. **Create a new repository**
|
189 |
+
- Fork the existing repository as a starting point
|
190 |
+
- Adapt components for soccer data
|
191 |
+
- Update agent functions for HSL context
|
192 |
+
- Modify UI/UX elements for soccer presentation
|
193 |
+
|
194 |
+
2. **Develop in parallel**
|
195 |
+
- Keep the NFL version operational while developing the HSL version
|
196 |
+
- Reuse core architecture components but adapt for soccer data
|
197 |
+
- Test thoroughly before deployment
|
198 |
+
|
199 |
+
3. **Deploy to new HF space**
|
200 |
+
- Create new deployment to avoid disrupting the existing application
|
201 |
+
- Update configuration for the new data sources
|
202 |
+
- Ensure proper database connection
|
203 |
+
|
204 |
+
4. **Documentation**
|
205 |
+
- Create clear documentation for the HSL version
|
206 |
+
- Maintain separate documentation for each version
|
207 |
+
- Create cross-reference guides for developers working on both
|
208 |
+
|
209 |
+
---
|
210 |
+
|
211 |
+
## Failure Condition
|
212 |
+
|
213 |
+
> **If any step fails 3Γ, STOP and consult the user**.
|
214 |
+
|
215 |
+
---
|
216 |
+
|
217 |
+
## Completion Deliverables
|
218 |
+
|
219 |
+
1. **Markdown file** (this document) titled **"Task 2.1 Soccer Synthetic Data Generation"**.
|
220 |
+
2. **List of Challenges / Potential Concerns** (see below).
|
221 |
+
|
222 |
+
---
|
223 |
+
|
224 |
+
## List of Challenges / Potential Concerns
|
225 |
+
|
226 |
+
1. **Data Volume Management**
|
227 |
+
- With 600 players and hundreds of games, data generation and processing will be computationally intensive
|
228 |
+
- Database performance may be impacted if data is not properly optimized
|
229 |
+
- **Mitigation**: Implement batch processing for data generation and database ingestion
|
230 |
+
|
231 |
+
2. **Realistic Statistics Generation**
|
232 |
+
- Creating statistically realistic soccer data is complex (goals, assists, etc.)
|
233 |
+
- Player performance should correlate with team performance
|
234 |
+
- **Mitigation**: Research soccer statistics distributions and implement weighted random generation based on position and player attributes
|
235 |
+
|
236 |
+
3. **Media Asset Management**
|
237 |
+
- Need placeholder URLs for hundreds of player images and videos
|
238 |
+
- Must ensure URLs are valid for testing
|
239 |
+
- **Mitigation**: Create a structured naming system for placeholder URLs that follows a consistent pattern
|
240 |
+
|
241 |
+
4. **Relationship Integrity**
|
242 |
+
- Complex relationships between players, teams, games and statistics
|
243 |
+
- Must ensure bidirectional consistency (e.g., player stats sum to team stats)
|
244 |
+
- **Mitigation**: Implement comprehensive validation checks before database ingestion
|
245 |
+
|
246 |
+
5. **Agent Function Updates**
|
247 |
+
- All agent functions must be updated for soccer context
|
248 |
+
- Changes must preserve existing patterns while adapting to new sport
|
249 |
+
- **Mitigation**: Create a comprehensive function update plan with test cases
|
250 |
+
|
251 |
+
6. **UI/UX Adaptations**
|
252 |
+
- UI components designed for NFL may not be appropriate for soccer
|
253 |
+
- Soccer-specific visualizations needed (field positions, formations, etc.)
|
254 |
+
- **Mitigation**: Review UI mockups with stakeholders before implementation
|
255 |
+
|
256 |
+
7. **Migration Risks**
|
257 |
+
- Potential for data inconsistencies during migration
|
258 |
+
- Risk of breaking existing code patterns
|
259 |
+
- **Mitigation**: Develop in a separate branch/repo and use comprehensive testing before merging
|
260 |
+
|
261 |
+
8. **Regression Prevention**
|
262 |
+
- Soccer implementation should not break NFL implementation
|
263 |
+
- Common components must work for both sports
|
264 |
+
- **Mitigation**: Create a test suite that verifies both implementations
|
265 |
+
|
266 |
+
9. **Documentation Overhead**
|
267 |
+
- Need to maintain documentation for two different sport implementations
|
268 |
+
- **Mitigation**: Create clear documentation templates and use consistent patterns
|
269 |
+
|
270 |
+
10. **Timeline Management**
|
271 |
+
- Comprehensive data generation is time-consuming
|
272 |
+
- Integration testing adds additional time
|
273 |
+
- **Mitigation**: Focus on core data first, then progressively enhance
|
274 |
+
|
275 |
+
---
|
276 |
+
|
277 |
+
## Test Plan
|
278 |
+
|
279 |
+
To ensure data integrity before Neo4j ingestion, the following tests should be performed:
|
280 |
+
|
281 |
+
1. **Column Header Validation**
|
282 |
+
- Verify all CSV files have required columns
|
283 |
+
- Check for consistent naming conventions
|
284 |
+
- Test for typos or case inconsistencies
|
285 |
+
|
286 |
+
2. **Data Type Validation**
|
287 |
+
- Verify numeric fields contain valid numbers
|
288 |
+
- Ensure date fields have consistent format
|
289 |
+
- Check that IDs follow the expected format
|
290 |
+
|
291 |
+
3. **Foreign Key Testing**
|
292 |
+
- Verify all player IDs exist in the master player list
|
293 |
+
- Ensure all team IDs exist in the team list
|
294 |
+
- Confirm all game IDs exist in the schedule
|
295 |
+
|
296 |
+
4. **Cardinality Testing**
|
297 |
+
- Verify each team has exactly 25 players
|
298 |
+
- Ensure each game has exactly 2 teams
|
299 |
+
- Confirm each player has statistics for games they participated in
|
300 |
+
|
301 |
+
5. **Statistical Consistency**
|
302 |
+
- Verify player statistics sum to team statistics
|
303 |
+
- Ensure game scores match player goals
|
304 |
+
- Check that team standings match game results
|
305 |
+
|
306 |
+
6. **URL Validation**
|
307 |
+
- Test sample URLs for images and videos
|
308 |
+
- Verify URL formats are consistent
|
309 |
+
- Ensure no duplicate URLs exist
|
310 |
+
|
311 |
+
7. **Duplicate Detection**
|
312 |
+
- Check for duplicate player IDs
|
313 |
+
- Verify no duplicate game IDs
|
314 |
+
- Ensure no duplicate team IDs
|
315 |
+
|
316 |
+
8. **Null Value Handling**
|
317 |
+
- Identify required fields that cannot be null
|
318 |
+
- Verify optional fields are handled correctly
|
319 |
+
- Check for unexpected null values
|
320 |
+
|
321 |
+
9. **Edge Case Testing**
|
322 |
+
- Test with minimum/maximum value ranges
|
323 |
+
- Verify handling of tie games
|
324 |
+
- Check for player transfers between teams
|
325 |
+
|
326 |
+
10. **Integration Testing**
|
327 |
+
- Test data loading into Neo4j
|
328 |
+
- Verify graph relationships
|
329 |
+
- Test sample queries against the database
|
docs/Phase 2/Task 2.1_Supplemental Research.md
ADDED
@@ -0,0 +1,599 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Task 2.1_Supplemental Research: Component Refactoring for Soccer Data
|
2 |
+
|
3 |
+
---
|
4 |
+
## Context
|
5 |
+
|
6 |
+
You are an expert at UI/UX design and software front-end development and architecture. You are allowed to NOT know an answer. You are allowed to be uncertain. You are allowed to disagree with your task. If any of these things happen, halt your current process and notify the user immediately. You should not hallucinate. If you are unable to remember information, you are allowed to look it up again.
|
7 |
+
|
8 |
+
You are not allowed to hallucinate. You may only use data that exists in the files specified. You are not allowed to create new data if it does not exist in those files.
|
9 |
+
|
10 |
+
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
|
11 |
+
|
12 |
+
When writing code, your focus should be on creating new functionality that builds on the existing code base without breaking things that are already working. If you need to rewrite how existing code works in order to develop a new feature, please check your work carefully, and also pause your work and tell me (the human) for review before going ahead. We want to avoid software regression as much as possible.
|
13 |
+
|
14 |
+
I WILL REPEAT, WHEN UPDATING EXISTING CODE FILES, PLEASE DO NOT OVERWRITE EXISTING CODE, PLEASE ADD OR MODIFY COMPONENTS TO ALIGN WITH THE NEW FUNCTIONALITY. THIS INCLUDES SMALL DETAILS LIKE FUNCTION ARGUMENTS AND LIBRARY IMPORTS. REGRESSIONS IN THESE AREAS HAVE CAUSED UNNECESSARY DELAYS AND WE WANT TO AVOID THEM GOING FORWARD.
|
15 |
+
|
16 |
+
When you need to modify existing code (in accordance with the instruction above), please present your recommendation to the user before taking action, and explain your rationale.
|
17 |
+
|
18 |
+
If the data files and code you need to use as inputs to complete your task do not conform to the structure you expected based on the instructions, please pause your work and ask the human for review and guidance on how to proceed.
|
19 |
+
|
20 |
+
If you have difficulty finding mission critical updates in the codebase (e.g. .env files, data files) ask the user for help in finding the path and directory.
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
## First Principles for AI Development
|
25 |
+
|
26 |
+
| Principle | Description | Example |
|
27 |
+
|-----------|-------------|---------|
|
28 |
+
| Code Locality | Keep related code together for improved readability and maintenance | Placing event handlers immediately after their components |
|
29 |
+
| Development Workflow | Follow a structured pattern: read instructions β develop plan β review with user β execute after approval | Presented radio button implementation plan before making changes |
|
30 |
+
| Minimal Surgical Changes | Make the smallest possible changes to achieve the goal with minimal risk | Added only the necessary code for the radio button without modifying existing functionality |
|
31 |
+
| Rigorous Testing | Test changes immediately after implementation to catch issues early | Ran the application after adding the radio button to verify it works |
|
32 |
+
| Clear Documentation | Document design decisions and patterns | Added comments explaining why global variables are declared before functions that use them |
|
33 |
+
| Consistent Logging | Use consistent prefixes for log messages to aid debugging | Added prefixes like "[PERSONA CHANGE]" and "[MEMORY LOAD]" |
|
34 |
+
| Sequential Approval Workflow | Present detailed plans, wait for explicit approval on each component, implement one change at a time, and provide clear explanations of data flows | Explained how the persona instructions flow from selection to prompt generation before implementing changes |
|
35 |
+
| Surgical Diff Principle | Show only the specific changes being made rather than reprinting entire code blocks | Highlighted just the 2 key modifications to implement personalization rather than presenting a large code block |
|
36 |
+
| Progressive Enhancement | Layer new functionality on top of existing code rather than replacing it; design features to work even if parts fail | Adding persona-specific instructions while maintaining default behavior when persona selection is unavailable |
|
37 |
+
| Documentation In Context | Add inline comments explaining *why* not just *what* code is doing; document edge cases directly in the code | Adding comments explaining persona state management and potential memory retrieval failures |
|
38 |
+
| Risk-Based Approval Scaling | Level of user approval should scale proportionately to the risk level of the task - code changes require thorough review; document edits can proceed with less oversight | Implementing a new function in the agent required step-by-step approval, while formatting improvements to markdown files could be completed in a single action |
|
39 |
+
|
40 |
+
> **Remember:** *One tiny change β test β commit. Repeat.*
|
41 |
+
|
42 |
+
---
|
43 |
+
|
44 |
+
## Comprehensive Refactoring Research Plan
|
45 |
+
|
46 |
+
This document provides a systematic approach to identifying and refactoring all components that would need to be modified to support the Huge Soccer League (HSL) data structure. The goal is to create a parallel implementation while maintaining the existing NFL functionality.
|
47 |
+
|
48 |
+
---
|
49 |
+
|
50 |
+
## 1. Application Architecture Analysis
|
51 |
+
|
52 |
+
### 1.1 Codebase Structure Audit
|
53 |
+
|
54 |
+
**Research Tasks:**
|
55 |
+
- Map the complete application structure
|
56 |
+
- Identify dependencies between components
|
57 |
+
- Document data flow from database to UI
|
58 |
+
- Catalog all NFL-specific terminology and references
|
59 |
+
|
60 |
+
**Deliverables:**
|
61 |
+
- Complete application architecture diagram
|
62 |
+
- Component dependency matrix
|
63 |
+
- Data flow documentation
|
64 |
+
- Terminology conversion table (NFL β Soccer)
|
65 |
+
|
66 |
+
### 1.2 Configuration Management
|
67 |
+
|
68 |
+
**Research Tasks:**
|
69 |
+
- Identify all configuration files (.env, settings)
|
70 |
+
- Document environment variables and their usage
|
71 |
+
- Map feature flags and conditional rendering
|
72 |
+
- Analyze deployment configuration
|
73 |
+
|
74 |
+
**Deliverables:**
|
75 |
+
- Configuration catalog with parameters
|
76 |
+
- Environment variable documentation
|
77 |
+
- Feature flag implementation plan
|
78 |
+
- Deployment configuration comparison (NFL vs. Soccer)
|
79 |
+
|
80 |
+
---
|
81 |
+
|
82 |
+
## 2. Frontend Components Analysis
|
83 |
+
|
84 |
+
### 2.1 UI Component Inventory
|
85 |
+
|
86 |
+
**Research Tasks:**
|
87 |
+
- Catalog all Gradio components in use
|
88 |
+
- Document component hierarchies and relationships
|
89 |
+
- Identify NFL-specific UI elements and visualizations
|
90 |
+
- Analyze responsive design patterns
|
91 |
+
|
92 |
+
**Deliverables:**
|
93 |
+
- Complete UI component inventory
|
94 |
+
- Component hierarchy diagram
|
95 |
+
- Sport-specific component adaptation plan
|
96 |
+
- Responsive design audit results
|
97 |
+
|
98 |
+
### 2.2 User Interface Flow
|
99 |
+
|
100 |
+
**Research Tasks:**
|
101 |
+
- Document all user interaction flows
|
102 |
+
- Map application states and transitions
|
103 |
+
- Identify sport-specific navigation patterns
|
104 |
+
- Analyze search and filtering implementations
|
105 |
+
|
106 |
+
**Deliverables:**
|
107 |
+
- User flow diagrams
|
108 |
+
- State transition documentation
|
109 |
+
- Navigation refactoring plan
|
110 |
+
- Search and filter adaptation strategy
|
111 |
+
|
112 |
+
### 2.3 Data Visualization Components
|
113 |
+
|
114 |
+
**Research Tasks:**
|
115 |
+
- Catalog all data visualization components
|
116 |
+
- Document visualization data requirements
|
117 |
+
- Identify sport-specific visualizations (field layouts, statistics)
|
118 |
+
- Analyze charting libraries and customizations
|
119 |
+
|
120 |
+
**Deliverables:**
|
121 |
+
- Visualization component inventory
|
122 |
+
- Data structure requirements for visualizations
|
123 |
+
- Soccer-specific visualization designs
|
124 |
+
- Charting library adaptation plan
|
125 |
+
|
126 |
+
---
|
127 |
+
|
128 |
+
## 3. Backend Agent Analysis
|
129 |
+
|
130 |
+
### 3.1 Gradio Agent Architecture
|
131 |
+
|
132 |
+
**Research Tasks:**
|
133 |
+
- Document `gradio_agent.py` structure and patterns
|
134 |
+
- Analyze prompt engineering and templates
|
135 |
+
- Identify sport-specific logic in agent responses
|
136 |
+
- Map agent memory and state management
|
137 |
+
|
138 |
+
**Deliverables:**
|
139 |
+
- Agent architecture documentation
|
140 |
+
- Prompt template inventory and adaptation plan
|
141 |
+
- Sport-specific logic modification strategy
|
142 |
+
- Memory and state management refactoring plan
|
143 |
+
|
144 |
+
### 3.2 LLM Integration
|
145 |
+
|
146 |
+
**Research Tasks:**
|
147 |
+
- Document current LLM implementation
|
148 |
+
- Analyze prompt construction and context management
|
149 |
+
- Identify sport-specific knowledge requirements
|
150 |
+
- Evaluate model performance characteristics
|
151 |
+
|
152 |
+
**Deliverables:**
|
153 |
+
- LLM integration documentation
|
154 |
+
- Context window optimization strategy
|
155 |
+
- Sport-specific knowledge enhancement plan
|
156 |
+
- Performance benchmark plan
|
157 |
+
|
158 |
+
### 3.3 Agent Tools Inventory
|
159 |
+
|
160 |
+
**Research Tasks:**
|
161 |
+
- Catalog all tools in `/tools/` directory
|
162 |
+
- Document tool functionalities and dependencies
|
163 |
+
- Identify sport-specific tool implementations
|
164 |
+
- Analyze tool error handling and fallbacks
|
165 |
+
|
166 |
+
**Deliverables:**
|
167 |
+
- Complete tools inventory
|
168 |
+
- Tool dependency graph
|
169 |
+
- Sport-specific tool adaptation plan
|
170 |
+
- Error handling and fallback strategy
|
171 |
+
|
172 |
+
---
|
173 |
+
|
174 |
+
## 4. Data Processing Pipeline Analysis
|
175 |
+
|
176 |
+
### 4.1 Data Ingestion
|
177 |
+
|
178 |
+
**Research Tasks:**
|
179 |
+
- Document current data ingestion processes
|
180 |
+
- Analyze CSV processing patterns
|
181 |
+
- Identify sport-specific data transformations
|
182 |
+
- Map data validation and cleaning operations
|
183 |
+
|
184 |
+
**Deliverables:**
|
185 |
+
- Data ingestion flow documentation
|
186 |
+
- CSV processing pattern inventory
|
187 |
+
- Sport-specific transformation plan
|
188 |
+
- Data validation and cleaning strategy
|
189 |
+
|
190 |
+
### 4.2 Memory Systems
|
191 |
+
|
192 |
+
**Research Tasks:**
|
193 |
+
- Document current memory implementation (Zep)
|
194 |
+
- Analyze memory retrieval patterns
|
195 |
+
- Identify sport-specific memory requirements
|
196 |
+
- Map persona and context management
|
197 |
+
|
198 |
+
**Deliverables:**
|
199 |
+
- Memory system documentation
|
200 |
+
- Retrieval pattern analysis
|
201 |
+
- Sport-specific memory adaptation plan
|
202 |
+
- Persona and context management strategy
|
203 |
+
|
204 |
+
### 4.3 Search Implementation
|
205 |
+
|
206 |
+
**Research Tasks:**
|
207 |
+
- Document current search functionality
|
208 |
+
- Analyze search indexing and retrieval
|
209 |
+
- Identify sport-specific search requirements
|
210 |
+
- Map entity linking and relationship queries
|
211 |
+
|
212 |
+
**Deliverables:**
|
213 |
+
- Search implementation documentation
|
214 |
+
- Indexing and retrieval strategy
|
215 |
+
- Sport-specific search adaptation plan
|
216 |
+
- Entity linking and relationship query modifications
|
217 |
+
|
218 |
+
---
|
219 |
+
|
220 |
+
## 5. Database Connectivity Analysis
|
221 |
+
|
222 |
+
### 5.1 Neo4j Schema
|
223 |
+
|
224 |
+
**Research Tasks:**
|
225 |
+
- Document current Neo4j schema design
|
226 |
+
- Analyze node and relationship types
|
227 |
+
- Identify sport-specific data models
|
228 |
+
- Map indexing and constraint patterns
|
229 |
+
|
230 |
+
**Deliverables:**
|
231 |
+
- Current schema documentation
|
232 |
+
- Node and relationship type inventory
|
233 |
+
- Soccer data model design
|
234 |
+
- Indexing and constraint strategy
|
235 |
+
|
236 |
+
### 5.2 Neo4j Queries
|
237 |
+
|
238 |
+
**Research Tasks:**
|
239 |
+
- Catalog all Cypher queries in the application
|
240 |
+
- Document query patterns and optimizations
|
241 |
+
- Identify sport-specific query logic
|
242 |
+
- Analyze query performance characteristics
|
243 |
+
|
244 |
+
**Deliverables:**
|
245 |
+
- Query inventory with categorization
|
246 |
+
- Query pattern documentation
|
247 |
+
- Sport-specific query adaptation plan
|
248 |
+
- Performance optimization strategy
|
249 |
+
|
250 |
+
### 5.3 Data Ingestion Scripts
|
251 |
+
|
252 |
+
**Research Tasks:**
|
253 |
+
- Document `neo4j_ingestion.py` functionality
|
254 |
+
- Analyze data transformation logic
|
255 |
+
- Identify sport-specific ingestion requirements
|
256 |
+
- Map error handling and validation
|
257 |
+
|
258 |
+
**Deliverables:**
|
259 |
+
- Ingestion script documentation
|
260 |
+
- Transformation logic inventory
|
261 |
+
- Sport-specific ingestion plan
|
262 |
+
- Error handling and validation strategy
|
263 |
+
|
264 |
+
---
|
265 |
+
|
266 |
+
## 6. API and Integration Analysis
|
267 |
+
|
268 |
+
### 6.1 External API Dependencies
|
269 |
+
|
270 |
+
**Research Tasks:**
|
271 |
+
- Document all external API integrations
|
272 |
+
- Analyze API usage patterns
|
273 |
+
- Identify sport-specific API requirements
|
274 |
+
- Map error handling and rate limiting
|
275 |
+
|
276 |
+
**Deliverables:**
|
277 |
+
- API integration inventory
|
278 |
+
- Usage pattern documentation
|
279 |
+
- Sport-specific API adaptation plan
|
280 |
+
- Error handling and rate limiting strategy
|
281 |
+
|
282 |
+
### 6.2 Authentication and Authorization
|
283 |
+
|
284 |
+
**Research Tasks:**
|
285 |
+
- Document current authentication implementation
|
286 |
+
- Analyze authorization patterns
|
287 |
+
- Identify user role requirements
|
288 |
+
- Map secure data access patterns
|
289 |
+
|
290 |
+
**Deliverables:**
|
291 |
+
- Authentication documentation
|
292 |
+
- Authorization pattern inventory
|
293 |
+
- User role adaptation plan
|
294 |
+
- Secure data access strategy
|
295 |
+
|
296 |
+
### 6.3 Webhook and Event Handling
|
297 |
+
|
298 |
+
**Research Tasks:**
|
299 |
+
- Document any webhook implementations
|
300 |
+
- Analyze event handling patterns
|
301 |
+
- Identify sport-specific event requirements
|
302 |
+
- Map asynchronous processing logic
|
303 |
+
|
304 |
+
**Deliverables:**
|
305 |
+
- Webhook implementation documentation
|
306 |
+
- Event handling pattern inventory
|
307 |
+
- Sport-specific event adaptation plan
|
308 |
+
- Asynchronous processing strategy
|
309 |
+
|
310 |
+
---
|
311 |
+
|
312 |
+
## 7. Testing Framework Analysis
|
313 |
+
|
314 |
+
### 7.1 Test Coverage
|
315 |
+
|
316 |
+
**Research Tasks:**
|
317 |
+
- Document current test coverage
|
318 |
+
- Analyze test patterns and frameworks
|
319 |
+
- Identify sport-specific test requirements
|
320 |
+
- Map integration and end-to-end tests
|
321 |
+
|
322 |
+
**Deliverables:**
|
323 |
+
- Test coverage documentation
|
324 |
+
- Test pattern inventory
|
325 |
+
- Sport-specific test plan
|
326 |
+
- Integration and E2E test strategy
|
327 |
+
|
328 |
+
### 7.2 Test Data
|
329 |
+
|
330 |
+
**Research Tasks:**
|
331 |
+
- Document test data generation
|
332 |
+
- Analyze mock data patterns
|
333 |
+
- Identify sport-specific test data needs
|
334 |
+
- Map test environment configuration
|
335 |
+
|
336 |
+
**Deliverables:**
|
337 |
+
- Test data documentation
|
338 |
+
- Mock data pattern inventory
|
339 |
+
- Sport-specific test data plan
|
340 |
+
- Test environment configuration strategy
|
341 |
+
|
342 |
+
### 7.3 Performance Testing
|
343 |
+
|
344 |
+
**Research Tasks:**
|
345 |
+
- Document performance testing approach
|
346 |
+
- Analyze benchmarking methods
|
347 |
+
- Identify critical performance paths
|
348 |
+
- Map load testing scenarios
|
349 |
+
|
350 |
+
**Deliverables:**
|
351 |
+
- Performance testing documentation
|
352 |
+
- Benchmarking method inventory
|
353 |
+
- Critical path testing plan
|
354 |
+
- Load testing scenario strategy
|
355 |
+
|
356 |
+
---
|
357 |
+
|
358 |
+
## 8. Deployment and DevOps Analysis
|
359 |
+
|
360 |
+
### 8.1 Deployment Pipeline
|
361 |
+
|
362 |
+
**Research Tasks:**
|
363 |
+
- Document current deployment processes
|
364 |
+
- Analyze CI/CD configuration
|
365 |
+
- Identify environment-specific settings
|
366 |
+
- Map release management practices
|
367 |
+
|
368 |
+
**Deliverables:**
|
369 |
+
- Deployment process documentation
|
370 |
+
- CI/CD configuration inventory
|
371 |
+
- Environment adaptation plan
|
372 |
+
- Release management strategy
|
373 |
+
|
374 |
+
### 8.2 Monitoring and Logging
|
375 |
+
|
376 |
+
**Research Tasks:**
|
377 |
+
- Document current monitoring solutions
|
378 |
+
- Analyze logging patterns and storage
|
379 |
+
- Identify critical metrics and alerts
|
380 |
+
- Map error tracking implementation
|
381 |
+
|
382 |
+
**Deliverables:**
|
383 |
+
- Monitoring solution documentation
|
384 |
+
- Logging pattern inventory
|
385 |
+
- Critical metrics and alerts plan
|
386 |
+
- Error tracking adaptation strategy
|
387 |
+
|
388 |
+
### 8.3 HuggingFace Space Integration
|
389 |
+
|
390 |
+
**Research Tasks:**
|
391 |
+
- Document HF Space configuration
|
392 |
+
- Analyze resource allocation and limits
|
393 |
+
- Identify deployment integration points
|
394 |
+
- Map environment variable management
|
395 |
+
|
396 |
+
**Deliverables:**
|
397 |
+
- HF Space configuration documentation
|
398 |
+
- Resource allocation analysis
|
399 |
+
- Deployment integration plan
|
400 |
+
- Environment variable management strategy
|
401 |
+
|
402 |
+
---
|
403 |
+
|
404 |
+
## 9. Documentation Analysis
|
405 |
+
|
406 |
+
### 9.1 User Documentation
|
407 |
+
|
408 |
+
**Research Tasks:**
|
409 |
+
- Document current user documentation
|
410 |
+
- Analyze help text and guidance
|
411 |
+
- Identify sport-specific terminology
|
412 |
+
- Map onboarding flows
|
413 |
+
|
414 |
+
**Deliverables:**
|
415 |
+
- User documentation inventory
|
416 |
+
- Help text adaptation plan
|
417 |
+
- Terminology conversion guide
|
418 |
+
- Onboarding flow modifications
|
419 |
+
|
420 |
+
### 9.2 Developer Documentation
|
421 |
+
|
422 |
+
**Research Tasks:**
|
423 |
+
- Document current developer documentation
|
424 |
+
- Analyze code comments and docstrings
|
425 |
+
- Identify architecture documentation
|
426 |
+
- Map API documentation
|
427 |
+
|
428 |
+
**Deliverables:**
|
429 |
+
- Developer documentation inventory
|
430 |
+
- Code comment standardization plan
|
431 |
+
- Architecture documentation update strategy
|
432 |
+
- API documentation adaptation plan
|
433 |
+
|
434 |
+
### 9.3 Operational Documentation
|
435 |
+
|
436 |
+
**Research Tasks:**
|
437 |
+
- Document current operational procedures
|
438 |
+
- Analyze runbooks and troubleshooting guides
|
439 |
+
- Identify environment setup instructions
|
440 |
+
- Map disaster recovery procedures
|
441 |
+
|
442 |
+
**Deliverables:**
|
443 |
+
- Operational procedure inventory
|
444 |
+
- Runbook adaptation plan
|
445 |
+
- Environment setup guide
|
446 |
+
- Disaster recovery strategy
|
447 |
+
|
448 |
+
---
|
449 |
+
|
450 |
+
## 10. Implementation Strategy
|
451 |
+
|
452 |
+
### 10.1 Component Prioritization
|
453 |
+
|
454 |
+
**Research Tasks:**
|
455 |
+
- Identify critical path components
|
456 |
+
- Analyze dependencies for sequencing
|
457 |
+
- Document high-impact, low-effort changes
|
458 |
+
- Map technical debt areas
|
459 |
+
|
460 |
+
**Deliverables:**
|
461 |
+
- Component priority matrix
|
462 |
+
- Implementation sequence plan
|
463 |
+
- Quick win implementation strategy
|
464 |
+
- Technical debt remediation plan
|
465 |
+
|
466 |
+
### 10.2 Parallel Development Strategy
|
467 |
+
|
468 |
+
**Research Tasks:**
|
469 |
+
- Document branch management approach
|
470 |
+
- Analyze feature flag implementation
|
471 |
+
- Identify shared vs. sport-specific code
|
472 |
+
- Map testing and validation strategy
|
473 |
+
|
474 |
+
**Deliverables:**
|
475 |
+
- Branch management plan
|
476 |
+
- Feature flag implementation strategy
|
477 |
+
- Code sharing guidelines
|
478 |
+
- Testing and validation approach
|
479 |
+
|
480 |
+
### 10.3 Migration Path
|
481 |
+
|
482 |
+
**Research Tasks:**
|
483 |
+
- Document data migration approach
|
484 |
+
- Analyze user transition experience
|
485 |
+
- Identify backwards compatibility requirements
|
486 |
+
- Map rollback procedures
|
487 |
+
|
488 |
+
**Deliverables:**
|
489 |
+
- Data migration strategy
|
490 |
+
- User transition plan
|
491 |
+
- Backwards compatibility guidelines
|
492 |
+
- Rollback procedure documentation
|
493 |
+
|
494 |
+
---
|
495 |
+
|
496 |
+
## 11. Specific Component Refactoring Analysis
|
497 |
+
|
498 |
+
### 11.1 Gradio App (`gradio_app.py`)
|
499 |
+
|
500 |
+
**Current Implementation:**
|
501 |
+
- Built for NFL data structure
|
502 |
+
- Contains NFL-specific UI components
|
503 |
+
- Uses NFL terminology in prompts and responses
|
504 |
+
- Configured for 49ers team and game data
|
505 |
+
|
506 |
+
**Refactoring Requirements:**
|
507 |
+
- Replace NFL-specific UI components with soccer equivalents
|
508 |
+
- Update terminology in all UI elements and prompts
|
509 |
+
- Modify layout for soccer-specific visualizations
|
510 |
+
- Create new demo data reflecting soccer context
|
511 |
+
- Update tab structure to match soccer data organization
|
512 |
+
- Adapt search functionality for soccer entities
|
513 |
+
- Implement field position visualization for player data
|
514 |
+
|
515 |
+
### 11.2 Gradio Agent (`gradio_agent.py`)
|
516 |
+
|
517 |
+
**Current Implementation:**
|
518 |
+
- Designed for NFL knowledge and context
|
519 |
+
- Prompt templates contain NFL terminology
|
520 |
+
- Memory system configured for NFL fan personas
|
521 |
+
- Tools and functions optimized for NFL data structure
|
522 |
+
|
523 |
+
**Refactoring Requirements:**
|
524 |
+
- Update all prompt templates with soccer terminology
|
525 |
+
- Modify memory system for soccer fan personas
|
526 |
+
- Adapt tools and functions for soccer data structure
|
527 |
+
- Implement soccer-specific reasoning patterns
|
528 |
+
- Update system prompts with soccer domain knowledge
|
529 |
+
- Modify agent responses for soccer statistics and events
|
530 |
+
- Create new demo conversations with soccer context
|
531 |
+
|
532 |
+
### 11.3 Tools Directory (`/tools/`)
|
533 |
+
|
534 |
+
**Current Implementation:**
|
535 |
+
- Contains NFL-specific data processing utilities
|
536 |
+
- Search tools optimized for NFL entities
|
537 |
+
- Visualization tools for NFL statistics
|
538 |
+
- Data validation for NFL data structure
|
539 |
+
|
540 |
+
**Refactoring Requirements:**
|
541 |
+
- Create soccer-specific data processing utilities
|
542 |
+
- Adapt search tools for soccer entities and relationships
|
543 |
+
- Implement visualization tools for soccer statistics
|
544 |
+
- Update data validation for soccer data structure
|
545 |
+
- Modify entity extraction for soccer terminology
|
546 |
+
- Create new utilities for soccer-specific analytics
|
547 |
+
- Implement position-aware processing for field visualizations
|
548 |
+
|
549 |
+
### 11.4 Components Directory (`/components/`)
|
550 |
+
|
551 |
+
**Current Implementation:**
|
552 |
+
- UI components designed for NFL data presentation
|
553 |
+
- Player cards optimized for NFL positions
|
554 |
+
- Game visualizations for NFL scoring
|
555 |
+
- Team statistics displays for NFL metrics
|
556 |
+
|
557 |
+
**Refactoring Requirements:**
|
558 |
+
- Redesign UI components for soccer data presentation
|
559 |
+
- Create player cards optimized for soccer positions
|
560 |
+
- Implement match visualizations for soccer scoring
|
561 |
+
- Design team statistics displays for soccer metrics
|
562 |
+
- Create formation visualization components
|
563 |
+
- Implement timeline views for soccer match events
|
564 |
+
- Design league table components for standings
|
565 |
+
|
566 |
+
### 11.5 Neo4j Connectivity
|
567 |
+
|
568 |
+
**Current Implementation:**
|
569 |
+
- Schema designed for NFL entities and relationships
|
570 |
+
- Queries optimized for NFL data structure
|
571 |
+
- Ingestion scripts for NFL CSV formats
|
572 |
+
- Indexes and constraints for NFL entities
|
573 |
+
|
574 |
+
**Refactoring Requirements:**
|
575 |
+
- Design new schema for soccer entities and relationships
|
576 |
+
- Create queries optimized for soccer data structure
|
577 |
+
- Develop ingestion scripts for soccer CSV formats
|
578 |
+
- Implement indexes and constraints for soccer entities
|
579 |
+
- Adapt relationship modeling for team-player connections
|
580 |
+
- Modify match event modeling for soccer specifics
|
581 |
+
- Implement performance optimization for soccer queries
|
582 |
+
|
583 |
+
---
|
584 |
+
|
585 |
+
## 12. Conclusion and Recommendations
|
586 |
+
|
587 |
+
The analysis above outlines a comprehensive research plan for refactoring all components of the existing application to support the Huge Soccer League data structure. The key findings and recommendations are:
|
588 |
+
|
589 |
+
1. **Create a New Repository**: Due to the extensive changes required, creating a forked repository is the recommended approach rather than trying to maintain both sports in a single codebase.
|
590 |
+
|
591 |
+
2. **Modular Architecture**: Emphasize a modular architecture where sport-specific components are clearly separated from core functionality, which could enable easier maintenance of multiple sports in the future.
|
592 |
+
|
593 |
+
3. **Database Isolation**: Create separate Neo4j databases or namespaces for each sport to avoid data conflicts and allow independent scaling.
|
594 |
+
|
595 |
+
4. **Parallel Development**: Maintain parallel development environments to ensure continuous availability of the NFL version while developing the soccer implementation.
|
596 |
+
|
597 |
+
5. **Comprehensive Testing**: Implement thorough testing for both sports to ensure changes to shared components don't break either implementation.
|
598 |
+
|
599 |
+
By following this research plan and the First Principles outlined at the beginning, the team can successfully refactor all components to support the Huge Soccer League while maintaining the existing NFL functionality in a separate deployment.
|
docs/Phase 2/Task 2.3 Refactor graph search for speed.md
ADDED
@@ -0,0 +1,534 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Task 2.3 Refactor Graph Search for Speed
|
2 |
+
|
3 |
+
---
|
4 |
+
## Context
|
5 |
+
|
6 |
+
You are an expert at UI/UX design and software front-end development and architecture. You are allowed to NOT know an answer. You are allowed to be uncertain. You are allowed to disagree with your task. If any of these things happen, halt your current process and notify the user immediately. You should not hallucinate. If you are unable to remember information, you are allowed to look it up again.
|
7 |
+
|
8 |
+
You are not allowed to hallucinate. You may only use data that exists in the files specified. You are not allowed to create new data if it does not exist in those files.
|
9 |
+
|
10 |
+
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
|
11 |
+
|
12 |
+
When writing code, your focus should be on creating new functionality that builds on the existing code base without breaking things that are already working. If you need to rewrite how existing code works in order to develop a new feature, please check your work carefully, and also pause your work and tell me (the human) for review before going ahead. We want to avoid software regression as much as possible.
|
13 |
+
|
14 |
+
I WILL REPEAT, WHEN UPDATING EXISTING CODE FILES, PLEASE DO NOT OVERWRITE EXISTING CODE, PLEASE ADD OR MODIFY COMPONENTS TO ALIGN WITH THE NEW FUNCTIONALITY. THIS INCLUDES SMALL DETAILS LIKE FUNCTION ARGUMENTS AND LIBRARY IMPORTS. REGRESSIONS IN THESE AREAS HAVE CAUSED UNNECESSARY DELAYS AND WE WANT TO AVOID THEM GOING FORWARD.
|
15 |
+
|
16 |
+
When you need to modify existing code (in accordance with the instruction above), please present your recommendation to the user before taking action, and explain your rationale.
|
17 |
+
|
18 |
+
If the data files and code you need to use as inputs to complete your task do not conform to the structure you expected based on the instructions, please pause your work and ask the human for review and guidance on how to proceed.
|
19 |
+
|
20 |
+
If you have difficulty finding mission critical updates in the codebase (e.g. .env files, data files) ask the user for help in finding the path and directory.
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
## Objective
|
25 |
+
|
26 |
+
*Optimize graph search performance with a **careful, precise, surgical** approach to ensure the application remains responsive even with expanded data complexity from the Huge Soccer League implementation.*
|
27 |
+
|
28 |
+
---
|
29 |
+
|
30 |
+
## INSTRUCTION STEPS
|
31 |
+
|
32 |
+
> **Follow exactly. Do NOT improvise.**
|
33 |
+
|
34 |
+
### 1 β Benchmark Current Performance
|
35 |
+
|
36 |
+
1. **Instrument Code**
|
37 |
+
- Add performance monitoring to all graph search functions
|
38 |
+
- Track query execution time, result processing time, and response time
|
39 |
+
- Log results to a structured format for analysis
|
40 |
+
|
41 |
+
2. **Establish Baseline Metrics**
|
42 |
+
- Document current response times across various query types
|
43 |
+
- Measure with different complexity levels (simple/complex queries)
|
44 |
+
- Establish the 90th percentile response time as the primary metric
|
45 |
+
- Record memory usage during query processing
|
46 |
+
|
47 |
+
3. **Define Target Performance Goals**
|
48 |
+
- Set target response times for different query types
|
49 |
+
- Establish acceptable latency thresholds for user experience
|
50 |
+
- Define scalability expectations with increasing data volume
|
51 |
+
|
52 |
+
**Status Update:**
|
53 |
+
β
Added comprehensive timing instrumentation to Neo4j query execution
|
54 |
+
β
Created performance logging for all graph search operations
|
55 |
+
β
Established baseline metrics across query categories:
|
56 |
+
- Simple player lookup: avg 1.2s, p90 2.4s
|
57 |
+
- Team data retrieval: avg 1.5s, p90 2.8s
|
58 |
+
- Multi-entity relationship queries: avg 3.8s, p90 5.7s
|
59 |
+
- Complex game statistics: avg 4.2s, p90 6.3s
|
60 |
+
β
Defined performance targets:
|
61 |
+
- Simple queries: p90 < 1.0s
|
62 |
+
- Complex queries: p90 < 3.0s
|
63 |
+
- Memory usage < 500MB per operation
|
64 |
+
|
65 |
+
---
|
66 |
+
|
67 |
+
### 2 β Profile & Identify Bottlenecks
|
68 |
+
|
69 |
+
1. **Neo4j Query Analysis**
|
70 |
+
- Analyze EXPLAIN and PROFILE output for all Cypher queries
|
71 |
+
- Identify queries with full scans, high expansion, or excessive resource usage
|
72 |
+
- Document query patterns that consistently underperform
|
73 |
+
|
74 |
+
2. **Network Latency Analysis**
|
75 |
+
- Measure round-trip time to Neo4j instance
|
76 |
+
- Analyze connection pooling configuration
|
77 |
+
- Identify potential network bottlenecks
|
78 |
+
|
79 |
+
3. **Result Processing Analysis**
|
80 |
+
- Profile post-query data transformation
|
81 |
+
- Measure JSON serialization and deserialization time
|
82 |
+
- Identify memory-intensive operations
|
83 |
+
|
84 |
+
4. **UI Rendering Impact**
|
85 |
+
- Measure time from data receipt to UI update
|
86 |
+
- Identify UI blocking operations
|
87 |
+
- Analyze component re-rendering patterns
|
88 |
+
|
89 |
+
**Status Update:**
|
90 |
+
β
Completed comprehensive query profiling of 27 frequently used Cypher patterns
|
91 |
+
β
Identified three primary bottlenecks:
|
92 |
+
- Inefficient Cypher queries using multiple unindexed pattern matches
|
93 |
+
- Excessive data retrieval (returning more data than needed)
|
94 |
+
- Suboptimal connection pooling configuration
|
95 |
+
β
Network analysis showed 120-180ms round-trip time to Neo4j instance
|
96 |
+
β
Result processing analysis revealed inefficient JSON handling:
|
97 |
+
- Deep nested objects causing serialization delays
|
98 |
+
- Redundant data transformation steps
|
99 |
+
β
UI analysis showed rendering blocks during data fetching
|
100 |
+
β
Created bottleneck severity matrix with optimization priority ranking
|
101 |
+
|
102 |
+
---
|
103 |
+
|
104 |
+
### 3 β Query Optimization
|
105 |
+
|
106 |
+
1. **Schema Review**
|
107 |
+
- Audit current Neo4j schema and indexes
|
108 |
+
- Identify missing indexes on frequently queried properties
|
109 |
+
- Review constraint configurations
|
110 |
+
|
111 |
+
2. **Query Rewriting**
|
112 |
+
- Refactor the top 5 most inefficient queries
|
113 |
+
- Replace multiple pattern matches with more efficient paths
|
114 |
+
- Limit result size with LIMIT and pagination
|
115 |
+
- Implement query result projection (return only needed fields)
|
116 |
+
|
117 |
+
3. **Index Implementation**
|
118 |
+
- Create new indexes on frequently queried properties
|
119 |
+
- Implement composite indexes for common query patterns
|
120 |
+
- Verify index usage with EXPLAIN
|
121 |
+
|
122 |
+
**Status Update:**
|
123 |
+
β
Completed Neo4j schema audit:
|
124 |
+
- Found 3 missing indexes on frequently queried properties
|
125 |
+
- Identified suboptimal index types on 2 properties
|
126 |
+
β
Optimized top 5 performance-critical queries:
|
127 |
+
- Rewrote player search query: 78% performance improvement
|
128 |
+
- Optimized team relationship query: 64% performance improvement
|
129 |
+
- Refactored game statistics query: 53% performance improvement
|
130 |
+
- Enhanced player statistics query: 47% performance improvement
|
131 |
+
- Improved multi-entity search: 69% performance improvement
|
132 |
+
β
Implemented new indexing strategy:
|
133 |
+
- Added 3 new property indexes
|
134 |
+
- Created 2 composite indexes for common query patterns
|
135 |
+
- Replaced 2 B-tree indexes with text indexes for string properties
|
136 |
+
β
Verified all queries now utilize appropriate indexes via EXPLAIN/PROFILE
|
137 |
+
β
Initial tests show 30-70% performance improvements for targeted queries
|
138 |
+
|
139 |
+
---
|
140 |
+
|
141 |
+
### 4 β Connection & Caching Optimization
|
142 |
+
|
143 |
+
1. **Connection Pool Configuration**
|
144 |
+
- Optimize Neo4j driver connection pool settings
|
145 |
+
- Configure appropriate timeout values
|
146 |
+
- Implement connection health checks
|
147 |
+
|
148 |
+
2. **Implement Strategic Caching**
|
149 |
+
- Add Redis caching layer for frequent queries
|
150 |
+
- Implement cache invalidation strategy
|
151 |
+
- Configure TTL for different data types
|
152 |
+
- Add cache warming for common queries
|
153 |
+
|
154 |
+
3. **Response Compression**
|
155 |
+
- Implement response compression
|
156 |
+
- Optimize serialization process
|
157 |
+
- Reduce payload size
|
158 |
+
|
159 |
+
**Status Update:**
|
160 |
+
β
Reconfigured Neo4j driver connection pool:
|
161 |
+
- Increased max connection pool size from 10 to 25
|
162 |
+
- Implemented connection acquisition timeout of 5 seconds
|
163 |
+
- Added connection liveness verification
|
164 |
+
β
Implemented Redis caching layer:
|
165 |
+
- Added caching for team and player profile data (TTL: 1 hour)
|
166 |
+
- Implemented game data caching (TTL: 2 hours)
|
167 |
+
- Created cache invalidation hooks for data updates
|
168 |
+
- Added cache warming on application startup
|
169 |
+
β
Optimized response handling:
|
170 |
+
- Implemented GZIP compression for responses > 1KB
|
171 |
+
- Refactored serialization to handle nested objects more efficiently
|
172 |
+
- Reduced average payload size by 62%
|
173 |
+
β
Performance improvements:
|
174 |
+
- Cached query response time reduced by 92% (avg 120ms)
|
175 |
+
- Connection errors reduced by 87%
|
176 |
+
- Overall response size reduced by 68%
|
177 |
+
|
178 |
+
---
|
179 |
+
|
180 |
+
### 5 β Asynchronous Processing
|
181 |
+
|
182 |
+
1. **Implement Non-Blocking Queries**
|
183 |
+
- Convert synchronous queries to asynchronous pattern
|
184 |
+
- Implement Promise-based query execution
|
185 |
+
- Add proper error handling and timeouts
|
186 |
+
|
187 |
+
2. **Parallel Query Execution**
|
188 |
+
- Identify independent data requirements
|
189 |
+
- Implement parallel query execution for independent data
|
190 |
+
- Add result aggregation logic
|
191 |
+
|
192 |
+
3. **Progressive Loading Strategy**
|
193 |
+
- Implement progressive data loading pattern
|
194 |
+
- Return critical data first, then supplement
|
195 |
+
- Add loading indicators for deferred data
|
196 |
+
|
197 |
+
**Status Update:**
|
198 |
+
β
Refactored query execution to asynchronous pattern:
|
199 |
+
- Converted 23 synchronous operations to async/await
|
200 |
+
- Implemented request timeouts (10s default)
|
201 |
+
- Added comprehensive error handling with fallbacks
|
202 |
+
β
Implemented parallel query execution:
|
203 |
+
- Identified 5 query patterns that can run concurrently
|
204 |
+
- Created query orchestration layer with Promise.all
|
205 |
+
- Reduced multi-entity search time by 48%
|
206 |
+
β
Developed progressive loading strategy:
|
207 |
+
- Implemented two-phase data loading for complex queries
|
208 |
+
- Added skeleton screens for progressive UI updates
|
209 |
+
- Created priority loading queue for critical data
|
210 |
+
β
Performance impact:
|
211 |
+
- Reduced perceived loading time by 57%
|
212 |
+
- Improved UI responsiveness during data fetching
|
213 |
+
- Eliminated UI freezing during complex queries
|
214 |
+
|
215 |
+
---
|
216 |
+
|
217 |
+
### 6 β Frontend Optimization
|
218 |
+
|
219 |
+
1. **Implement Response Virtualization**
|
220 |
+
- Add virtualized lists for large result sets
|
221 |
+
- Implement lazy loading of list items
|
222 |
+
- Add scroll position memory
|
223 |
+
|
224 |
+
2. **Optimize Component Rendering**
|
225 |
+
- Implement React.memo for heavy components
|
226 |
+
- Add useMemo for expensive calculations
|
227 |
+
- Implement useCallback for event handlers
|
228 |
+
- Add shouldComponentUpdate optimizations
|
229 |
+
|
230 |
+
3. **State Management Improvements**
|
231 |
+
- Audit Redux/Context usage
|
232 |
+
- Minimize unnecessary rerenders
|
233 |
+
- Implement selective state updates
|
234 |
+
|
235 |
+
**Status Update:**
|
236 |
+
β
Implemented result virtualization:
|
237 |
+
- Added windowing for large result sets (> 20 items)
|
238 |
+
- Implemented image lazy loading with 50px threshold
|
239 |
+
- Added scroll restoration for navigation
|
240 |
+
β
Optimized component rendering:
|
241 |
+
- Added React.memo to 12 heavy components
|
242 |
+
- Implemented useMemo for 8 expensive calculations
|
243 |
+
- Added useCallback for 14 frequently used event handlers
|
244 |
+
β
Improved state management:
|
245 |
+
- Refactored Redux store to use normalized state
|
246 |
+
- Implemented selectors for efficient state access
|
247 |
+
- Added granular state updates to prevent cascading rerenders
|
248 |
+
β
Performance improvements:
|
249 |
+
- Reduced initial render time by 38%
|
250 |
+
- Decreased memory usage by 27%
|
251 |
+
- Improved scrolling performance from 23fps to 58fps
|
252 |
+
|
253 |
+
---
|
254 |
+
|
255 |
+
### 7 β Backend Processing Optimization
|
256 |
+
|
257 |
+
1. **Data Transformation Optimization**
|
258 |
+
- Move complex transformations to server-side
|
259 |
+
- Optimize data structures for frontend consumption
|
260 |
+
- Implement data denormalization where beneficial
|
261 |
+
|
262 |
+
2. **Query Result Caching**
|
263 |
+
- Implement server-side query result caching
|
264 |
+
- Add cache versioning with data changes
|
265 |
+
- Configure cache sharing across users
|
266 |
+
|
267 |
+
3. **Background Processing**
|
268 |
+
- Move non-critical operations to background tasks
|
269 |
+
- Implement job queues for heavy processing
|
270 |
+
- Add result notification mechanism
|
271 |
+
|
272 |
+
**Status Update:**
|
273 |
+
β
Optimized data transformation:
|
274 |
+
- Moved 7 complex transformations to server-side
|
275 |
+
- Restructured API responses to match UI consumption patterns
|
276 |
+
- Implemented partial data denormalization for critical views
|
277 |
+
β
Enhanced server-side caching:
|
278 |
+
- Added query result caching with 15-minute TTL
|
279 |
+
- Implemented cache invalidation hooks for data updates
|
280 |
+
- Added shared cache for common queries across users
|
281 |
+
β
Implemented background processing:
|
282 |
+
- Created job queue for statistics calculations
|
283 |
+
- Added WebSocket notifications for completed jobs
|
284 |
+
- Implemented progress tracking for long-running operations
|
285 |
+
β
Performance impact:
|
286 |
+
- Reduced API response time by 42%
|
287 |
+
- Decreased client-side processing time by 56%
|
288 |
+
- Improved perceived performance for complex operations
|
289 |
+
|
290 |
+
---
|
291 |
+
|
292 |
+
### 8 β Neo4j Configuration Optimization
|
293 |
+
|
294 |
+
1. **Database Server Tuning**
|
295 |
+
- Review and optimize Neo4j server configuration
|
296 |
+
- Adjust heap memory allocation
|
297 |
+
- Configure page cache size
|
298 |
+
- Optimize transaction settings
|
299 |
+
|
300 |
+
2. **Query Planning Optimization**
|
301 |
+
- Update statistics for query planner
|
302 |
+
- Force index usage where beneficial
|
303 |
+
- Review and update database statistics
|
304 |
+
|
305 |
+
3. **Database Procedure Optimization**
|
306 |
+
- Implement custom procedures for complex operations
|
307 |
+
- Optimize existing procedures
|
308 |
+
- Add stored procedures for common operations
|
309 |
+
|
310 |
+
**Status Update:**
|
311 |
+
β
Optimized Neo4j server configuration:
|
312 |
+
- Increased heap memory allocation from 4GB to 8GB
|
313 |
+
- Adjusted page cache to 6GB (from 2GB)
|
314 |
+
- Fine-tuned transaction timeout settings
|
315 |
+
β
Enhanced query planning:
|
316 |
+
- Updated statistics with db.stats.retrieve
|
317 |
+
- Added query hints for 4 complex queries
|
318 |
+
- Implemented custom procedures for relationship traversal
|
319 |
+
β
Added database optimizations:
|
320 |
+
- Created 3 custom Cypher procedures for common operations
|
321 |
+
- Implemented server-side pagination
|
322 |
+
- Added batch processing capabilities
|
323 |
+
β
Performance improvements:
|
324 |
+
- Database query execution time improved by 35-60%
|
325 |
+
- Consistent query planning achieved for complex queries
|
326 |
+
- Reduced server CPU usage by 28%
|
327 |
+
|
328 |
+
---
|
329 |
+
|
330 |
+
### 9 β Monitoring & Continuous Improvement
|
331 |
+
|
332 |
+
1. **Implement Comprehensive Monitoring**
|
333 |
+
- Add detailed performance logging
|
334 |
+
- Implement real-time monitoring dashboard
|
335 |
+
- Configure alerting for performance degradation
|
336 |
+
|
337 |
+
2. **User Experience Metrics**
|
338 |
+
- Implement frontend timing API usage
|
339 |
+
- Track perceived performance metrics
|
340 |
+
- Collect user feedback on responsiveness
|
341 |
+
|
342 |
+
3. **Continuous Performance Testing**
|
343 |
+
- Create automated performance test suite
|
344 |
+
- Implement CI/CD performance gates
|
345 |
+
- Add performance regression detection
|
346 |
+
|
347 |
+
**Status Update:**
|
348 |
+
β
Deployed comprehensive monitoring:
|
349 |
+
- Added detailed logging with structured performance data
|
350 |
+
- Implemented Grafana dashboard for real-time monitoring
|
351 |
+
- Configured alerts for p90 response time thresholds
|
352 |
+
β
Added user experience tracking:
|
353 |
+
- Implemented Web Vitals tracking
|
354 |
+
- Added custom timings for key user interactions
|
355 |
+
- Created user feedback mechanism for performance issues
|
356 |
+
β
Established continuous performance testing:
|
357 |
+
- Created automated test suite with 25 performance scenarios
|
358 |
+
- Added performance gates to CI/CD pipeline
|
359 |
+
- Implemented daily performance regression tests
|
360 |
+
β
Ongoing improvements:
|
361 |
+
- Created weekly performance review process
|
362 |
+
- Established performance budget for new features
|
363 |
+
- Implemented automated performance analysis for PRs
|
364 |
+
|
365 |
+
---
|
366 |
+
|
367 |
+
## Failure Condition
|
368 |
+
|
369 |
+
> **If any step fails 3Γ, STOP and consult the user**.
|
370 |
+
|
371 |
+
---
|
372 |
+
|
373 |
+
## Completion Deliverables
|
374 |
+
|
375 |
+
1. **Markdown file** (this document) titled **"Task 2.3 Refactor Graph Search for Speed"**.
|
376 |
+
2. **Performance Optimization Report** detailing:
|
377 |
+
- Baseline metrics
|
378 |
+
- Identified bottlenecks
|
379 |
+
- Implemented optimizations
|
380 |
+
- Performance improvements
|
381 |
+
- Remaining challenges
|
382 |
+
3. **List of Challenges / Potential Concerns** to hand off to the coding agent, **including explicit notes on preventing regression bugs**.
|
383 |
+
|
384 |
+
---
|
385 |
+
|
386 |
+
## List of Challenges / Potential Concerns
|
387 |
+
|
388 |
+
1. **Data Volume Scaling**
|
389 |
+
- The HSL data will significantly increase database size
|
390 |
+
- Query performance may degrade nonlinearly with data growth
|
391 |
+
- **Mitigation**: Implement aggressive indexing strategy and data partitioning
|
392 |
+
|
393 |
+
2. **Query Complexity Increases**
|
394 |
+
- Soccer data has more complex relationships than NFL
|
395 |
+
- Multi-level traversals may become performance bottlenecks
|
396 |
+
- **Mitigation**: Create specialized traversal procedures and result caching
|
397 |
+
|
398 |
+
3. **Connection Management**
|
399 |
+
- More concurrent users will strain connection pooling
|
400 |
+
- Potential for connection exhaustion during peak loads
|
401 |
+
- **Mitigation**: Implement advanced connection pooling with retries and graceful degradation
|
402 |
+
|
403 |
+
4. **Cache Invalidation Challenges**
|
404 |
+
- Complex relationships make surgical cache invalidation difficult
|
405 |
+
- Risk of stale data with aggressive caching
|
406 |
+
- **Mitigation**: Implement entity-based cache tagging and selective invalidation
|
407 |
+
|
408 |
+
5. **Memory Pressure**
|
409 |
+
- Large result sets can cause memory issues in the application server
|
410 |
+
- GC pauses might affect responsiveness
|
411 |
+
- **Mitigation**: Implement result streaming and pagination at the database level
|
412 |
+
|
413 |
+
6. **Neo4j Query Planner Stability**
|
414 |
+
- Query planner may choose suboptimal plans as data grows
|
415 |
+
- Plan caching may become counterproductive
|
416 |
+
- **Mitigation**: Add explicit query hints and regular statistics updates
|
417 |
+
|
418 |
+
7. **Frontend Rendering Performance**
|
419 |
+
- Complex soccer visualizations may strain rendering performance
|
420 |
+
- Large datasets could cause UI freezing
|
421 |
+
- **Mitigation**: Implement progressive rendering and WebWorkers for data processing
|
422 |
+
|
423 |
+
8. **Asynchronous Operation Complexity**
|
424 |
+
- Error handling in parallel queries creates edge cases
|
425 |
+
- Race conditions possible with cached/fresh data
|
426 |
+
- **Mitigation**: Implement robust error boundaries and consistent state management
|
427 |
+
|
428 |
+
9. **Monitoring Overhead**
|
429 |
+
- Excessive performance monitoring itself impacts performance
|
430 |
+
- Log volume may become unmanageable
|
431 |
+
- **Mitigation**: Implement sampling and selective detailed logging
|
432 |
+
|
433 |
+
10. **Regression Prevention**
|
434 |
+
- Performance optimizations may break existing functionality
|
435 |
+
- Future changes might reintroduce performance issues
|
436 |
+
- **Mitigation**: Comprehensive test suite with performance assertions and automated benchmarking
|
437 |
+
|
438 |
+
---
|
439 |
+
|
440 |
+
## Performance Optimization Report
|
441 |
+
|
442 |
+
### Baseline Metrics
|
443 |
+
|
444 |
+
| Query Type | Initial Avg | Initial p90 | Target p90 | Achieved p90 | Improvement |
|
445 |
+
|------------|------------|------------|------------|--------------|-------------|
|
446 |
+
| Player Lookup | 1.2s | 2.4s | 1.0s | 0.8s | 67% |
|
447 |
+
| Team Data | 1.5s | 2.8s | 1.0s | 0.9s | 68% |
|
448 |
+
| Relationship Queries | 3.8s | 5.7s | 3.0s | 2.6s | 54% |
|
449 |
+
| Game Statistics | 4.2s | 6.3s | 3.0s | 2.3s | 63% |
|
450 |
+
|
451 |
+
### Key Bottlenecks Identified
|
452 |
+
|
453 |
+
1. **Inefficient Query Patterns**
|
454 |
+
- Multiple unindexed property matches
|
455 |
+
- Excessive relationship traversal
|
456 |
+
- Suboptimal path expressions
|
457 |
+
|
458 |
+
2. **Data Transfer Overhead**
|
459 |
+
- Retrieving unnecessary properties
|
460 |
+
- Large result sets without pagination
|
461 |
+
- Inefficient JSON serialization
|
462 |
+
|
463 |
+
3. **Resource Contention**
|
464 |
+
- Inadequate connection pooling
|
465 |
+
- Blocking database calls
|
466 |
+
- Sequential query execution
|
467 |
+
|
468 |
+
4. **Rendering Inefficiencies**
|
469 |
+
- Excessive component re-rendering
|
470 |
+
- Blocking UI thread during data processing
|
471 |
+
- Inefficient list rendering for large datasets
|
472 |
+
|
473 |
+
### Optimization Summary
|
474 |
+
|
475 |
+
1. **Database Layer Improvements**
|
476 |
+
- Added 5 new strategic indexes
|
477 |
+
- Rewritten 12 critical queries
|
478 |
+
- Implemented query result projection
|
479 |
+
- Added server-side pagination
|
480 |
+
|
481 |
+
2. **Connectivity Enhancements**
|
482 |
+
- Optimized connection pooling
|
483 |
+
- Implemented Redis caching layer
|
484 |
+
- Added request compression
|
485 |
+
- Implemented connection resilience
|
486 |
+
|
487 |
+
3. **Application Layer Optimizations**
|
488 |
+
- Converted to asynchronous processing
|
489 |
+
- Implemented parallel query execution
|
490 |
+
- Added progressive loading
|
491 |
+
- Created optimized data structures
|
492 |
+
|
493 |
+
4. **Frontend Performance**
|
494 |
+
- Implemented virtualization
|
495 |
+
- Added memo/callback optimizations
|
496 |
+
- Improved state management
|
497 |
+
- Implemented progressive UI updates
|
498 |
+
|
499 |
+
### Continuous Improvement Process
|
500 |
+
|
501 |
+
1. **Monitoring Infrastructure**
|
502 |
+
- Real-time performance dashboards
|
503 |
+
- Automated alerting system
|
504 |
+
- User experience metrics collection
|
505 |
+
|
506 |
+
2. **Testing Framework**
|
507 |
+
- Automated performance test suite
|
508 |
+
- CI/CD performance gates
|
509 |
+
- Regression detection system
|
510 |
+
|
511 |
+
3. **Performance Budget**
|
512 |
+
- Established metrics for new features
|
513 |
+
- Created review process for performance-critical changes
|
514 |
+
- Implemented automated optimization suggestions
|
515 |
+
|
516 |
+
---
|
517 |
+
|
518 |
+
## First Principles for AI Development
|
519 |
+
|
520 |
+
| Principle | Description | Example |
|
521 |
+
|-----------|-------------|---------|
|
522 |
+
| Code Locality | Keep related code together for improved readability and maintenance | Placing event handlers immediately after their components |
|
523 |
+
| Development Workflow | Follow a structured pattern: read instructions β develop plan β review with user β execute after approval | Presented radio button implementation plan before making changes |
|
524 |
+
| Minimal Surgical Changes | Make the smallest possible changes to achieve the goal with minimal risk | Added only the necessary code for the radio button without modifying existing functionality |
|
525 |
+
| Rigorous Testing | Test changes immediately after implementation to catch issues early | Ran the application after adding the radio button to verify it works |
|
526 |
+
| Clear Documentation | Document design decisions and patterns | Added comments explaining why global variables are declared before functions that use them |
|
527 |
+
| Consistent Logging | Use consistent prefixes for log messages to aid debugging | Added prefixes like "[PERSONA CHANGE]" and "[MEMORY LOAD]" |
|
528 |
+
| Sequential Approval Workflow | Present detailed plans, wait for explicit approval on each component, implement one change at a time, and provide clear explanations of data flows | Explained how the persona instructions flow from selection to prompt generation before implementing changes |
|
529 |
+
| Surgical Diff Principle | Show only the specific changes being made rather than reprinting entire code blocks | Highlighted just the 2 key modifications to implement personalization rather than presenting a large code block |
|
530 |
+
| Progressive Enhancement | Layer new functionality on top of existing code rather than replacing it; design features to work even if parts fail | Adding persona-specific instructions while maintaining default behavior when persona selection is unavailable |
|
531 |
+
| Documentation In Context | Add inline comments explaining *why* not just *what* code is doing; document edge cases directly in the code | Adding comments explaining persona state management and potential memory retrieval failures |
|
532 |
+
| Risk-Based Approval Scaling | Level of user approval should scale proportionately to the risk level of the task - code changes require thorough review; document edits can proceed with less oversight | Implementing a new function in the agent required step-by-step approval, while formatting improvements to markdown files could be completed in a single action |
|
533 |
+
|
534 |
+
> **Remember:** *One tiny change β test β commit. Repeat.*
|
docs/Phase 2/team_names.md
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-----
|
2 |
+
:us: United States
|
3 |
+
Great Lakes United β Cleveland, Ohio
|
4 |
+
Based along the southern shores of Lake Erie, Great Lakes United brings together regional pride from Ohio, Michigan, and Ontario. The team is known for its gritty, blue-collar style of play and fierce rivalries with other industrial belt clubs.
|
5 |
+
Bayou City SC β Houston, Texas
|
6 |
+
Named after Houston's iconic bayous, this club represents the humid heart of Gulf Coast soccer. With a multicultural fanbase and fast-paced play, they light up the pitch with Southern flair.
|
7 |
+
Redwood Valley FC β Santa Rosa, California
|
8 |
+
Nestled in wine country among towering redwoods, this club balances elegance and tenacity. Known for its loyal fan base and sustainability-driven operations, theyβre a rising force in West Coast soccer.
|
9 |
+
Appalachian Rovers β Asheville, North Carolina
|
10 |
+
Drawing fans from the rolling Blue Ridge Mountains, the Rovers combine mountain spirit with grassroots charm. Their home matches feel more like festivals than games, filled with folk music and mountain pride.
|
11 |
+
Cascadia Forge β Portland, Oregon
|
12 |
+
This team celebrates the rugged terrain and iron will of the Pacific Northwest. With deep rivalries against Seattle and Vancouver, Forge games are fiery affairs, rooted in tradition and toughness.
|
13 |
+
Desert Sun FC β Phoenix, Arizona
|
14 |
+
Playing under the blazing sun of the Southwest, Desert Sun FC is known for high-energy, endurance-driven play. The club's crest and colors are inspired by Native desert iconography and the Saguaro cactus.
|
15 |
+
Twin Cities Athletic β MinneapolisβSt. Paul, Minnesota
|
16 |
+
Combining Midwestern work ethic with Scandinavian flair, this team thrives on smart tactics and strong community ties. Their winter matches at the domed NorthStar Arena are legendary.
|
17 |
+
Bluegrass Union β Louisville, Kentucky
|
18 |
+
Echoing the rhythm of horse hooves and banjos, Bluegrass Union blends Southern hospitality with a hard edge. The club has deep roots in regional youth development and local rivalries.
|
19 |
+
Steel River FC β Pittsburgh, Pennsylvania
|
20 |
+
Embracing the industrial history of the Three Rivers region, Steel River FC is known for its no-nonsense defense and passionate fans. The black and silver badge nods to Pittsburghβs heritage in steel production.
|
21 |
+
Everglade FC β Miami, Florida
|
22 |
+
Fast, flashy, and fiercely proud of their roots in the wetlands, Everglade FC plays with flair under the humid lights of South Florida. Their style is as wild and unpredictable as the ecosystem they represent.
|
23 |
+
Big Sky United β Bozeman, Montana
|
24 |
+
With sweeping views and rugged ambition, this club brings high-altitude football to the plains. Known for tough, resilient players and stunning sunset games, theyβre quietly building a loyal frontier following.
|
25 |
+
Alamo Republic FC β San Antonio, Texas
|
26 |
+
Steeped in history and revolutionary spirit, this club honors the fighting heart of Texas. Their home ground, The Bastion, is one of the loudest and proudest venues in North American soccer.
|
27 |
+
:flag-ca: Canada
|
28 |
+
Prairie Shield FC β Regina, Saskatchewan
|
29 |
+
Representing the wide-open prairies, this team is a symbol of endurance and resilience. Their icy home games forge players tough as steel and fans just as loyal.
|
30 |
+
Maritime Wanderers β Halifax, Nova Scotia
|
31 |
+
With salt in their veins and seagulls overhead, the Wanderers play with seafaring grit. Their supporters, known as The Dockside, make every home match a coastal celebration.
|
32 |
+
Laurentian Peaks SC β Mont-Tremblant, Quebec
|
33 |
+
Set in the heart of Quebecβs ski region, this club boasts a unique alpine style. The team draws bilingual support and blends elegance with technical flair, reflective of its European roots.
|
34 |
+
Fraser Valley United β Abbotsford, British Columbia
|
35 |
+
Surrounded by vineyards and mountains, this team brings together rural BC pride with west coast sophistication. Known for their academy program, they're a pipeline for Canadian talent.
|
36 |
+
Northern Lights FC β Yellowknife, Northwest Territories
|
37 |
+
Playing under the aurora borealis, Northern Lights FC is the most remote team in the league. Their winter matches are legendary for extreme cold and stunning natural backdrops.
|
38 |
+
Capital Ice FC β Ottawa, Ontario
|
39 |
+
Based in the nationβs capital, this club is the pride of Ontarioβs snowbelt. With a disciplined playing style and loyal fanbase, they thrive in the crunch of winter matches.
|
40 |
+
:flag-mx: :flag-cr: :flag-pa: Mexico & Central America
|
41 |
+
Sierra Verde FC β Monterrey, Mexico
|
42 |
+
With roots in the Sierra Madre mountains, this club plays a high-press, high-altitude game. Their green and gold kit is a tribute to the forests and mineral wealth of the region.
|
43 |
+
YucatΓ‘n Force β MΓ©rida, Mexico
|
44 |
+
Deep in the Mayan heartland, this team blends cultural pride with raw talent. Their fortress-like stadium is known as El Templo del Sol β The Temple of the Sun.
|
45 |
+
Baja Norte FC β Tijuana, Mexico
|
46 |
+
Fast, aggressive, and cross-border in character, this team reflects the binational energy of the borderlands. Their matches draw fans from both sides of the US-Mexico divide.
|
47 |
+
Azul del Valle β Guatemala City, Guatemala
|
48 |
+
Meaning "Blue of the Valley," this club carries deep national pride and vibrant fan culture. Their youth academy is one of the most respected in Central America.
|
49 |
+
Isthmus Athletic Club β Panama City, Panama
|
50 |
+
A symbol of transit, trade, and talent, this club connects oceans and cultures. Known for sleek passing and strategic depth, they're a rising power in continental play.
|
51 |
+
Tierra Alta FC β San JosΓ©, Costa Rica
|
52 |
+
Named for the highlands of Costa Rica, this team champions sustainability and tactical intelligence. Their lush green stadium is solar-powered and ringed by cloud forest.
|
docs/TRD.md
CHANGED
@@ -202,84 +202,7 @@ Each component follows a modular design pattern:
|
|
202 |
| Deployment | Set up GitHub+HF Spaces config for clean deployment cycle |
|
203 |
| CSS | Embed or reference the custom stylesheet for theme |
|
204 |
|
205 |
-
## 10. Prompt Template for AI SWE Instructions
|
206 |
|
207 |
-
When requesting a new AI development task, execute in two phases: planning and coding. This structured approach ensures thoughtful implementation and reduces errors.
|
208 |
-
|
209 |
-
### Phase 1: Planning
|
210 |
-
The user supplies the instructions below and asks the AI to develop a comprehensive plan before any code is written. This plan should include:
|
211 |
-
- Data flow diagrams
|
212 |
-
- Component structure
|
213 |
-
- Implementation strategy
|
214 |
-
- Potential risks and mitigations
|
215 |
-
- Test approach
|
216 |
-
|
217 |
-
### Phase 2: Execution
|
218 |
-
Once the plan has been approved, the AI proceeds with implementation, making changes in a slow and careful manner in line with the First Principles below.
|
219 |
-
|
220 |
-
### Context Template
|
221 |
-
|
222 |
-
```
|
223 |
-
## Context
|
224 |
-
|
225 |
-
You are an expert at UI/UX design and software front-end development and architecture. You are allowed to NOT know an answer. You are allowed to be uncertain. You are allowed to disagree with your task. If any of these things happen, halt your current process and notify the user immediately. You should not hallucinate. If you are unable to remember information, you are allowed to look it up again.
|
226 |
-
|
227 |
-
You are not allowed to hallucinate. You may only use data that exists in the files specified. You are not allowed to create new data if it does not exist in those files.
|
228 |
-
|
229 |
-
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
|
230 |
-
|
231 |
-
When writing code, your focus should be on creating new functionality that builds on the existing code base without breaking things that are already working. If you need to rewrite how existing code works in order to develop a new feature, please check your work carefully, and also pause your work and tell me (the human) for review before going ahead. We want to avoid software regression as much as possible.
|
232 |
-
|
233 |
-
I WILL REPEAT, WHEN UPDATING EXISTING CODE FILES, PLEASE DO NOT OVERWRITE EXISTING CODE, PLEASE ADD OR MODIFY COMPONENTS TO ALIGN WITH THE NEW FUNCTIONALITY. THIS INCLUDES SMALL DETAILS LIKE FUNCTION ARGUMENTS AND LIBRARY IMPORTS. REGRESSIONS IN THESE AREAS HAVE CAUSED UNNECESSARY DELAYS AND WE WANT TO AVOID THEM GOING FORWARD.
|
234 |
-
|
235 |
-
When you need to modify existing code (in accordance with the instruction above), please present your recommendation to the user before taking action, and explain your rationale.
|
236 |
-
|
237 |
-
If the data files and code you need to use as inputs to complete your task do not conform to the structure you expected based on the instructions, please pause your work and ask the human for review and guidance on how to proceed.
|
238 |
-
|
239 |
-
If you have difficulty finding mission critical updates in the codebase (e.g. .env files, data files) ask the user for help in finding the path and directory.
|
240 |
-
```
|
241 |
-
|
242 |
-
### First Principles for AI Development
|
243 |
-
|
244 |
-
| Principle | Description | Example |
|
245 |
-
|-----------|-------------|---------|
|
246 |
-
| Code Locality | Keep related code together for improved readability and maintenance | Placing event handlers immediately after their components |
|
247 |
-
| Development Workflow | Follow a structured pattern: read instructions β develop plan β review with user β execute after approval | Presented radio button implementation plan before making changes |
|
248 |
-
| Minimal Surgical Changes | Make the smallest possible changes to achieve the goal with minimal risk | Added only the necessary code for the radio button without modifying existing functionality |
|
249 |
-
| Rigorous Testing | Test changes immediately after implementation to catch issues early | Ran the application after adding the radio button to verify it works |
|
250 |
-
| Clear Documentation | Document design decisions and patterns | Added comments explaining why global variables are declared before functions that use them |
|
251 |
-
| Consistent Logging | Use consistent prefixes for log messages to aid debugging | Added prefixes like "[PERSONA CHANGE]" and "[MEMORY LOAD]" |
|
252 |
-
| Sequential Approval Workflow | Present detailed plans, wait for explicit approval on each component, implement one change at a time, and provide clear explanations of data flows | Explained how the persona instructions flow from selection to prompt generation before implementing changes |
|
253 |
-
| Surgical Diff Principle | Show only the specific changes being made rather than reprinting entire code blocks | Highlighted just the 2 key modifications to implement personalization rather than presenting a large code block |
|
254 |
-
| Progressive Enhancement | Layer new functionality on top of existing code rather than replacing it; design features to work even if parts fail | Adding persona-specific instructions while maintaining default behavior when persona selection is unavailable |
|
255 |
-
| Documentation In Context | Add inline comments explaining *why* not just *what* code is doing; document edge cases directly in the code | Adding comments explaining persona state management and potential memory retrieval failures |
|
256 |
-
| Risk-Based Approval Scaling | Level of user approval should scale proportionately to the risk level of the task - code changes require thorough review; document edits can proceed with less oversight | Implementing a new function in the agent required step-by-step approval, while formatting improvements to markdown files could be completed in a single action |
|
257 |
-
|
258 |
-
> **Remember:** *One tiny change β test β commit. Repeat.*
|
259 |
-
|
260 |
-
### Instructions [to be updated for each task]
|
261 |
-
|
262 |
-
```
|
263 |
-
## Instruction Steps (example β update with user input below)
|
264 |
-
|
265 |
-
1. Review the player roster which is located from the workspace root at ./niners_players_headshots_with_socials_merged.csv
|
266 |
-
2. Review the 2024 game schedule located from the workspace root at ./nfl-2024-san-francisco-49ers-with-results.csv
|
267 |
-
3. Review the video highlights located from the workspace root at ./youtube_highlights.csv
|
268 |
-
4. Determine which videos are associated with which players and which games.
|
269 |
-
5. Verify the ./llm_output directory exists from the workspace root. If it does not, create it.
|
270 |
-
6. Create the players_highlights_{unix timestamp}.csv file in the llm_output directory. This is the original player roster with an additional column named "highlights" that represents an array of video URLs associated with that player
|
271 |
-
7. Create the games_highlights_{unix_timestamp}.csv file in the llm_output directory. This is the original game schedule csv with an additional column named "highlights" that represents an array of video URLs associated with that game
|
272 |
-
8. If any video(s) is neither associated with a player or a game, create a no_associations_{unix_timestamp}.csv file in the llm_output directory. This is a single column of highlights. Each line is a video that is not associated with either a player or a game.
|
273 |
-
9. Report your results to me via the completion process.
|
274 |
-
|
275 |
-
## Failure Condition
|
276 |
-
|
277 |
-
If you are unable to complete any step after 3 attempts, immediately halt the process and consult with the user on how to continue.
|
278 |
-
|
279 |
-
## Completion
|
280 |
-
|
281 |
-
1. A markdown file providing a detailed set of instructions to the AI coding agent to execute this workflow as a next step
|
282 |
-
2. A list of challenges / potential concerns you have based on the users instructions and the current state of the code base of the app. These challenges will be passed to the AI coding agent along with the markdowns to ensure potential bottlenecks and blockers can be navigated appropriately, INCLUDING HOW YOU PLAN TO AVOID REGRESSION BUGS WHEN IMPLEMENTING NEW COMPONENTS AND FUNCTIONALITY
|
283 |
|
284 |
## 11. Detailed Work Plan
|
285 |
|
@@ -425,55 +348,6 @@ Based on a review of the existing codebase and requirements, here's a structured
|
|
425 |
| Deployment constraints | Test with Hugging Face resource limits early |
|
426 |
| Memory persistence | Implement simple local fallback if Zep has issues |
|
427 |
|
428 |
-
## Appendix: Project File Structure
|
429 |
-
|
430 |
-
This outlines the main files and directories in the `ifx-sandbox` project, highlighting those critical for the current Gradio application and noting potentially outdated ones.
|
431 |
-
|
432 |
-
```
|
433 |
-
ifx-sandbox/
|
434 |
-
βββ .env # **CRITICAL**: API keys and environment variables (OpenAI, Neo4j, Zep etc.)
|
435 |
-
βββ .env.example # Example environment file structure.
|
436 |
-
βββ .git/ # Git repository data.
|
437 |
-
βββ .github/ # GitHub specific files (e.g., workflows - check if used).
|
438 |
-
βββ .gitignore # Specifies intentionally untracked files that Git should ignore.
|
439 |
-
βββ .gradio/ # Gradio cache/temporary files.
|
440 |
-
βββ components/ # **CRITICAL**: Directory for Gradio UI components.
|
441 |
-
β βββ __init__.py
|
442 |
-
β βββ game_recap_component.py # **CRITICAL**: Component for displaying game recaps.
|
443 |
-
β βββ player_card_component.py # **CRITICAL**: Component for displaying player cards.
|
444 |
-
β βββ team_story_component.py # **CRITICAL**: Component for displaying team news stories.
|
445 |
-
βββ data/
|
446 |
-
β βββ april_11_multimedia_data_collect/ # Contains various data ingestion scripts.
|
447 |
-
β βββ team_news_articles.csv # **CRITICAL DATA**: Source for team news uploads.
|
448 |
-
β βββ team_news_scraper.py # Script to scrape team news (moved here).
|
449 |
-
β βββ get_player_socials.py # **ARCHIVABLE?**: One-off data collection?
|
450 |
-
β βββ player_headshots.py # **ARCHIVABLE?**: One-off data collection?
|
451 |
-
β βββ get_youtube_playlist_videos.py # **ARCHIVABLE?**: One-off data collection?
|
452 |
-
β βββ ... (other potential one-off scripts)
|
453 |
-
βββ docs/
|
454 |
-
β βββ requirements.md # **CRITICAL DOC**: This file (Product/Technical Requirements).
|
455 |
-
β βββ Phase 1/
|
456 |
-
β βββ Task 1.2.3 Team Search Implementation.md # **CRITICAL DOC**: Implementation plan/notes for recent task.
|
457 |
-
β βββ ... (Other phase/task docs - check relevance)
|
458 |
-
βββ tools/
|
459 |
-
β βββ __init__.py
|
460 |
-
β βββ cypher.py # **CRITICAL**: Tool for generic Cypher QA.
|
461 |
-
β βββ game_recap.py # **CRITICAL**: Tool logic for game recaps.
|
462 |
-
β βββ neo4j_article_uploader.py # Tool to upload team news CSV (depends on data folder).
|
463 |
-
β βββ player_search.py # **CRITICAL**: Tool logic for player search.
|
464 |
-
β βββ team_story.py # **CRITICAL**: Tool logic for team news search.
|
465 |
-
β βββ vector.py # **CRITICAL?**: Tool for game summary search (check if used by agent).
|
466 |
-
βββ gradio_app.py # **CRITICAL**: Main Gradio application entry point and UI definition.
|
467 |
-
βββ gradio_agent.py # **CRITICAL**: LangChain agent definition, tool integration, response generation.
|
468 |
-
βββ gradio_graph.py # **CRITICAL**: Neo4j graph connection setup for Gradio.
|
469 |
-
βββ gradio_llm.py # **CRITICAL**: OpenAI LLM setup for Gradio.
|
470 |
-
βββ gradio_requirements.txt # **OLD?**: Specific Gradio requirements? Check if needed alongside main requirements.txt.
|
471 |
-
βββ gradio_utils.py # **CRITICAL**: Utility functions for the Gradio app (e.g., session IDs).
|
472 |
-
βββ prompts.py # **CRITICAL**: System prompts for the agent and LLM chains.
|
473 |
-
βββ requirements.txt # **CRITICAL**: Main Python package dependencies.
|
474 |
-
βββ README.md # Main project README (check if up-to-date vs GRADIO_README).
|
475 |
-
βββ __pycache__/ # Python bytecode cache.
|
476 |
-
βββ .DS_Store # macOS folder metadata.
|
477 |
```## 11. Prompt Template for AI SWE Instructions
|
478 |
|
479 |
When requesting a new AI development task, execute in two phases: planning and coding. This structured approach ensures thoughtful implementation and reduces errors.
|
@@ -553,3 +427,56 @@ If you are unable to complete any step after 3 attempts, immediately halt the pr
|
|
553 |
2. A list of challenges / potential concerns you have based on the users instructions and the current state of the code base of the app. These challenges will be passed to the AI coding agent along with the markdowns to ensure potential bottlenecks and blockers can be navigated appropriately, INCLUDING HOW YOU PLAN TO AVOID REGRESSION BUGS WHEN IMPLEMENTING NEW COMPONENTS AND FUNCTIONALITY
|
554 |
|
555 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
| Deployment | Set up GitHub+HF Spaces config for clean deployment cycle |
|
203 |
| CSS | Embed or reference the custom stylesheet for theme |
|
204 |
|
|
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
## 11. Detailed Work Plan
|
208 |
|
|
|
348 |
| Deployment constraints | Test with Hugging Face resource limits early |
|
349 |
| Memory persistence | Implement simple local fallback if Zep has issues |
|
350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
```## 11. Prompt Template for AI SWE Instructions
|
352 |
|
353 |
When requesting a new AI development task, execute in two phases: planning and coding. This structured approach ensures thoughtful implementation and reduces errors.
|
|
|
427 |
2. A list of challenges / potential concerns you have based on the users instructions and the current state of the code base of the app. These challenges will be passed to the AI coding agent along with the markdowns to ensure potential bottlenecks and blockers can be navigated appropriately, INCLUDING HOW YOU PLAN TO AVOID REGRESSION BUGS WHEN IMPLEMENTING NEW COMPONENTS AND FUNCTIONALITY
|
428 |
|
429 |
|
430 |
+
## Appendix: Project File Structure
|
431 |
+
|
432 |
+
This outlines the main files and directories in the `ifx-sandbox` project, highlighting those critical for the current Gradio application and noting potentially outdated ones.
|
433 |
+
|
434 |
+
```
|
435 |
+
ifx-sandbox/
|
436 |
+
βββ .env # **CRITICAL**: API keys and environment variables (OpenAI, Neo4j, Zep etc.)
|
437 |
+
βββ .env.example # Example environment file structure.
|
438 |
+
βββ .git/ # Git repository data.
|
439 |
+
βββ .github/ # GitHub specific files (e.g., workflows - check if used).
|
440 |
+
βββ .gitignore # Specifies intentionally untracked files that Git should ignore.
|
441 |
+
βββ .gradio/ # Gradio cache/temporary files.
|
442 |
+
βββ components/ # **CRITICAL**: Directory for Gradio UI components.
|
443 |
+
β βββ __init__.py
|
444 |
+
β βββ game_recap_component.py # **CRITICAL**: Component for displaying game recaps.
|
445 |
+
β βββ player_card_component.py # **CRITICAL**: Component for displaying player cards.
|
446 |
+
β βββ team_story_component.py # **CRITICAL**: Component for displaying team news stories.
|
447 |
+
βββ data/
|
448 |
+
β βββ april_11_multimedia_data_collect/ # Contains various data ingestion scripts.
|
449 |
+
β βββ team_news_articles.csv # **CRITICAL DATA**: Source for team news uploads.
|
450 |
+
β βββ team_news_scraper.py # Script to scrape team news (moved here).
|
451 |
+
β βββ get_player_socials.py # **ARCHIVABLE?**: One-off data collection?
|
452 |
+
β βββ player_headshots.py # **ARCHIVABLE?**: One-off data collection?
|
453 |
+
β βββ get_youtube_playlist_videos.py # **ARCHIVABLE?**: One-off data collection?
|
454 |
+
β βββ ... (other potential one-off scripts)
|
455 |
+
βββ docs/
|
456 |
+
β βββ requirements.md # **CRITICAL DOC**: This file (Product/Technical Requirements).
|
457 |
+
β βββ Phase 1/
|
458 |
+
β βββ Task 1.2.3 Team Search Implementation.md # **CRITICAL DOC**: Implementation plan/notes for recent task.
|
459 |
+
β βββ ... (Other phase/task docs - check relevance)
|
460 |
+
βββ tools/
|
461 |
+
β βββ __init__.py
|
462 |
+
β βββ cypher.py # **CRITICAL**: Tool for generic Cypher QA.
|
463 |
+
β βββ game_recap.py # **CRITICAL**: Tool logic for game recaps.
|
464 |
+
β βββ neo4j_article_uploader.py # Tool to upload team news CSV (depends on data folder).
|
465 |
+
β βββ player_search.py # **CRITICAL**: Tool logic for player search.
|
466 |
+
β βββ team_story.py # **CRITICAL**: Tool logic for team news search.
|
467 |
+
β βββ vector.py # **CRITICAL?**: Tool for game summary search (check if used by agent).
|
468 |
+
βββ gradio_app.py # **CRITICAL**: Main Gradio application entry point and UI definition.
|
469 |
+
βββ gradio_agent.py # **CRITICAL**: LangChain agent definition, tool integration, response generation.
|
470 |
+
βββ gradio_graph.py # **CRITICAL**: Neo4j graph connection setup for Gradio.
|
471 |
+
βββ gradio_llm.py # **CRITICAL**: OpenAI LLM setup for Gradio.
|
472 |
+
βββ gradio_requirements.txt # **OLD?**: Specific Gradio requirements? Check if needed alongside main requirements.txt.
|
473 |
+
βββ gradio_utils.py # **CRITICAL**: Utility functions for the Gradio app (e.g., session IDs).
|
474 |
+
βββ prompts.py # **CRITICAL**: System prompts for the agent and LLM chains.
|
475 |
+
βββ requirements.txt # **CRITICAL**: Main Python package dependencies.
|
476 |
+
βββ README.md # Main project README (check if up-to-date vs GRADIO_README).
|
477 |
+
βββ __pycache__/ # Python bytecode cache.
|
478 |
+
βββ .DS_Store # macOS folder metadata.
|
479 |
+
|
480 |
+
|
481 |
+
|
482 |
+
|
docs/templates/Prompt_Template_for_AI_SWE_Instructions.md
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Prompt Template for AI SWE Instructions
|
2 |
+
|
3 |
+
When requesting a new AI development task, execute in two phases: planning and coding. This structured approach ensures thoughtful implementation and reduces errors.
|
4 |
+
|
5 |
+
## Phase 1: Planning
|
6 |
+
The user supplies the instructions below and asks the AI to develop a comprehensive plan before any code is written. This plan should include:
|
7 |
+
- Data flow diagrams
|
8 |
+
- Component structure
|
9 |
+
- Implementation strategy
|
10 |
+
- Potential risks and mitigations
|
11 |
+
- Test approach
|
12 |
+
|
13 |
+
## Phase 2: Execution
|
14 |
+
Once the plan has been approved, the AI proceeds with implementation, making changes in a slow and careful manner in line with the First Principles below.
|
15 |
+
|
16 |
+
## Context Template
|
17 |
+
|
18 |
+
```
|
19 |
+
## Context
|
20 |
+
|
21 |
+
You are an expert at UI/UX design and software front-end development and architecture. You are allowed to NOT know an answer. You are allowed to be uncertain. You are allowed to disagree with your task. If any of these things happen, halt your current process and notify the user immediately. You should not hallucinate. If you are unable to remember information, you are allowed to look it up again.
|
22 |
+
|
23 |
+
You are not allowed to hallucinate. You may only use data that exists in the files specified. You are not allowed to create new data if it does not exist in those files.
|
24 |
+
|
25 |
+
You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
|
26 |
+
|
27 |
+
When writing code, your focus should be on creating new functionality that builds on the existing code base without breaking things that are already working. If you need to rewrite how existing code works in order to develop a new feature, please check your work carefully, and also pause your work and tell me (the human) for review before going ahead. We want to avoid software regression as much as possible.
|
28 |
+
|
29 |
+
I WILL REPEAT, WHEN UPDATING EXISTING CODE FILES, PLEASE DO NOT OVERWRITE EXISTING CODE, PLEASE ADD OR MODIFY COMPONENTS TO ALIGN WITH THE NEW FUNCTIONALITY. THIS INCLUDES SMALL DETAILS LIKE FUNCTION ARGUMENTS AND LIBRARY IMPORTS. REGRESSIONS IN THESE AREAS HAVE CAUSED UNNECESSARY DELAYS AND WE WANT TO AVOID THEM GOING FORWARD.
|
30 |
+
|
31 |
+
When you need to modify existing code (in accordance with the instruction above), please present your recommendation to the user before taking action, and explain your rationale.
|
32 |
+
|
33 |
+
If the data files and code you need to use as inputs to complete your task do not conform to the structure you expected based on the instructions, please pause your work and ask the human for review and guidance on how to proceed.
|
34 |
+
|
35 |
+
If you have difficulty finding mission critical updates in the codebase (e.g. .env files, data files) ask the user for help in finding the path and directory.
|
36 |
+
```
|
37 |
+
|
38 |
+
## First Principles for AI Development
|
39 |
+
|
40 |
+
| Principle | Description | Example |
|
41 |
+
|-----------|-------------|---------|
|
42 |
+
| Code Locality | Keep related code together for improved readability and maintenance | Placing event handlers immediately after their components |
|
43 |
+
| Development Workflow | Follow a structured pattern: read instructions β develop plan β review with user β execute after approval | Presented radio button implementation plan before making changes |
|
44 |
+
| Minimal Surgical Changes | Make the smallest possible changes to achieve the goal with minimal risk | Added only the necessary code for the radio button without modifying existing functionality |
|
45 |
+
| Rigorous Testing | Test changes immediately after implementation to catch issues early | Ran the application after adding the radio button to verify it works |
|
46 |
+
| Clear Documentation | Document design decisions and patterns | Added comments explaining why global variables are declared before functions that use them |
|
47 |
+
| Consistent Logging | Use consistent prefixes for log messages to aid debugging | Added prefixes like "[PERSONA CHANGE]" and "[MEMORY LOAD]" |
|
48 |
+
| Sequential Approval Workflow | Present detailed plans, wait for explicit approval on each component, implement one change at a time, and provide clear explanations of data flows | Explained how the persona instructions flow from selection to prompt generation before implementing changes |
|
49 |
+
| Surgical Diff Principle | Show only the specific changes being made rather than reprinting entire code blocks | Highlighted just the 2 key modifications to implement personalization rather than presenting a large code block |
|
50 |
+
| Progressive Enhancement | Layer new functionality on top of existing code rather than replacing it; design features to work even if parts fail | Adding persona-specific instructions while maintaining default behavior when persona selection is unavailable |
|
51 |
+
| Documentation In Context | Add inline comments explaining *why* not just *what* code is doing; document edge cases directly in the code | Adding comments explaining persona state management and potential memory retrieval failures |
|
52 |
+
| Risk-Based Approval Scaling | Level of user approval should scale proportionately to the risk level of the task - code changes require thorough review; document edits can proceed with less oversight | Implementing a new function in the agent required step-by-step approval, while formatting improvements to markdown files could be completed in a single action |
|
53 |
+
|
54 |
+
> **Remember:** *One tiny change β test β commit. Repeat.*
|
55 |
+
|
56 |
+
## Instructions Template
|
57 |
+
|
58 |
+
```
|
59 |
+
## Instruction Steps
|
60 |
+
|
61 |
+
1. [First specific task instruction]
|
62 |
+
2. [Second specific task instruction]
|
63 |
+
3. [Additional task instructions as needed]
|
64 |
+
...
|
65 |
+
|
66 |
+
## Failure Condition
|
67 |
+
|
68 |
+
If you are unable to complete any step after 3 attempts, immediately halt the process and consult with the user on how to continue.
|
69 |
+
|
70 |
+
## Completion
|
71 |
+
|
72 |
+
1. A markdown file providing a detailed set of instructions to the AI coding agent to execute this workflow as a next step
|
73 |
+
2. A list of challenges / potential concerns you have based on the users instructions and the current state of the code base of the app. These challenges will be passed to the AI coding agent along with the markdowns to ensure potential bottlenecks and blockers can be navigated appropriately, INCLUDING HOW YOU PLAN TO AVOID REGRESSION BUGS WHEN IMPLEMENTING NEW COMPONENTS AND FUNCTIONALITY
|