Skip to content

feat: add time to first deploy distribution query, /api/time-to-deploy and Histogram component (fixes #11) - #59

Closed
evandroribeiro94 wants to merge 1 commit into
devodii:mainfrom
evandroribeiro94:feat/issue-11-time-to-deploy
Closed

evandroribeiro94 wants to merge 1 commit into
devodii:mainfrom
evandroribeiro94:feat/issue-11-time-to-deploy

Conversation

@evandroribeiro94

Copy link
Copy Markdown

Description

Closes #11.

Calculates and visualizes the preparation velocity across hackathon projects — how fast teams progressed from their first commit inside the hack window to their first smart contract deployment on Stellar testnet:

  1. Deploy Timing Calculation & Pure Bucketing (queries.py):

    • DEPLOY_DELTAS_SQL: computes the elapsed minutes between project starting timestamp (first commit in window, or repo creation time if inside window, or window start if repo predated the window) and min(deployed_at) across attributed contracts.
    • compute_deploy_histogram: pure, deterministic bucketing function grouping deltas into 30-minute intervals (0-30m, 30-60m, etc.) and computing the true median.
    • fetch_time_to_deploy: aggregates across verified & likely projects while respecting opt-out filtering.
  2. Schema & API Endpoint (schemas.py & routes.py):

    • Added TimeToDeployResponse and DeployBucket Pydantic models.
    • Built GET /api/time-to-deploy returning total_projects, median_minutes, and buckets.
  3. Frontend Histogram & Overview Card (apps/web):

    • Built reusable Histogram chart component (apps/web/src/components/charts/histogram.tsx) using Recharts and shadcn chart primitives with an annotated reference line for the median.
    • Added useTimeToDeploy hook (apps/web/src/hooks/use-time-to-deploy.ts).
    • Integrated TimeToDeployCard on the home page inside Overview (apps/web/src/components/overview.tsx) directly under the timeline chart.

Verification

  • pytest apps/api/tests/test_time_to_deploy.py: 3/3 passed in 3.38s
    • Direct pure function verification of 3-project fixture ([15, 45, 75]) produces exact buckets (0-30m, 30-60m, 60-90m) and median 45.0m.
    • Edge cases (empty deltas, single bucket clustering, midpoint median, negative clamping) verified.
    • API endpoint serialization verified with TestClient.
  • ruff check src/ tests/: 0 errors
  • pnpm build (tsc -b && vite build): Built cleanly in 1.98s (0 errors)
  • pnpm oxlint: 0 errors
  • pnpm prettier: All files formatted

@vercel

vercel Bot commented Oct 31, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Payroutes OSS Team on Vercel.

A member of the Team first needs to authorize it.

@devodii devodii closed this Nov 1, 2026
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.

Time to first deploy distribution

2 participants