Welcome
  • Home
  • About
    • About Integrity6
    • Our story
    • Our name
  • Learn
    • FAQs
    • Why this works
    • Did you know
  • Solutions
    • Enrollment, Lottery, Waitlist Management
    • PLACE
    • Custom Software Development
    • Bus Lottery
  • Request a Demo
  • Partner With Us
  • Contact Us
  • Home
  • About
    • About Integrity6
    • Our story
    • Our name
  • Learn
    • FAQs
    • Why this works
    • Did you know
  • Solutions
    • Enrollment, Lottery, Waitlist Management
    • PLACE
    • Custom Software Development
    • Bus Lottery
  • Request a Demo
  • Partner With Us
  • Contact Us

Integrity6 Customer Insights Hub

Bus Lottery
Billing Structure | Email Compliance | Application Process | Notifications | Ad-hoc Emails | Psychological Edge: Raw HTML Advantages​ | Data Storage | Bus Lottery

Integrity6 Bus Lottery 

Integrity6 is proud to introduce our Bus Lottery System, a free and accessible tool born from the real challenges faced by our Charter School partners. Many schools struggled with manual processes—think names in a hat—for assigning bus seats, leaving parents questioning fairness. They turned to us for help. While this issue didn’t demand a full-scale platform like our enrollment, lottery, and waitlist management system, we saw an opportunity to support our customers with a simple, trusted solution. This system ensures a fair process that parents can rely on, and we’re offering it free to any school that needs it. To access it, email [email protected] or fill out the contact form on our website. See how it works below!

The Bus Lottery is available for free under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. It can be accessed on Github here: https://github.com/a022832/lottery

📢 Important Notice – Please Read First

🚀 Integrity6 Bus Lottery System - Disclaimer

This Bus Lottery System is provided as a courtesy by Integrity6 to our customers, free of charge.
  • 🔹 No Support or Maintenance – Integrity6 does not provide technical support or ongoing maintenance for this lottery system. Any updates or enhancements we make are entirely at our discretion and not based on user requests.
  • 🔹 Use at Your Own Discretion – While we have made every effort to ensure this system functions correctly, Integrity6 is not responsible for any issues, errors, or decisions made based on the results.
  • 🔹 Attribution Requirement – This tool is shared under a 📜 Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 (CC BY-NC-ND 4.0)
  • ✅ You may share and distribute it freely.
  • ✅ You must always credit Integrity6 as the original creator.
  • ❌ You cannot modify or create derivative works of this system without permission.

For more details on this license, visit: 🔗 License Details: https://creativecommons.org/licenses/by-nc-nd/4.0/
  • 📌 By using this tool, you agree to these terms.
  • 🚀 Bus Lottery System - How It Works
  • 📌 This document explains how the lottery system works, including how data is processed, how winners are selected, and how the results are generated.

📂 Overview of the Bus Lottery System

The Bus Lottery System is designed to randomly select students for bus seats when demand is higher than availability.

Key Features:
  • ✅ Sibling preference for students who already have a sibling at the school.
  • ✅ Weighted lottery to give higher chances to students who live farther away.
  • ✅ Fully automated process—results are generated instantly.
  • ✅ Includes a waitlist system for students who do not receive a bus seat.

📊 How the Data is Processed

The system works with three sheets in Google Sheets:
  • 1️⃣ import file (Raw Data)
  • This sheet contains the raw application data that parents submit.
  • It includes student names, email addresses, distance from the school, sibling status, and requested seats.
  • 2️⃣ lottery data (Processed Data)

When you click "Get Lottery Data from Import File", the system:
  • ✅ Pulls in selected columns from the "import file" sheet.
  • ✅ Calculates a weighted lottery score based on the distance.
  • ✅ Generates a unique ID for each applicant.
  • ✅ Stores all of this information in the "lottery data" sheet.
  • 3️⃣ Lottery Results (Final Results)

When you click "Run Lottery", the system:
  • ✅ Sorts applicants by sibling preference first.
  • ✅ Runs a weighted random selection process.
  • ✅ Assigns bus seats based on available spots.
  • ✅ Places the remaining students on a waitlist, numbered in order.

