Skip to content

Add phet_simulations mirror site (port 40015)#29

Open
ZhongyangLi0124 wants to merge 2 commits into
aiming-lab:mainfrom
ZhongyangLi0124:add-phet-simulations
Open

Add phet_simulations mirror site (port 40015)#29
ZhongyangLi0124 wants to merge 2 commits into
aiming-lab:mainfrom
ZhongyangLi0124:add-phet-simulations

Conversation

@ZhongyangLi0124
Copy link
Copy Markdown

@ZhongyangLi0124 ZhongyangLi0124 commented May 18, 2026

Summary

Adds a 16th mirror site to WebHarbor: PhET Interactive Simulations
(https://phet.colorado.edu/). Bound to port 40015.

Real site: University of Colorado Boulder's CC-BY-licensed catalog of
free interactive math and science simulations. Selected for its clean
taxonomy (subjects × grade bands × languages), stable academic content,
and no commercial anti-bot defenses.

Seeded catalog

Dimension Count
Simulations 98
Subjects 5 (physics, chemistry, math, biology, earth-science)
Grade levels 4 (elementary, middle, high, university)
Languages 28 (including Arabic, Hebrew, Persian RTL)
Teacher activities 14
Benchmark users 4
Benchmark tasks 43

Visual fidelity

Mirror is reskinned to closely match the real PhET site:

  • Real PhET trademark logo + CU Boulder logo, right-aligned nav
    (Simulations / Studio / Teaching / Research / Initiatives)
  • Photo-backed homepage hero, pastel subject squares in canonical order,
    photo-backed Teaching Resources callout, Interact/Discover/Learn stats,
    second STEM hero, sponsor footer (Moore / NSF / Hewlett / Mastercard / Yidan)
  • /simulations Browse / Filter / Customize tabs with underwater banner;
    Filter view has left-sidebar with collapsible subject tree, grade level,
    compatibility, locale, active-filter chips, sort
  • Simulation detail page with tabs (About / Teaching / Translations /
    Credits), large screenshot, supported-by sidebar, Donate CTA
  • Dismissible educator banner

Assets ship via the paired HF dataset PR (see below). 98 sim screenshots
(49 from PhET CDN, 49 styled placeholders for slugs not in HTML5 lib),
plus logos, sponsor logos, hero photos, subject icons, app-store badges,
underwater banner. ~5 MB tarball total.

Paired HF dataset PR

https://huggingface.co/datasets/ChilleD/WebHarbor/discussions/19

This PR is in Draft status until the HF PR merges. Once merged,
.assets-revision will be bumped to the merge commit SHA and the
draft will be marked ready for review.

Test plan

  • python3 -m py_compile sites/phet_simulations/app.py
  • ./scripts/build.sh succeeds (3.07 GB image)
  • docker run -d --rm -p 8101:8101 -p 40000-40015:40000-40015 webharbor:dev
  • Control plane reports phet_simulations alive on port 40015
  • All 10 key routes return 200 (/, /simulations, /simulations?view=browse,
    /simulations?view=filter&subject=physics, /simulation/build-an-atom,
    /simulation/algebra-tiles, /teachers, /translations, /about,
    /accessibility)
  • POST /reset/phet_simulations returns "ready": true
  • Byte-identical reset verified: md5 of instance/phet_simulations.db
    and instance_seed/phet_simulations.db both equal
    e094a2ee23369d3b60232f49f4ac691c post-reset and after docker restart

Reset evidence

POST /reset/phet_simulations  ->  {"pid":151,"ready":true,"site":"phet_simulations"}

e094a2ee23369d3b60232f49f4ac691c  /opt/WebSyn/phet_simulations/instance/phet_simulations.db
e094a2ee23369d3b60232f49f4ac691c  /opt/WebSyn/phet_simulations/instance_seed/phet_simulations.db

ZhongyangLi0124 and others added 2 commits May 18, 2026 07:54
Adds Flask app, templates, and seed DB for PhET Interactive Simulations
(https://phet.colorado.edu/), claiming port slot 40015.

Catalog: 98 simulations across 5 subjects (physics, chemistry, math,
biology, earth-science), 4 grade levels (elementary, middle, high,
university), and 28 languages (incl. 3 RTL scripts). Every primary
filter bucket clears the >=20-record threshold.

Models: User, Subject, GradeLevel, Language, Simulation, Activity,
SavedSimulation. Routes: 17 public + 2 JSON APIs + /_health, all
reachable from /. Auth via Flask-Login + bcrypt; saves via CSRF-protected
JSON endpoints.

Idempotency: every seed_* helper early-returns when its table is
populated; verified byte-identical (md5 e094a2ee...) across the
control_server reset cycle (rm -rf instance; cp -a instance_seed instance;
re-import app). Tested under the exact Dockerfile pin set (Flask 3.1.0,
SQLAlchemy 2.0.36, Werkzeug 3.1.3).

Per the port-slot convention, also:
- websyn_start.sh: append to SITES, bump 15 -> 16 in startup messages
- control_server.py: append 'phet_simulations' to SITES list
- Dockerfile: EXPOSE 40000-40014 -> 40000-40015

Seed DB (instance_seed/phet_simulations.db, 143KB) packs into a 17KB
phet_simulations.tar.gz via scripts/extract_assets.sh and ships
separately via the Hugging Face dataset. .assets-revision will need a
bump after the HF PR merges.

tasks.jsonl: 43 benchmark prompts covering catalog browse, subject
filters, simulation detail extraction, search, translations, teacher
activities, and the account save flow.
Replace placeholder UI with a high-fidelity mirror of the real
PhET Interactive Simulations site.

Visual:
- Real PhET yellow trademark logo + CU Boulder logo in white header bar
- Right-aligned nav (Simulations / Studio / Teaching / Research / Initiatives)
  with hover dropdowns; collapsing search icon + profile icon
- Dismissible pink educator banner
- Photo-backed top hero ("Interactive Simulations for Science and Math")
- 5 pastel subject squares in PhET's canonical order (Physics, Math &
  Statistics, Chemistry, Earth & Space, Biology) with their SVG icons
- Photo-backed Teaching Resources callout
- "Interact. Discover. Learn." stats section with real iconography
- Secondary STEM hero photo + centered "Supported in part by" + Donate CTA
- Real footer: social row, 4-column links, language selector, app-store
  badges, sponsor logos strip (Moore, Hewlett, NSF, Mastercard, Yidan)

Simulations browse page:
- Underwater illustration banner + Browse / Filter / Customize sub-tabs
- Filter view is the default; left sidebar with collapsible subject tree,
  grade level, compatibility, release type, inclusive features, locale,
  apply / clear, active-filter chips, sort dropdown, results count
- Browse view groups sims by subject with "View all »" links

Simulation detail page:
- Large screenshot with hover "Play" overlay
- Tabbed sections (About / Teaching Resources / Activities /
  Translations / Credits) plus topics, learning goals, related sims
- "Supported by" sidebar, share row, pink Explore More + Donate CTA

Backend wiring:
- Index route adds total_activities for the stats section
- Simulations route exposes view tab and per-subject buckets
- App.py exposes available_thumbnails so cards fall back gracefully
  when a slug has no screenshot

Assets ship via the paired HF dataset tarball (not committed):
- 98 sim screenshots (49 from PhET CDN, 49 generated placeholders)
- PhET + CU Boulder logos, subject icons, sponsor logos, hero photos,
  app-store badges, underwater simulations banner

Seed DB unchanged, /reset/phet_simulations remains byte-identical
(md5 e094a2ee23369d3b60232f49f4ac691c).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ZhongyangLi0124 ZhongyangLi0124 marked this pull request as ready for review May 19, 2026 19:26
hqhq1025 pushed a commit to hqhq1025/WebHarbor that referenced this pull request May 26, 2026
hqhq1025 pushed a commit to hqhq1025/WebHarbor that referenced this pull request May 26, 2026
Conflicts resolved:
- websyn_start.sh / control_server.py: append berkeley after phet_simulations
  (PR base predated aiming-lab#29).
- Dockerfile EXPOSE 40000-40015 → 40000-40016.

Fixes on top of PR:
- sites/berkeley/seed_data.py: pin bcrypt hash for benchmark users.
  set_password() uses bcrypt.generate_password_hash which mixes a random
  salt on every call, breaking the byte-identical reset invariant. We
  store a pinned $2b$12$ hash for 'test1234' directly; check_password_hash
  still accepts it so login works unchanged.
- sites/berkeley/app.py: __main__ port 40015 → 40016 (cosmetic — site_runner
  passes port via -c string, not via __main__).
hqhq1025 pushed a commit to hqhq1025/WebHarbor that referenced this pull request May 26, 2026
Conflicts resolved:
- websyn_start.sh: keep PR's dynamic count (${#SITES[@]}) — removes the
  hardcoded "16" from aiming-lab#11/aiming-lab#29 base; append drugs_com after berkeley.
- control_server.py: append drugs_com after berkeley.
- Dockerfile EXPOSE 40000-40016 → 40000-40017; keep berkeley build-time
  RUN; pick up requests==2.32.3 dep from PR.
- .gitignore: merge both sides (keep main's dashboard ignores + PR's
  local artifact ignores).

Note: drugs_com seeds via pre-built HF db (refs/pr/13), so the dynamic
bcrypt salt in app.py's set_password does NOT cycle on reset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant