How tescrihuela/tdf works
Project Type and Purpose
• Type: A full-stack (primarily backend-driven) web dashboard application.
• Purpose: To scrape and process cycling (Tour de France) results from an external website and then calculate and display fantasy scores on a web interface.
Main Components
a. Web Server & User Interface:
– Represented by “app.py”: This is the entry point managing HTTP requests and serving the web UI.
– “assets” directory: Contains static resources such as CSS, JavaScript, and images that enhance the dashboard’s frontend.
b. Data Processing & Scraping:
– “tdf.py”: Likely includes logic to scrape results from the Tour de France website.
– “data2021.py”, “data2023.py”, “data2024.py”: These modules probably handle specific data processing or normalization for each year's data.
– “ranking.csv”: Serves as a lightweight data storage holding the current or historical rankings used for score calculations.
c. External Services:
– The project relies on external data from https://tourdefrance2023.fr/ for scraping results.
– The calculated scores are compared with those on https://fantasy.letour.fr/ (mentioned in the README) as part of the fantasy score logic.
Relationships and Interactions
• The web server (app.py) acts as the orchestrator: when a user accesses the dashboard, it may trigger data updates by calling functions from “tdf.py” to scrape the latest results.
• The scraped data is then processed by the year-specific modules to ensure that each dataset (2021, 2023, 2024) is accurately handled and integrated.
• Processed data is stored or referenced via “ranking.csv” for score calculations.
• Finally, the computed results are rendered and served on the web interface, using static assets from the “assets” directory.
Architectural Patterns and Technologies
• Modular design – Keeping concerns separated for web serving, scraping, and data processing.
• Lightweight persistence – Utilizing a CSV file as a simple database which might be replaced/enhanced in future iterations.
• Clearly delineated coding areas for each year's data suggests ease of maintenance and scalability for handling historical data.
• The project dependencies are managed via “requirements.txt”, indicating the use of common Python libraries (possibly Flask, Requests, or BeautifulSoup).