{ "cells": [ { "cell_type": "markdown", "id": "92e8fa66", "metadata": {}, "source": [ "# Did at least 53% of the toasters get fixed?\n", "\n", "A repair café coordinator wants to use that sentence in a report. The records cover **2,528 toaster repair attempts in 2025**, and 67 have an unknown outcome. Decide whether the records support the claim.\n", "\n", "Run the cells in order in any Python 3 notebook. All four aggregate counts are included here. The exercise needs no files, packages or network access. In Colab, use **File → Save a copy in Drive** to keep your edits. The [Google Sheets worksheet](https://bulldo.gs/demos/repair-outcomes/) uses the same four counts." ] }, { "cell_type": "markdown", "id": "f963f7f6", "metadata": {}, "source": [ "## Count what was recorded\n", "\n", "The Open Repair Alliance classifies attempts at the event as Fixed, Repairable, End of life or Unknown. *Repairable* means a next step was identified. Predict whether excluding unknown outcomes will raise or lower the recorded fixed share." ] }, { "cell_type": "code", "execution_count": 1, "id": "90448233", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Recorded fixes / all attempts: 1299/2528 = 51.38%\n", "Recorded fixes / known outcomes: 1299/2461 = 52.78%\n" ] } ], "source": [ "fixed = 1299\n", "repairable = 295\n", "end_of_life = 867\n", "unknown = 67\n", "\n", "counts = (fixed, repairable, end_of_life, unknown)\n", "if any(type(count) is not int or count < 0 for count in counts):\n", " raise ValueError(\"Use nonnegative whole counts.\")\n", "\n", "known = fixed + repairable + end_of_life\n", "total = known + unknown\n", "\n", "def percent(numerator, denominator):\n", " return f\"{numerator / denominator:.2%}\" if denominator else \"undefined\"\n", "\n", "print(f\"Recorded fixes / all attempts: {fixed}/{total} = {percent(fixed, total)}\")\n", "print(f\"Recorded fixes / known outcomes: {fixed}/{known} = {percent(fixed, known)}\")" ] }, { "cell_type": "markdown", "id": "b24a1670", "metadata": {}, "source": [ "## Find the range the missing outcomes allow\n", "\n", "Imagine that you could recover every unknown outcome at the original event. Set **additional_fixes** to how many would be classified as fixed. The total number of attempts stays the same. Run the cell with 0, then 67. Before rerunning, predict what changes." ] }, { "cell_type": "code", "execution_count": 2, "id": "76824052", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Lowest possible fixed share: 51.38%\n", "Highest possible fixed share: 54.03%\n", "Your scenario: 51.38%\n" ] } ], "source": [ "additional_fixes = 0\n", "if type(additional_fixes) is not int or not 0 <= additional_fixes <= unknown:\n", " raise ValueError(f\"Choose a whole number from 0 to {unknown}.\")\n", "\n", "print(\"Lowest possible fixed share:\", percent(fixed, total))\n", "print(\"Highest possible fixed share:\", percent(fixed + unknown, total))\n", "print(\"Your scenario:\", percent(fixed + additional_fixes, total))" ] }, { "cell_type": "markdown", "id": "ff0dd900", "metadata": {}, "source": [ "## Test a reporting threshold\n", "\n", "How many of the unknown outcomes would have to be fixes to reach **53% of all attempts**? Guess a number, then run the cell. It compares exact counts before rounding a percentage for display." ] }, { "cell_type": "code", "execution_count": 3, "id": "948eabd1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "At least 41 of the 67 unknown outcomes would have to be fixes.\n", "One fewer: 52.97%\n", "At the threshold count: 53.01%\n" ] } ], "source": [ "from fractions import Fraction\n", "from math import ceil\n", "\n", "target = Fraction(53, 100)\n", "needed = max(0, ceil(target * total) - fixed)\n", "\n", "if total == 0:\n", " print(\"There are no attempts in this cohort.\")\n", "elif needed == 0:\n", " print(\"The recorded fixes already meet the threshold.\")\n", "elif needed > unknown:\n", " print(\"Even if every unknown were fixed, the threshold would be out of reach.\")\n", "else:\n", " print(f\"At least {needed} of the {unknown} unknown outcomes would have to be fixes.\")\n", " print(f\"One fewer: {percent(fixed + needed - 1, total)}\")\n", " print(f\"At the threshold count: {percent(fixed + needed, total)}\")" ] }, { "cell_type": "markdown", "id": "7ecdfe2d", "metadata": {}, "source": [ "## Write one sentence for the report\n", "\n", "With the original data, 1,299 fixes were recorded. The unknowns allow an eventual classification between **51.38% and 54.03%** fixed at the event. At least **41** of them would have to be fixes to reach 53%. We cannot tell how many actually were. These bounds describe this cohort of attempts at participating groups.\n", "\n", "Try setting the threshold to 55%, then 50%. What changes in the conclusion? As a final check, set all four counts to zero and rerun every cell. Restore the original counts before quoting this source.\n", "\n", "### Source and reuse\n", "\n", "Source data © Open Repair Alliance and its contributing partners, [October 2026 release](https://openrepair.org/open-data/downloads/), [pinned data repository](https://github.com/openrepair/data/tree/d1b2ab5a7b05c96645f5d4afec7951fc912639e1). bulldo.gs filtered the electrical and electronic equipment records to the exact category Toaster and 2025 calendar-year event dates, counted the four outcomes and wrote this exercise. The [counting script](https://bulldo.gs/demos/repair-outcomes/count-repairs.py) reproduces the counts from the source CSV. The notebook and adapted data are available under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.13" } }, "nbformat": 4, "nbformat_minor": 5 }