⚙️ How the Functions Work
The system has two main functions that automate the lottery process.

🔹 getLotteryData() – Importing Data

📌 This function fetches the raw data from "import file" and prepares it for the lottery.

Steps:
 Reads first name, last name, email, miles from school, sibling preference, and requested seats from "import file".
  • 2️⃣ Generates a unique alphanumeric ID for each student.
  • 3️⃣ Uses miles from school to determine a lottery weight (higher weight = more entries).
  • 4️⃣ Stores the processed data in "lottery data".

📌 Key Programming Concepts Used:
  • ✅ Looping through rows to process each student.
  • ✅ String manipulation (combining first and last name + unique ID).
  • ✅ Distance-based lookup to assign weights.
  • 🔹 runLottery() – Running the Lottery

📌 This function randomly selects students for bus seats and assigns waitlist numbers.

Steps:
  • 1️⃣ Reads processed applicants from "lottery data".
  • 2️⃣ Retrieves total available seats from I3 in "lottery data".
  • 3️⃣ Creates a lottery pool with weighted entries (students with higher weights appear more times).
  • 4️⃣ Sorts applicants:
  • ✅ Sibling preference first (if "Yes", they are prioritized).
  • ✅ Shuffles remaining applicants randomly for fairness.
  • 5️⃣ Assigns bus seats until all available spots are filled.
  • 6️⃣ Moves remaining students to the waitlist, numbering them in order.
  • 7️⃣ Writes results to "Lottery Results".

📌 Key Programming Concepts Used:
  • ✅ Sorting by priority (siblings first).
  • ✅ Randomized selection with weighting (higher chances for farther students).
  • ✅ Looping through applicants to award seats or place on waitlist.
🎯 Important Data Fields

Each sheet contains specific columns that the system reads and processes.
Sheet
import file
import file
import file
import file
lottery data
lottery data
Lottery Results
Lottery Results
Lottery Results
📌 Example Scenario
Example:
A school has 3 available bus seats and 6 applicants:
Student
John Doe
Sarah Lee
Mike Brown
Lisa Chan
Ben Carter
Emma Stone

Lottery Process
  • 1️⃣ Sarah Lee (sibling) is selected first.
  • 2️⃣ The weighted random selection picks Lisa Chan (weight = 4).
  • 3️⃣ Mike Brown (weight = 3) is selected last.
  • 4️⃣ John, Ben, and Emma are placed on the waitlist.

Final Lottery Results
Student
Sarah Lee
Lisa Chan
Mike Brown
John Doe
Ben Carter
Emma Stone

🚀 Summary
  • ✅ Sibling preference ensures fairness.
  • ✅ Distance-based weighting gives a higher chance to students farther away.
  • ✅ Randomized selection ensures fairness.
  • ✅ Automated results processing saves time for schools.

📌 If you have any questions, refer to this document.


📂System Documentation: How the Weighted Lottery Logic Works for the Bus Lottery

​Overview
  • The Bus Lottery system uses a weighted lottery mechanism to fairly assign limited bus seats to applicants. Each applicant has a weight—think of it as the number of ping pong balls they toss into the lottery barrel. The more balls, the better their chances of being picked! This document explains how the logic processes those weights and determines winners.

Key Components
  • Spreadsheet Setup: The lottery pulls data from a Google Spreadsheet with two key sheets:
  • "lottery data": Holds applicant info (weights, seats needed, sibling status, etc.).
  • "Lottery Results": Where the magic happens—results are written here!
  • Total Seats: Defined in cell I3 of the "lottery data" sheet. This is the cap on awarded seats.
  • Applicant Pools: Applicants are split into two groups:
  • Sibling Pool: For those with sibling preference ("yes" in column H).
  • Regular Pool: Everyone else.

📂How the Weighted Lottery Logic Works

