Initial import after prompting claude
This commit is contained in:
80
templates/base.html
Normal file
80
templates/base.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ballistic Analyzer</title>
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: system-ui, sans-serif;
|
||||
background: #f4f5f7;
|
||||
color: #222;
|
||||
min-height: 100vh;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 2rem 2.5rem;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||
}
|
||||
h1 { font-size: 1.8rem; margin-bottom: 1.5rem; color: #1a1a2e; }
|
||||
h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; color: #1a1a2e; border-bottom: 2px solid #e0e0e0; padding-bottom: 0.3rem; }
|
||||
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; color: #333; }
|
||||
a { color: #1f77b4; text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
.error {
|
||||
background: #fff0f0;
|
||||
border-left: 4px solid #e74c3c;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 1.25rem;
|
||||
color: #c0392b;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
th, td {
|
||||
text-align: left;
|
||||
padding: 0.55rem 0.9rem;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
th {
|
||||
background: #f0f4ff;
|
||||
font-weight: 600;
|
||||
color: #444;
|
||||
}
|
||||
tr:last-child td { border-bottom: none; }
|
||||
tr:hover td { background: #fafbff; }
|
||||
.group-section {
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 6px;
|
||||
padding: 1.25rem 1.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
.group-meta {
|
||||
font-size: 0.88rem;
|
||||
color: #666;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.chart-img {
|
||||
width: 100%;
|
||||
max-width: 860px;
|
||||
display: block;
|
||||
margin-top: 1rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
78
templates/results.html
Normal file
78
templates/results.html
Normal file
@@ -0,0 +1,78 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div style="display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:1rem;margin-bottom:1.5rem;">
|
||||
<h1 style="margin:0;">Analysis Results</h1>
|
||||
<div style="display:flex;gap:0.75rem;align-items:center;">
|
||||
<a href="/">← Upload another file</a>
|
||||
<a href="data:application/pdf;base64,{{ pdf_b64 }}"
|
||||
download="ballistic_report.pdf"
|
||||
style="background:#1f77b4;color:#fff;border-radius:4px;padding:0.5rem 1.1rem;font-size:0.9rem;text-decoration:none;">
|
||||
Download PDF report
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Overall Statistics</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Total shots</td><td>{{ overall.count }}</td></tr>
|
||||
<tr><td>Min speed</td><td>{{ "%.4f"|format(overall.min_speed) }}</td></tr>
|
||||
<tr><td>Max speed</td><td>{{ "%.4f"|format(overall.max_speed) }}</td></tr>
|
||||
<tr><td>Mean speed</td><td>{{ "%.4f"|format(overall.mean_speed) }}</td></tr>
|
||||
<tr>
|
||||
<td>Std dev (speed)</td>
|
||||
<td>
|
||||
{% if overall.std_speed is not none %}
|
||||
{{ "%.4f"|format(overall.std_speed) }}
|
||||
{% else %}
|
||||
–
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<img class="chart-img" src="data:image/png;base64,{{ overview_chart }}"
|
||||
alt="Avg speed and std dev per group" style="max-width:600px;margin:1rem 0 1.5rem;">
|
||||
|
||||
<h2>Groups — {{ groups_display|length }} group(s) detected</h2>
|
||||
|
||||
{% for stat, chart_b64 in groups_display %}
|
||||
<div class="group-section">
|
||||
<h3>Group {{ stat.group_index }}</h3>
|
||||
<div class="group-meta">
|
||||
{{ stat.time_start }} – {{ stat.time_end }} | {{ stat.count }} shot(s)
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Min speed</td><td>{{ "%.4f"|format(stat.min_speed) }}</td></tr>
|
||||
<tr><td>Max speed</td><td>{{ "%.4f"|format(stat.max_speed) }}</td></tr>
|
||||
<tr><td>Mean speed</td><td>{{ "%.4f"|format(stat.mean_speed) }}</td></tr>
|
||||
<tr>
|
||||
<td>Std dev (speed)</td>
|
||||
<td>
|
||||
{% if stat.std_speed is not none %}
|
||||
{{ "%.4f"|format(stat.std_speed) }}
|
||||
{% else %}
|
||||
–
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<img class="chart-img" src="data:image/png;base64,{{ chart_b64 }}" alt="Speed chart for group {{ stat.group_index }}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
30
templates/upload.html
Normal file
30
templates/upload.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Ballistic Analyzer</h1>
|
||||
|
||||
{% if error %}
|
||||
<div class="error">{{ error }}</div>
|
||||
{% endif %}
|
||||
|
||||
<p style="margin-bottom:1.5rem; color:#555;">
|
||||
Upload a CSV file to analyse shot groups. The file must contain the following columns:
|
||||
<strong>index</strong>, <strong>speed</strong>, <strong>standard deviation</strong>,
|
||||
<strong>energy</strong>, <strong>power factor</strong>, <strong>time of the day</strong>.
|
||||
</p>
|
||||
|
||||
<form method="POST" action="/analyze" enctype="multipart/form-data" style="display:flex;gap:1rem;align-items:center;flex-wrap:wrap;">
|
||||
<input
|
||||
type="file"
|
||||
name="csv_file"
|
||||
accept=".csv,text/csv"
|
||||
required
|
||||
style="border:1px solid #ccc;border-radius:4px;padding:0.5rem 0.75rem;background:#fafafa;font-size:0.95rem;"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
style="background:#1f77b4;color:#fff;border:none;border-radius:4px;padding:0.55rem 1.4rem;font-size:0.95rem;cursor:pointer;"
|
||||
>
|
||||
Analyze
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user