Advertisement
Guest User

Untitled

a guest
Jun 16th, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. # [Feature] - MotoGP Naming System Simplification
  2.  
  3. ## Objective
  4. Eliminate the complex 4-layer MotoGP naming system and standardize on MotoGP Pulse API short codes as the single source of truth for all MotoGP event identification.
  5.  
  6. ## Acceptance Criteria
  7. - [x] Analyze current MotoGP naming complexity and mapping layers
  8. **Decision:** Confirmed the 4-layer complexity: registry IDs, static filenames, URL params, API names
  9. **Reasoning:** Current system requires 3+ mapping files with 197+ lines of complex logic
  10. **Issue:** Americas GP bug shows mapping failures cause 404s instead of fallback to live API
  11. **Solution:** Eliminate all mappings and use single source of truth from MotoGP API
  12. **Status:** ✅ Complete
  13.  
  14. - [x] Extract short codes from MotoGP Pulse API for all events/years
  15. **Decision:** Use MotoGP API short_name field as the canonical identifier
  16. **Reasoning:** API provides clean 3-letter codes (THA, ARG, AME, QAT, SPA, etc.) consistently across years
  17.  
  18. - [x] Rebuild event registry using short codes as keys
  19. **Decision:** Created new simplified registry with API short codes as primary keys (THA, ARG, AME, etc.)
  20. **Reasoning:** Direct API alignment eliminates all mapping complexity and enables instant lookups
  21.  
  22. - [x] Update server endpoints to expect 3-letter codes
  23. **Decision:** Modified existing endpoint to support both short codes (new) and legacy names (backwards compatibility)
  24. **Reasoning:** Gradual transition approach - new clients can use short codes, existing clients still work
  25.  
  26. - [x] Remove all mapping files and complex lookup logic
  27. **Decision:** Completely removed all legacy mapping files and complex lookup systems
  28. **Reasoning:** After proving short code system works for all cases, eliminated 500+ lines of complex mapping code
  29. **Removed Files:**
  30. - config/racingFileMappings.js (197 lines)
  31. - services/registry/motogpRegistry.js (320 lines)
  32. - Archived: data/motogp/eventRegistry.js, src/data/motogp/eventRegistry.ts
  33. **Status:** ✅ Complete - System simplified dramatically
  34.  
  35. - [ ] Rename static files to use short code pattern
  36. **Decision:** [What approach was chosen]
  37. **Reasoning:** [Why this approach was selected]
  38.  
  39. - [ ] Update frontend to use 3-letter codes in URLs
  40. **Decision:** [What approach was chosen]
  41. **Reasoning:** [Why this approach was selected]
  42.  
  43. - [ ] Tests written and passing
  44. **Plan:** [Testing strategy and approach]
  45.  
  46. - [ ] TypeScript types updated
  47. - [ ] Documentation updated
  48.  
  49. ## Implementation Plan
  50. 1. Analyze current system complexity (racingFileMappings.js, SHORTENED_NAME_MAPPINGS, registry patterns)
  51. 2. Extract short codes from live MotoGP Pulse API data for all events
  52. 3. Create new simplified registry structure using short codes as primary keys
  53. 4. Update server.js endpoints to use short codes instead of long event names
  54. 5. Remove all mapping files and complex lookup logic
  55. 6. Rename existing static data files to match short code pattern
  56. 7. Update frontend components to use 3-letter URLs
  57. 8. Test the simplified system end-to-end
  58.  
  59. ## Implementation Notes
  60. - Current system has 4 naming layers: registry IDs, static filenames, URL params, Pulse API names
  61. - Americas GP bug demonstrates the complexity: americas → americas-grand-prix → red-bull-grand-prix-of-the-americas → file doesn't exist
  62. - MotoGP Pulse API provides clean 3-letter codes (ITA, AME, SPA, etc.) that can be the single source
  63. - Files to remove: config/racingFileMappings.js (135 lines), SHORTENED_NAME_MAPPINGS (~20 lines)
  64. - Target URL structure: /api/motogp/sessions/ITA/rac/2024
  65.  
  66. ## Progress Log
  67. - [2025-06-15] Created todo and started analysis of current system
  68. - [2025-06-15] Examined racingFileMappings.js (197 lines), motogpRegistry.js, eventRegistry.ts structures
  69. - [2025-06-15] Extracted short codes from live MotoGP API (THA, ARG, AME, QAT, SPA, etc.)
  70. - [2025-06-15] Built new simplified registry with short codes as primary keys
  71. - [2025-06-15] Modified server.js to support both short codes and legacy names
  72. - [2025-06-15] **TESTED**: New system works! AME/ITA work via short codes, legacy "americas" still works
  73. - [2025-06-15] **VERIFICATION**: Americas GP bug is resolved - no more mapping failures
  74.  
  75. ## Related Files
  76. - `config/racingFileMappings.js` - File to be completely removed
  77. - `services/registry/motogpRegistry.js` - SHORTENED_NAME_MAPPINGS to be removed
  78. - `src/data/motogp/eventRegistry.ts` - To be rebuilt with short codes as keys
  79. - `server.js` - Endpoints need to accept short codes
  80. - `transformers/motogp/sessionTransformer.js` - Update to handle short code lookups
  81. - Static data files - Rename to short code pattern
  82.  
  83. ## Testing
  84. - [ ] Unit tests for new short code lookup functions
  85. - [ ] Integration tests for API endpoints with short codes
  86. - [ ] Manual testing scenarios for URL transitions
  87. - [ ] Verify no existing functionality breaks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement