analizza_export.ps1β’5.41 kB
# Script PowerShell per analisi dei file esportati
# Da eseguire dopo l'export manuale
$exportDir = "C:\temp\visum_analysis_20250805_184029"
Write-Host "π ANALISI FILE ESPORTATI VISUM CAMPOLEONE" -ForegroundColor Cyan
Write-Host "=" * 50
Write-Host "Directory: $exportDir" -ForegroundColor Yellow
Write-Host ""
if (Test-Path $exportDir) {
$csvFiles = Get-ChildItem -Path $exportDir -Filter "*.csv"
if ($csvFiles.Count -gt 0) {
Write-Host "π FILE CSV TROVATI:" -ForegroundColor Green
foreach ($file in $csvFiles) {
$sizeKB = [math]::Round($file.Length / 1KB, 1)
$sizeMB = [math]::Round($file.Length / 1MB, 2)
Write-Host ""
Write-Host "π $($file.Name)" -ForegroundColor White
if ($sizeMB -gt 1) {
Write-Host " Dimensione: $sizeMB MB" -ForegroundColor Yellow
} else {
Write-Host " Dimensione: $sizeKB KB" -ForegroundColor Yellow
}
# Analizza contenuto
try {
$content = Get-Content $file.FullName -TotalCount 10
$lineCount = (Get-Content $file.FullName | Measure-Object).Count
Write-Host " Righe totali: $($lineCount - 1)" -ForegroundColor Cyan
Write-Host " Header: $($content[0])" -ForegroundColor Gray
if ($content.Count -gt 1) {
Write-Host " Esempio dati: $($content[1])" -ForegroundColor Gray
}
# Analisi specifica per tipo file
switch -Wildcard ($file.Name) {
"nodes*" {
Write-Host " β Analisi NODI della rete" -ForegroundColor Green
$nodeCount = $lineCount - 1
Write-Host " β Numero nodi: $nodeCount" -ForegroundColor White
}
"links*" {
Write-Host " β Analisi LINK/ARCHI della rete" -ForegroundColor Green
$linkCount = $lineCount - 1
Write-Host " β Numero link: $linkCount" -ForegroundColor White
# Calcola densitΓ rete se abbiamo entrambi i file
$nodesFile = Get-ChildItem -Path $exportDir -Filter "nodes*.csv" | Select-Object -First 1
if ($nodesFile) {
$nodeLines = (Get-Content $nodesFile.FullName | Measure-Object).Count
$nodeCount = $nodeLines - 1
if ($nodeCount -gt 0) {
$density = [math]::Round($linkCount / $nodeCount, 2)
Write-Host " β DensitΓ rete: $density link/nodo" -ForegroundColor Magenta
}
}
}
"zones*" {
Write-Host " β Analisi ZONE di traffico" -ForegroundColor Green
$zoneCount = $lineCount - 1
Write-Host " β Numero zone: $zoneCount" -ForegroundColor White
}
"link_types*" {
Write-Host " β Analisi TIPI DI LINK" -ForegroundColor Green
$typeCount = $lineCount - 1
Write-Host " β Tipi definiti: $typeCount" -ForegroundColor White
}
"volcap*" {
Write-Host " β Analisi FUNZIONI VOLUME-CAPACITΓ" -ForegroundColor Green
$formulaCount = $lineCount - 1
Write-Host " β Formule disponibili: $formulaCount" -ForegroundColor White
}
}
} catch {
Write-Host " β Errore lettura file: $($_.Exception.Message)" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "π― RIEPILOGO ANALISI:" -ForegroundColor Cyan
Write-Host "====================="
Write-Host "β
File esportati: $($csvFiles.Count)" -ForegroundColor Green
$totalSizeMB = [math]::Round(($csvFiles | Measure-Object Length -Sum).Sum / 1MB, 2)
Write-Host "π Dimensione totale: $totalSizeMB MB" -ForegroundColor Yellow
Write-Host ""
Write-Host "π PROSSIMI PASSI:" -ForegroundColor Cyan
Write-Host "1. Apri i file CSV in Excel per ispezione visuale"
Write-Host "2. Usa Python/R per analisi statistica approfondita"
Write-Host "3. Crea visualizzazioni della topologia di rete"
Write-Host "4. Analizza distribuzioni velocitΓ e capacitΓ "
Write-Host "5. Calcola metriche di accessibilitΓ "
} else {
Write-Host "β Nessun file CSV trovato!" -ForegroundColor Red
Write-Host "π‘ Esegui prima l'export manuale seguendo la guida." -ForegroundColor Yellow
}
} else {
Write-Host "β Directory non trovata: $exportDir" -ForegroundColor Red
Write-Host "π‘ Verifica che l'export sia stato completato." -ForegroundColor Yellow
}
Write-Host ""
Write-Host "=" * 50
Write-Host "π ANALISI COMPLETATA!" -ForegroundColor Green
Write-Host "=" * 50