Step 1: Building the Lottery Pool
  • Weights as Chances: Each applicant’s weight (from column F) determines how many times they’re entered into the pool.
  • Example: A weight of 5 means they get 5 entries—like 5 ping pong balls with their name on them.
  • Code trick: Array(weight).fill(applicant) creates these duplicate entries, and the spread operator (...) adds them to the pool.
  • Sibling Preference: Applicants with "yes" in the sibling column go into the siblingApplicants pool; others go to regularApplicants. This prioritizes siblings later in the process.

Step 2: Shuffling for Fairness
  • Both pools (siblingApplicants and regularApplicants) are shuffled separately using the Fisher-Yates algorithm. This ensures randomness—like spinning the lottery barrel!
  • The final lotteryPool combines them, with sibling entries first, followed by regular ones.

Step 3: Drawing Winners
  • Unique Selection: A Set called processedApplicants tracks who’s already been picked by their name. No double-dipping allowed!
  • Processing the Pool: The system loops through lotteryPool:
  • First Encounter: When an applicant’s name appears for the first time:
  • If seats remain (awardedSeats + seatsNeeded <= totalSeats), they’re Awarded seats.
  • If no seats are left, they’re Waitlisted with a number (e.g., Waitlist #1).
  • Their name is added to processedApplicants.
  • Subsequent Encounters: If their name pops up again (e.g., their other balls):
  • The system skips them with a log: "Skipping duplicate entry". Those extra balls are tossed aside—they don’t get a second result.
What Happens to Extra "Ping Pong Balls"?
  • If an applicant has a weight of 5 (5 balls) and one is drawn:
  • They’re processed (awarded or waitlisted) based on that first draw.
  • The other 4 balls? They’re ignored when encountered later. No extra awards, no waitlist stacking—just a skip. Think of it as: "One winner per person, please!"

Why?:
  • The weight boosts their odds of being picked early in the shuffled pool, but once they’re processed, their extra entries don’t matter. Fair and square!

Step 4:
  • Writing Results
  • Results (name, status, waitlist number, seats needed, emails) are written to the "Lottery Results" sheet starting at row 6.

Example output:
  • ["Jane Doe", "Awarded", "", 1, "[email protected]", ""]
  • ["John Smith", "Waitlist", 1, 2, "[email protected]", ""]

Example Scenario
  • Total Seats:​ 3
  • Applicants:
    • Alice: Weight 5, Needs 1 seat, Sibling: No
    • Bob: Weight 2, Needs 2 seats, Sibling: Yes
  • Pool Creation:
    • siblingApplicants: [Bob, Bob] (2 entries)
    • regularApplicants: [Alice, Alice, Alice, Alice, Alice] (5 entries)
    • Shuffled lotteryPool: [Bob, Bob, Alice, Alice, Alice, Alice, Alice]
  • Processing:
    • Bob (first entry): Awarded 2 seats (1 seat left).
    • Bob (second entry): Skipped (already processed).
    • Alice (first entry): Awarded 1 seat (0 seats left).
    • Alice (remaining 4 entries): Skipped (already processed).
  • Result:
    • Bob wins 2 seats, Alice wins 1, and Alice’s extra 4 "balls" are discarded after her win.

Key Takeaways
  • Weight = Odds: More balls = higher chance of being drawn early.
  • One Shot per Applicant: Once picked, extra entries are ignored—no double awards or waitlist spots.
  • Fair Randomization: Shuffling ensures every ball has an equal shot, with siblings prioritized.
  • Efficiency: The Set keeps things clean by skipping duplicates fast.

This system balances fairness, priority, and simplicity—perfect for a bustling bus lottery!
Integrity6 | Trusted by Charter Schools for Secure Enrollment Solutions

© 2025 Integrity6. All rights reserved.
This document contains proprietary and confidential information. Unauthorized distribution or reproduction is prohibited.

Links

Home

​About us

Our Story

Our name

FAQs
Vertical Divider
Solutions

Why this works?


​Did you know?
Vertical Divider
Strategic Partnerships

Request a Demo

Custom Software Development
Vertical Divider

Contact

Tel: (704) 997-9520
eMail: [email protected]

Picture
Copyright 2025 Integrity6