Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,5 @@ data/Create_data/api_football/venues.xlsx
data/Create_data/api_football/api_test.py
data/Create_data/api_football/api_test.json
*ensemble_40
*prompts
*prompts
.sonarlint/connectedMode.json
Comment on lines +162 to +163

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Tighten ignore patterns for prompts and SonarLint (prevent accidental IP/secret leakage).

  • Line 162: *prompts only matches names ending with “prompts” (won’t cover prompt_*.txt or a prompts/ dir). Use a directory or broader pattern per your intent.
  • Line 163: Ignoring only .sonarlint/connectedMode.json can still leak other .sonarlint local artifacts. Prefer ignoring the whole .sonarlint/ dir.

Recommended change:

-*prompts
-.sonarlint/connectedMode.json
+# If you want to ignore a top-level prompts directory:
+prompts/
+# Or, to ignore any 'prompts' directory anywhere:
+# **/prompts/**
+# If the intent is to ignore all prompt-related artifact files:
+# *prompt*
+
+# Ignore all SonarLint local artifacts (safer; prevents token leaks)
+.sonarlint/

Run to verify if anything sensitive is already tracked:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Tracked SonarLint files:"
git ls-files -z | tr '\0' '\n' | rg -n '^\.sonarlint/'

if git ls-files --error-unmatch .sonarlint/connectedMode.json >/dev/null 2>&1; then
  echo "WARNING: .sonarlint/connectedMode.json is tracked."
fi

echo
echo "Tracked prompt artifacts (review before broad ignores):"
git ls-files -z | tr '\0' '\n' | rg -n '(?i)(^|/)(prompts)(/|$)|\bprompt'

Length of output: 24


Tighten .gitignore patterns for prompts and SonarLint

  • Line 162: replace *prompts with an explicit pattern matching your intent (e.g. prompts/, **/prompts/** or *prompt*)
  • Line 163: replace .sonarlint/connectedMode.json with .sonarlint/ to ignore all SonarLint artifacts
🤖 Prompt for AI Agents
In .gitignore around lines 162 to 163, the patterns are too broad/specific:
replace the ambiguous "*prompts" with the explicit pattern that matches your
intent (for example use "prompts/" to ignore a top-level prompts directory,
"**/prompts/**" to ignore any prompts directory recursively, or "*prompt*" to
match files containing "prompt"), and replace ".sonarlint/connectedMode.json"
with ".sonarlint/" to ignore the entire SonarLint directory and all its
artifacts.

9 changes: 6 additions & 3 deletions data/Create_data/add_ELO_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pandas as pd
import python_calamine as calamine
from api_football.add_current_features_postgre import export_to_xlsx_fast
from openpyxl import Workbook


class ELOCalculator:
Expand All @@ -24,12 +23,16 @@ def __init__(self, logger=None):

# Define data paths
# self.api_prediction_data_path = "./data_files/api_football_prediction_newPoisson.xlsx"
self.api_prediction_data_path_new = "./data_files/api_football_prediction_new_newPoisson.xlsx"
self.api_prediction_data_path_new = (
"./data_files/api_football_prediction_new_newPoisson.xlsx"
)
# self.api_training_data_path = "./data_files/api_football_training_newPoisson.xlsx"

# Define export paths
# self.api_prediction_export_path = "./data_files/api_football_prediction_newPoisson.xlsx"
self.api_prediction_export_path_new = "./data_files/api_football_prediction_new_newPoisson.xlsx"
self.api_prediction_export_path_new = (
"./data_files/api_football_prediction_new_newPoisson.xlsx"
)
# self.api_training_export_path = "./data_files/api_football_training_newPoisson.xlsx"

# ELO settings
Expand Down
16 changes: 11 additions & 5 deletions data/Create_data/add_poisson_xG.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import python_calamine as calamine
import statsmodels.api as sm
from api_football.add_current_features_postgre import export_to_xlsx_fast
from openpyxl import Workbook
from sklearn.linear_model import PoissonRegressor
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.preprocessing import StandardScaler
Expand Down Expand Up @@ -283,7 +282,9 @@ def predict(self, df: pd.DataFrame) -> pd.DataFrame:
self.logger.error(f"Error in prediction: {str(e)}")
raise

def add_poisson_xG(self, df: pd.DataFrame, base_df: pd.DataFrame, type: str, is_training: bool = False) -> pd.DataFrame:
def add_poisson_xG(
self, df: pd.DataFrame, base_df: pd.DataFrame, type: str, is_training: bool = False
) -> pd.DataFrame:
# Sort by date if available
if "Datum" in df.columns:
df["Datum"] = pd.to_datetime(df["Datum"])
Expand All @@ -309,7 +310,7 @@ def add_poisson_xG(self, df: pd.DataFrame, base_df: pd.DataFrame, type: str, is_
"api_prediction": ("./data_files/api_football_prediction_newPoisson.xlsx"),
"api_prediction_new": ("./data_files/api_football_prediction_new_newPoisson.xlsx"),
"api_training": ("./data_files/api_football_training_newPoisson.xlsx"),
"api_future": ("./data_files/api_football_future_newPoisson.xlsx")
"api_future": ("./data_files/api_football_future_newPoisson.xlsx"),
}

output_path = datasets[type]
Expand Down Expand Up @@ -372,8 +373,13 @@ def process_data(self):
"away_points_cum": "Away_points_cum",
}
)

self.add_poisson_xG(api_prediction_data_new, api_prediction_data_new, "api_prediction_new", is_training=True)

self.add_poisson_xG(
api_prediction_data_new,
api_prediction_data_new,
"api_prediction_new",
is_training=True,
)
self.add_poisson_xG(api_future_data, api_future_data, "api_future")
except Exception as e:
self.logger.error(f"Error in data processing: {str(e)}")
Expand Down
Loading