Files
beantownbabeandClaude Sonnet 4.6 27a59671fc Initial commit: HiActs Conference Poll app
Flask poll app for the Hi-Acts 3rd Network Meeting at DESY Hamburg,
10 June 2026. Includes 11-question poll, live D3 bubble chart display,
7-page PDF analysis report, admin dashboard, and CSV export.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:38:17 +02:00

233 lines
6.9 KiB
Python

"""
Demo seeder for boss presentation.
Populates 20 simulated participant responses, then prints instructions.
Usage:
python3 seed_demo.py
"""
import urllib.request
import urllib.error
import json
BASE_URL = "http://localhost:5001"
def post(path, data):
body = json.dumps(data).encode()
req = urllib.request.Request(
BASE_URL + path,
data=body,
headers={"Content-Type": "application/json"},
method="POST"
)
with urllib.request.urlopen(req) as resp:
return json.loads(resp.read())
# 20 simulated participants, one response set each
# Designed to produce an interesting, realistic bubble chart
SIMULATED_RESPONSES = [
# Q1: Role, Q2: Logbook word, Q3: Obstacle, Q4: Standardisation, Q5: Documentation, Q6: Vision
(
"Beamline Scientist",
"chaotic",
"Different control systems (TANGO, EPICS, SPOCK)",
"Necessary and overdue",
"Partial, depends on the scientist",
"Automated cross-facility comparison without manual conversion"
),
(
"Beamline Scientist",
"fragmented",
"Inconsistent logbook formats",
"Necessary and overdue",
"Partial, depends on the scientist",
"Shared analysis pipelines that work on any beamline data"
),
(
"Industry User",
"opaque",
"Missing or incomplete metadata",
"Necessary and overdue",
"Barely documented",
"Getting our own data back without asking the beamline scientist to translate it"
),
(
"Beamline Scientist",
"manual",
"Different control systems (TANGO, EPICS, SPOCK)",
"Desirable but very difficult",
"Mostly documented, some gaps",
"Reproducible experiments across DESY, ESRF and Diamond"
),
(
"Instrument Scientist",
"inconsistent",
"Manual re-scripting for every beamline",
"Necessary and overdue",
"Partial, depends on the scientist",
"One analysis script that runs on data from any facility worldwide"
),
(
"Industry User",
"black box",
"Missing or incomplete metadata",
"Necessary and overdue",
"Barely documented",
"Direct data delivery to our in-house systems without post-processing"
),
(
"Control System / IT",
"custom",
"Different control systems (TANGO, EPICS, SPOCK)",
"Desirable but very difficult",
"Mostly documented, some gaps",
"A single integration layer instead of ten bespoke adapters"
),
(
"Beamline Scientist",
"paper",
"Inconsistent logbook formats",
"Necessary and overdue",
"Partial, depends on the scientist",
"Pooled datasets across facilities for machine learning models"
),
(
"Industry User",
"incomplete",
"No common file format standard",
"Desirable but very difficult",
"Barely documented",
"Automated quality reports in a format our QA team actually understands"
),
(
"Beamline Scientist",
"scattered",
"Different control systems (TANGO, EPICS, SPOCK)",
"Necessary and overdue",
"Partial, depends on the scientist",
"Publishing FAIR data with zero extra effort after the experiment"
),
(
"Instrument Scientist",
"fragmented",
"Inconsistent logbook formats",
"Desirable but very difficult",
"Mostly documented, some gaps",
"Collaborative experiments where two facilities contribute data to one analysis"
),
(
"Industry User",
"slow",
"Missing or incomplete metadata",
"Too rigid for our experimental needs",
"Mostly documented, some gaps",
"Faster time from experiment to usable result for our product development"
),
(
"Beamline Scientist",
"mixed",
"Different control systems (TANGO, EPICS, SPOCK)",
"Necessary and overdue",
"Partial, depends on the scientist",
"Finding and reusing data from experiments done five years ago"
),
(
"Control System / IT",
"outdated",
"Manual re-scripting for every beamline",
"Desirable but very difficult",
"Partial, depends on the scientist",
"Plug-and-play data connectors between control systems and analysis tools"
),
(
"Instrument Scientist",
"informal",
"Inconsistent logbook formats",
"Necessary and overdue",
"Barely documented",
"Automatic FAIR compliance without a separate data curation step"
),
(
"Beamline Scientist",
"unreliable",
"Different control systems (TANGO, EPICS, SPOCK)",
"Necessary and overdue",
"Mostly documented, some gaps",
"Comparing strain measurements across different beamlines in one click"
),
(
"Industry User",
"confusing",
"No common file format standard",
"Not our problem to solve",
"Barely documented",
"Receiving data already formatted for our simulation software"
),
(
"Beamline Scientist",
"analog",
"Inconsistent logbook formats",
"Desirable but very difficult",
"Fully documented, reproducible",
"A European data commons for synchrotron experiments"
),
(
"Instrument Scientist",
"messy",
"Different control systems (TANGO, EPICS, SPOCK)",
"Necessary and overdue",
"Partial, depends on the scientist",
"Less time cleaning data, more time doing science"
),
(
"Beamline Scientist",
"evolving",
"Missing or incomplete metadata",
"Too rigid for our experimental needs",
"Mostly documented, some gaps",
"Real-time data quality feedback during the experiment itself"
),
]
def main():
print("Resetting existing data...")
post("/admin/reset", {})
print("Seeding 20 simulated participants...")
entries = []
for row in SIMULATED_RESPONSES:
q1, q2, q3, q4, q5, q6 = row
entries += [
{"question_id": 1, "answer": q1},
{"question_id": 2, "answer": q2},
{"question_id": 3, "answer": q3},
{"question_id": 4, "answer": q4},
{"question_id": 5, "answer": q5},
{"question_id": 6, "answer": q6},
]
result = post("/admin/seed", entries)
print(f"Done. {result['total']} total answers loaded.\n")
print("=" * 56)
print(" PRESENTATION READY")
print("=" * 56)
print()
print(" Display (bubble chart, fullscreen):")
print(" http://localhost:5001/display?demo=1")
print()
print(" Poll (for boss to try on phone):")
print(" http://localhost:5001")
print()
print(" Admin (reset / view raw data):")
print(" http://localhost:5001/admin")
print("=" * 56)
if __name__ == "__main__":
main()