|
1 | | -# πΎ Tennis Match Prediction Application |
| 1 | +# JavaTraining-Capg |
2 | 2 |
|
3 | | -A comprehensive Spring Boot application that provides real-time tennis match predictions using AI algorithms. The application analyzes player statistics, head-to-head records, surface performance, and live match data to predict match winners, current game winners, and current set winners. |
4 | | - |
5 | | -## π Features |
6 | | - |
7 | | -### Core Prediction Capabilities |
8 | | -- **Match Winner Prediction**: Predicts the overall winner of a tennis match |
9 | | -- **Current Game Winner Prediction**: Predicts who will win the current game |
10 | | -- **Current Set Winner Prediction**: Predicts who will win the current set |
11 | | - |
12 | | -### Advanced Analytics |
13 | | -- **Player Statistics**: Comprehensive player profiles including rankings, surface performance, and recent form |
14 | | -- **Head-to-Head Records**: Historical match data between players |
15 | | -- **Live Match Data**: Real-time statistics and score tracking |
16 | | -- **Surface Analysis**: Performance analysis on different court surfaces (Hard, Clay, Grass) |
17 | | - |
18 | | -### Technical Features |
19 | | -- **RESTful API**: Complete API for all prediction and data operations |
20 | | -- **Real-time Updates**: Auto-refreshing dashboard with live match data |
21 | | -- **Modern UI**: Beautiful, responsive web interface |
22 | | -- **H2 Database**: In-memory database with sample data |
23 | | -- **Prediction Accuracy Tracking**: Monitor prediction success rates |
24 | | - |
25 | | -## π οΈ Technology Stack |
26 | | - |
27 | | -- **Backend**: Spring Boot 3.2.0 |
28 | | -- **Database**: H2 (In-memory) |
29 | | -- **Frontend**: Thymeleaf, Bootstrap 5, JavaScript |
30 | | -- **Build Tool**: Maven |
31 | | -- **Java Version**: 17 |
32 | | - |
33 | | -## π Prerequisites |
34 | | - |
35 | | -- Java 17 or higher |
36 | | -- Maven 3.6 or higher |
37 | | -- Modern web browser |
38 | | - |
39 | | -## π Quick Start |
40 | | - |
41 | | -### 1. Clone and Navigate |
42 | | -```bash |
43 | | -cd tennis-prediction-app |
44 | | -``` |
45 | | - |
46 | | -### 2. Build the Application |
47 | | -```bash |
48 | | -mvn clean install |
49 | | -``` |
50 | | - |
51 | | -### 3. Run the Application |
52 | | -```bash |
53 | | -mvn spring-boot:run |
54 | | -``` |
55 | | - |
56 | | -### 4. Access the Application |
57 | | -Open your browser and navigate to: |
58 | | -- **Main Dashboard**: http://localhost:8080/tennis-prediction/ |
59 | | -- **H2 Database Console**: http://localhost:8080/tennis-prediction/h2-console |
60 | | - - JDBC URL: `jdbc:h2:mem:tennisdb` |
61 | | - - Username: `sa` |
62 | | - - Password: `password` |
63 | | - |
64 | | -## π Sample Data |
65 | | - |
66 | | -The application comes pre-loaded with: |
67 | | - |
68 | | -### Top 10 ATP Players (2024 Rankings) |
69 | | -1. Novak Djokovic (Serbia) |
70 | | -2. Carlos Alcaraz (Spain) |
71 | | -3. Daniil Medvedev (Russia) |
72 | | -4. Jannik Sinner (Italy) |
73 | | -5. Andrey Rublev (Russia) |
74 | | -6. Stefanos Tsitsipas (Greece) |
75 | | -7. Alexander Zverev (Germany) |
76 | | -8. Holger Rune (Denmark) |
77 | | -9. Hubert Hurkacz (Poland) |
78 | | -10. Taylor Fritz (USA) |
79 | | - |
80 | | -### Sample Matches |
81 | | -- Live matches with real-time statistics |
82 | | -- Completed matches with full results |
83 | | -- Scheduled matches for future predictions |
84 | | - |
85 | | -### Head-to-Head Records |
86 | | -- Historical match data between all players |
87 | | -- Surface-specific performance records |
88 | | -- Recent match outcomes |
89 | | - |
90 | | -## π§ API Endpoints |
91 | | - |
92 | | -### Predictions |
93 | | -- `POST /api/predictions/match-winner/{matchId}` - Predict match winner |
94 | | -- `POST /api/predictions/game-winner/{matchId}` - Predict current game winner |
95 | | -- `POST /api/predictions/set-winner/{matchId}` - Predict current set winner |
96 | | -- `GET /api/predictions/match/{matchId}` - Get all predictions for a match |
97 | | -- `GET /api/predictions/latest/{matchId}/{predictionType}` - Get latest prediction |
98 | | -- `GET /api/predictions/accuracy` - Get prediction accuracy statistics |
99 | | - |
100 | | -### Matches |
101 | | -- `GET /api/matches` - Get all matches |
102 | | -- `GET /api/matches/live` - Get live matches |
103 | | -- `GET /api/matches/{matchId}` - Get match by ID |
104 | | -- `GET /api/matches/tournament/{tournamentName}` - Get matches by tournament |
105 | | -- `GET /api/matches/surface/{surface}` - Get matches by surface |
106 | | -- `POST /api/matches` - Create new match |
107 | | -- `PUT /api/matches/{matchId}` - Update match |
108 | | - |
109 | | -### Players |
110 | | -- `GET /api/players` - Get all players |
111 | | -- `GET /api/players/{playerId}` - Get player by ID |
112 | | -- `GET /api/players/name/{playerName}` - Get player by name |
113 | | -- `GET /api/players/top` - Get top ranked players |
114 | | -- `GET /api/players/country/{country}` - Get players by country |
115 | | -- `GET /api/players/surface/{surface}` - Get players by surface performance |
116 | | -- `GET /api/players/search/{namePattern}` - Search players by name |
117 | | -- `POST /api/players` - Create new player |
118 | | -- `PUT /api/players/{playerId}` - Update player |
119 | | - |
120 | | -### Head-to-Head |
121 | | -- `GET /api/head-to-head/{player1Id}/{player2Id}` - Get head-to-head record |
122 | | -- `GET /api/head-to-head/player/{playerId}` - Get player's head-to-head records |
123 | | - |
124 | | -### Statistics |
125 | | -- `GET /api/statistics` - Get application statistics |
126 | | - |
127 | | -## π― Prediction Algorithm |
128 | | - |
129 | | -The prediction system uses a weighted algorithm that considers: |
130 | | - |
131 | | -### Factors and Weights |
132 | | -- **Player Rankings** (15%): Current ATP rankings |
133 | | -- **Head-to-Head Records** (20%): Historical performance against opponent |
134 | | -- **Surface Performance** (15%): Win rates on specific surfaces |
135 | | -- **Recent Form** (15%): Recent match performance |
136 | | -- **Live Statistics** (25%): Current match statistics |
137 | | -- **Match Momentum** (10%): Current match flow and score |
138 | | - |
139 | | -### Prediction Types |
140 | | -1. **Match Winner**: Overall match outcome prediction |
141 | | -2. **Game Winner**: Current game prediction (focuses on serving and immediate momentum) |
142 | | -3. **Set Winner**: Current set prediction (considers set score and match momentum) |
143 | | - |
144 | | -## π¨ User Interface |
145 | | - |
146 | | -### Dashboard Features |
147 | | -- **Real-time Statistics**: Live match count, prediction accuracy, player rankings |
148 | | -- **Live Matches**: Current matches with real-time scores and statistics |
149 | | -- **Top Players**: Ranked list of top players with performance metrics |
150 | | -- **Recent Predictions**: Latest predictions with confidence scores and reasoning |
151 | | -- **Auto-refresh**: Dashboard updates every 30 seconds |
152 | | - |
153 | | -### Interactive Elements |
154 | | -- **Prediction Buttons**: One-click predictions for match, game, and set winners |
155 | | -- **Confidence Indicators**: Visual confidence levels for predictions |
156 | | -- **Detailed Reasoning**: Explanation of prediction factors |
157 | | -- **Responsive Design**: Works on desktop, tablet, and mobile devices |
158 | | - |
159 | | -## π Database Schema |
160 | | - |
161 | | -### Entities |
162 | | -- **Player**: Comprehensive player profiles with statistics |
163 | | -- **Match**: Live match data and scores |
164 | | -- **HeadToHead**: Historical match records between players |
165 | | -- **MatchPrediction**: Prediction results with confidence scores |
166 | | - |
167 | | -### Key Relationships |
168 | | -- Players have multiple matches (as player1 or player2) |
169 | | -- Matches have multiple predictions (different types) |
170 | | -- Players have head-to-head records with other players |
171 | | - |
172 | | -## π Deployment |
173 | | - |
174 | | -### Local Development |
175 | | -```bash |
176 | | -# Run with Maven |
177 | | -mvn spring-boot:run |
178 | | - |
179 | | -# Or build and run JAR |
180 | | -mvn clean package |
181 | | -java -jar target/tennis-prediction-app-1.0.0.jar |
182 | | -``` |
183 | | - |
184 | | -### Production Deployment |
185 | | -1. Build the application: `mvn clean package` |
186 | | -2. Deploy the JAR file to your server |
187 | | -3. Configure database connection (switch from H2 to production database) |
188 | | -4. Set up external API keys for live data feeds |
189 | | - |
190 | | -## π§ Configuration |
191 | | - |
192 | | -### Application Properties |
193 | | -```properties |
194 | | -# Server Configuration |
195 | | -server.port=8080 |
196 | | -server.servlet.context-path=/tennis-prediction |
197 | | - |
198 | | -# Database Configuration |
199 | | -spring.datasource.url=jdbc:h2:mem:tennisdb |
200 | | -spring.datasource.username=sa |
201 | | -spring.datasource.password=password |
202 | | - |
203 | | -# Prediction Settings |
204 | | -tennis.prediction.model.threshold=0.6 |
205 | | -tennis.prediction.update-interval=30000 |
206 | | -``` |
207 | | - |
208 | | -## π Future Enhancements |
209 | | - |
210 | | -### Planned Features |
211 | | -- **Machine Learning Integration**: Advanced ML models for better predictions |
212 | | -- **External API Integration**: Real-time data from FlashScore, ATP, etc. |
213 | | -- **User Authentication**: User accounts and personalized predictions |
214 | | -- **Mobile App**: Native mobile application |
215 | | -- **Advanced Analytics**: Detailed statistical analysis and visualizations |
216 | | -- **Tournament Brackets**: Tournament prediction and bracket management |
217 | | - |
218 | | -### Technical Improvements |
219 | | -- **Microservices Architecture**: Split into separate services |
220 | | -- **Real-time WebSocket**: Live updates via WebSocket |
221 | | -- **Caching Layer**: Redis for improved performance |
222 | | -- **Containerization**: Docker support for easy deployment |
223 | | - |
224 | | -## π€ Contributing |
225 | | - |
226 | | -1. Fork the repository |
227 | | -2. Create a feature branch |
228 | | -3. Make your changes |
229 | | -4. Add tests for new functionality |
230 | | -5. Submit a pull request |
231 | | - |
232 | | -## π License |
233 | | - |
234 | | -This project is licensed under the MIT License - see the LICENSE file for details. |
235 | | - |
236 | | -## π Support |
237 | | - |
238 | | -For support and questions: |
239 | | -- Create an issue in the repository |
240 | | -- Check the API documentation |
241 | | -- Review the sample data and configurations |
242 | | - |
243 | | -## π― Quick Test |
244 | | - |
245 | | -1. Start the application |
246 | | -2. Navigate to http://localhost:8080/tennis-prediction/ |
247 | | -3. View the live matches |
248 | | -4. Click "Predict Winner" on any live match |
249 | | -5. See the prediction with confidence score and reasoning |
250 | | - |
251 | | -The application is ready to use immediately with sample data and working predictions! |
| 3 | +this repo contains all practices related to basic java and advanced java. |
| 4 | +covering spring , servlet , junit , logger,PMD etc |
0 commit comments