This commit includes: 1. Database Configuration Migration: - Migrated from DB.txt (Java JDBC) to .env (python-dotenv) - Added .env.example template with clear variable names - Updated database.py to use environment variables - Added python-dotenv>=1.0.0 to dependencies - Updated .gitignore to exclude sensitive files 2. Validation System (1,294 lines): - comparator.py: Statistical comparison with RMSE, correlation, tolerances - db_extractor.py: Database queries for all sensor types - validator.py: High-level validation orchestration - cli.py: Command-line interface for validation - README.md: Comprehensive validation documentation 3. Validation Features: - Compare Python vs MATLAB outputs from database - Support for all sensor types (RSN, Tilt, ATD) - Statistical metrics: max abs/rel diff, RMSE, correlation - Configurable tolerances (abs, rel, max) - Detailed validation reports - CLI and programmatic APIs 4. Examples and Documentation: - validate_example.sh: Bash script example - validate_example.py: Python programmatic example - Updated main README with validation section - Added validation workflow and troubleshooting guide Benefits: - ✅ No Java driver needed (native Python connectors) - ✅ Secure .env configuration (excluded from git) - ✅ Comprehensive validation against MATLAB - ✅ Statistical confidence in migration accuracy - ✅ Automated validation reports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
2.1 KiB
Bash
Executable File
58 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script per sincronizzare file .m da un server remoto a una directory locale
|
|
# e fare il commit delle modifiche in un repository Git locale.
|
|
|
|
REMOTE_USER="alex"
|
|
REMOTE_HOST="80.211.60.65"
|
|
REMOTE_PORT="2022"
|
|
REMOTE_SRC="/usr/local/matlab_func"
|
|
LOCAL_DST="/home/alex/devel/matlab-ase"
|
|
# ------------------------------------------------
|
|
# 1. Esecuzione di Rsync (Mirroring dal remoto al locale)
|
|
# Include: -a (archive), -v (verbose), -z (compress), --delete (mirroring)
|
|
# Filtri: include directory (*/), include solo *.m, esclude *mcrCache*, esclude tutto il resto (*)
|
|
echo "Inizio sincronizzazione da ${REMOTE_HOST}..."
|
|
|
|
rsync -avzm --delete -e "ssh -p ${REMOTE_PORT}" \
|
|
--include='*/' \
|
|
--include='*.m' \
|
|
--exclude='*' \
|
|
"${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_SRC}" "${LOCAL_DST}"
|
|
|
|
# 2. Verifica se rsync è andato a buon fine
|
|
if [ $? -eq 0 ]; then
|
|
echo "Sincronizzazione completata con successo."
|
|
else
|
|
echo "Errore durante la sincronizzazione Rsync."
|
|
exit 1
|
|
fi
|
|
|
|
# 3. Preparazione del messaggio di commit con la data attuale
|
|
SYNC_DATE=$(date +"%Y-%m-%d %H:%M:%S")
|
|
COMMIT_MSG="Sync from remote server: ${SYNC_DATE}"
|
|
|
|
# 4. Aggiungi SOLO i file .m modificati o nuovi all'area di staging
|
|
echo "Aggiungo SOLO i file .m al Git staging area..."
|
|
|
|
# Utilizza 'find' per trovare tutti i file .m in modo ricorsivo e li passa a 'git add'
|
|
find "${LOCAL_DST}" -type f -name "*.m" -print0 | xargs -0 git add
|
|
|
|
# 5. Esegui il commit con il messaggio datato
|
|
echo "Eseguo il commit con messaggio: \"${COMMIT_MSG}\""
|
|
CHANGED_FILES_NUM=$(git diff --staged --name-only | wc -l)
|
|
CHANGED_FILES=$(git diff --staged --name-only)
|
|
|
|
git commit -m "${COMMIT_MSG}"
|
|
|
|
# 6. Verifica se il commit ha prodotto modifiche
|
|
if [ $? -eq 0 ]; then
|
|
echo "Commit completato con successo."
|
|
echo "Numero di file modificati/aggiunti: ${CHANGED_FILES_NUM}"
|
|
# comando a claude per vedere i file cambiati e verificare le modifiche da riportare nella traduzione python
|
|
else
|
|
# Questo succede se non ci sono state modifiche (rsync non ha trovato nulla da aggiornare)
|
|
echo "Nessuna modifica rilevata; commit saltato."
|
|
fi
|
|
|
|
echo "Processo sync completato." |