# Egypt digital choices — reproducible aggregate analysis

Softworks Labs, Ahmed Mostafa. Research cutoff: **4 November 2026**.

This package separates (1) public national statistics, (2) published weighted business survey aggregates, (3) an illustrative cost scenario, and (4) an executed local software benchmark. It is an applied working-paper dataset, not a representative new survey or externally peer-reviewed experiment.

## Reproduce

Python 3.12 was used. The tested dependency versions are pinned in `scripts/requirements.txt`. A clean virtual environment is recommended.

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r scripts/requirements.txt
python scripts/acquire.py
python scripts/benchmark.py
python scripts/analyze.py
python scripts/test_analysis.py
```

On macOS/Linux, activate with `source .venv/bin/activate` instead. The scripts use only public, no-login downloads and local compute. The benchmark can be run with the Python standard library alone. `analyze.py` never makes network requests.

In the original website repository, results go to `public/research/egypt-digital-2026/`. In a standalone copy, they go to `output/`. To choose another folder, set `SOFTWORKS_RESEARCH_OUTPUT`. The raw World Bank API snapshot in the ZIP is frozen. `acquire.py` preserves existing files by default and downloads the source Enterprise Survey PDF for local verification. `--refresh` deliberately acquires a new vintage and updates the hash manifest; it may change results and should produce a new release.

The ZIP omits copyrighted original PDFs and restricted dashboard data. It includes scripts, permissible public API bytes, source metadata, and derived results. The World Bank Enterprise Survey PDF remains obtainable from the original URL in `source-manifest.json`. Data hashes are SHA-256 over the original downloaded bytes. Extraction and validation read pages 11–12 directly from that PDF.

## National internet use

- Indicator: World Bank WDI `IT.NET.USER.ZS`, original provider ITU.
- Definition: people who used the internet, from any location and device, within the last three months; unit **percent of population**.
- Countries: Egypt, Morocco, Tunisia, Jordan, Türkiye; World is an additional aggregate, not a country.
- Requested years: 2000–2025. Source API update: 8 October 2026. **2024** is the latest common year for the five countries and World in this snapshot.
- 182 country/aggregate-year cells are retained, including missing values. Null/blank means missing, never zero. All 26 low-and-middle-income aggregate cells were missing in the primary API. No values were imputed, extrapolated or copied from a mirror.
- The FRED mirror is kept only to demonstrate revision/vintage sensitivity. Its World 2023 value was 67.4%; the primary response was 69.2%. We do not mix them. This difference is not a social change occurring in 2023; it is a difference between data snapshots.
- Gaps are `Egypt − comparator` in **percentage points**, matched by year. Five peers are purposively chosen regional/reference countries, not a random global control group. There is no causal regression, hypothesis test or forecast.

## Formal business survey

Source: World Bank *Enterprise Surveys: Egypt2025 Country Profile*. The survey label is 2025; fieldwork was **September 2025–January 2026**, with **1,024 establishments**. Coverage is registered private non-agricultural establishments with at least five employees and at least 1% private ownership. **Healthcare is excluded**, along with education/social work, finance, utilities and public administration. Informal microbusinesses are not represented.

The selected table values are published weighted percentages. Small means 5–19 employees; medium means 20–99; large means 100+. Geographic counts and size counts describe the realized sample, not adoption rates or population shares. Do not average the size rates using sample counts to recover the national estimate. We do not calculate confidence intervals from the headline sample size because the design, survey weights and item-level denominators are unavailable in this aggregate report. "Electricity is the biggest obstacle" is a single-choice response; it is different from experiencing an outage.

## Synthetic cost scenario

All cost/time/risk inputs are **chosen assumptions**. They are not estimated wages, AI error rates, operational costs, or business outcomes in Egypt. The formula is:

```text
saved_minutes = manual_minutes − auto_minutes − review_minutes − error_rate × rework_minutes
net_monthly_value = jobs × saved_minutes / 60 × hourly_value
                    − recurring_cost − outage_hours × incremental_outage_loss_per_hour
```

Review applies to every job. Negative time savings remain negative. Setup cost is reported separately, with illustrative payback only if monthly value is positive. Valued spare capacity becomes cash only if sold, redeployed or a real expense is avoided. Do not double count the same lost work in both fewer jobs and outage losses.

The default example uses 2,000 jobs/month, 8 manual minutes, 1.5 automated minutes, 2 review minutes, a 5% rework rate and 10 rework minutes. At an assumed EGP60/hour, EGP2,500 recurring cost, and four outage hours at EGP200 incremental loss/hour, the result is 133.33 released hours and EGP4,700 illustrative monthly value. EGP12,000 setup implies 2.55 months of *illustrative* recovery if that capacity can be monetized.

The Monte Carlo run propagates eight independent triangular input distributions (min/mode/max listed in `summary.json`), with 50,000 draws and seed 20261104. The 5th, median and 95th percentiles describe this assumed scenario space. They are not confidence limits, forecasts or probabilities that Egyptian companies will succeed. One-input-at-a-time sensitivity holds the other defaults fixed. Input dependence, bottlenecks, implementation delay, safety loss, security events and cash realization need a real pilot.

## Executed local retry benchmark

`benchmark.py` actually runs three strategies against local SQLite databases: one attempt, retry without a unique operation key, and retry with a stable key inserted atomically with the effect. There are 500 synthetic jobs per trial, 20 measured repetitions per strategy, and one excluded warmup. Strategy order rotates across repetitions. Seed 20261104 chooses 125 jobs with a first-send failure before writing and 50 jobs with their first acknowledgement lost **after** the server committed the effect; 15 jobs have both. Retries allow three immediate attempts. The full ID trace is included.

Every repetition produced the same delivery counts: one-shot left 125 jobs unapplied; naive retries applied all 500 but added 50 duplicate effects; keyed retries applied 500 with zero duplicate effects. These counts follow this chosen fault model and verify the implementation. They do not estimate real-world outage incidence. Timing columns are measured local wall-clock milliseconds over the job loop, excluding setup. They do not measure production latency or establish a performance advantage between the algorithms.

A separate outbox check closes and reopens database connections: all 500 queued jobs survive the first reopen; 250 remain pending at the second reopen, including one whose server effect already committed. Replaying them finishes with 500 unique effects, zero duplicates and zero pending jobs. This is **not** an OS-kill, network-stack, storage-failure or power-cut durability test. Concurrent clients, external side effects, key expiry, false duplicate intent and multiple databases require additional tests. Production retries also need backoff, persistent retry scheduling and observability.

## Files and reuse

- `summary.json`: source attribution, observations, analytical results, assumptions and limitations.
- `internet.csv` / `internet-gaps.csv`: normalized observations and same-year differences.
- `enterprise-selected.csv`: selected factual aggregates and source page numbers.
- `simulation-sensitivity.csv` / `simulation-distribution.csv`: sensitivity endpoints and histogram bins.
- `benchmark.json` / `benchmark-trials.csv` / `benchmark-fault-trace.json`: executed outcomes, all 60 measured trials, deterministic faults.
- `data-dictionary.json`: field meanings, units, missingness and licenses.
- `provenance.json`: source URLs, retrieval dates, local paths and byte hashes.
- `figures/`: vector SVG and 220dpi PNG charts with source/limitation captions.

World Bank open indicator data retains its source attribution and CC BY4.0 terms. Selected report numbers are factual transcriptions, with original report copyright retained; no original PDF is sublicensed. Original Softworks result tables/figures are released under CC BY4.0. Example code is MIT. See `LICENSE.txt` for details. No restricted ITU dashboard data, personal posts, microdata, private customer data or credentials are included.

Citation: Ahmed Mostafa / Softworks Labs (2026), *Egypt digital choices: aggregate analysis and local engineering benchmark*, version1.0, data freeze 4 November2026. Cite the upstream World Bank/ITU source as well when reusing its observations. This working release has no DOI and does not claim external peer review.
