Skip to content

Commit e6ed8a1

Browse files
authored
Update PolicyEngine branding (#6)
1 parent eb9d8db commit e6ed8a1

26 files changed

Lines changed: 134 additions & 134 deletions

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Arch
22

3-
Arch is Cosilico's source-data foundation for social simulation. It captures
3+
Arch is PolicyEngine's source-data foundation for social simulation. It captures
44
source publications, preserves provenance, and represents published values as
55
structured, queryable facts.
66

@@ -29,7 +29,7 @@ This repository provides:
2929
FRS, and related datasets.
3030
- **Jurisdiction loaders**: US and UK source-specific ETL.
3131

32-
Arch facts are not Cosilico's assertion that a source claim is ultimately true.
32+
Arch facts are not PolicyEngine's assertion that a source claim is ultimately true.
3333
They are source-backed claims with provenance.
3434

3535
## Boundary
@@ -77,9 +77,9 @@ and calibration code belongs under `micro/`.
7777
### 1. Install
7878

7979
```bash
80-
pip install cosilico-arch
80+
pip install policyengine-arch-data
8181
# Or for development:
82-
git clone https://github.com/CosilicoAI/arch-data arch
82+
git clone https://github.com/PolicyEngine/arch-data arch
8383
cd arch
8484
pip install -e ".[dev]"
8585
```
@@ -194,7 +194,7 @@ target_input = as_target(
194194

195195
## Related Repositories
196196

197-
- [microplex](https://github.com/CosilicoAI/microplex) - Core microsimulation
197+
- [microplex](https://github.com/PolicyEngine/microplex) - Core microsimulation
198198
abstractions and calibration interfaces.
199-
- [microplex-us](https://github.com/CosilicoAI/microplex-us) - US-specific
199+
- [microplex-us](https://github.com/PolicyEngine/microplex-us) - US-specific
200200
simulation adapters and calibration profiles.

calibration/variables.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Variable entity resolution using cosilico-engine.
2+
Variable entity resolution using a RuleSpec engine package when available.
33
44
Resolves fully qualified variable references to their entity type
55
(person, tax_unit, household, family) by parsing the source .rac file.
@@ -15,19 +15,19 @@
1515
from pathlib import Path
1616
from typing import Optional
1717

18-
# Try to import from cosilico-engine
18+
# Try to import a legacy RuleSpec engine API.
1919
try:
20-
from cosilico.dependency_resolver import PackageRegistry, ModuleResolver
21-
from cosilico.dsl_parser import parse_file
22-
COSILICO_AVAILABLE = True
20+
from policyengine.dependency_resolver import PackageRegistry, ModuleResolver
21+
from policyengine.dsl_parser import parse_file
22+
POLICYENGINE_AVAILABLE = True
2323
except ImportError:
24-
COSILICO_AVAILABLE = False
24+
POLICYENGINE_AVAILABLE = False
2525

2626

2727
# Default workspace path (can be overridden)
28-
DEFAULT_WORKSPACE = Path.home() / "CosilicoAI"
28+
DEFAULT_WORKSPACE = Path.home() / "PolicyEngine"
2929

30-
# Fallback entity mapping for common variables when cosilico-engine not available
30+
# Fallback entity mapping for common variables when a RuleSpec engine is not available.
3131
FALLBACK_ENTITIES = {
3232
# Person-level
3333
"age": "person",
@@ -110,7 +110,7 @@ def get_entity(
110110
111111
Args:
112112
variable_ref: Fully qualified reference like "us:statute/26/32#eitc"
113-
workspace: Optional workspace path (defaults to ~/CosilicoAI)
113+
workspace: Optional workspace path (defaults to ~/PolicyEngine)
114114
115115
Returns:
116116
Entity type: "person", "tax_unit", "household", or "family"
@@ -125,8 +125,8 @@ def get_entity(
125125
"""
126126
package, path, var_name = parse_variable_ref(variable_ref)
127127

128-
# Try cosilico-engine first
129-
if COSILICO_AVAILABLE:
128+
# Try the RuleSpec engine first.
129+
if POLICYENGINE_AVAILABLE:
130130
try:
131131
return _get_entity_from_rac(package, path, var_name, workspace)
132132
except Exception:
@@ -150,14 +150,14 @@ def _get_entity_from_rac(
150150
"""
151151
Get entity by parsing the actual .rac file.
152152
153-
Uses cosilico-engine's PackageRegistry to resolve paths.
153+
Uses the legacy RuleSpec engine's PackageRegistry to resolve paths.
154154
"""
155155
if workspace is None:
156156
workspace = DEFAULT_WORKSPACE
157157

158158
# Map short package name to repo name
159-
# us → cosilico-us, us-ca → cosilico-us-ca, uk → cosilico-uk
160-
repo_name = f"cosilico-{package}"
159+
# us → policyengine-us, us-ca → policyengine-us-ca, uk → policyengine-uk
160+
repo_name = f"policyengine-{package}"
161161

162162
# Get package registry
163163
registry = PackageRegistry.from_workspace(workspace)

data/targets/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# State-Level Calibration Targets
22

3-
This directory contains state-level calibration targets for use with the Cosilico microsimulation system. Targets are used to calibrate (reweight) microdata samples to match official administrative statistics.
3+
This directory contains state-level calibration targets for use with the PolicyEngine microsimulation system. Targets are used to calibrate (reweight) microdata samples to match official administrative statistics.
44

55
## Data Files
66

@@ -16,7 +16,7 @@ This directory contains state-level calibration targets for use with the Cosilic
1616
Run the build script to generate/update all target files:
1717

1818
```bash
19-
cd cosilico-data-sources
19+
cd arch-data
2020
python data/targets/build_state_targets.py
2121
```
2222

db/etl_soi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _table_content(year: int, file_spec_fn, package_dir: str) -> bytes:
177177
else:
178178
request = Request(
179179
spec["source_url"],
180-
headers={"User-Agent": "cosilico-arch/0.1", "Accept": "*/*"},
180+
headers={"User-Agent": "policyengine-arch-data/0.1", "Accept": "*/*"},
181181
)
182182
with urlopen(request, timeout=120) as response:
183183
content = response.read()

db/source_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _fetch_url(url: str) -> tuple[bytes, str | None, str]:
9494
request = Request(
9595
url,
9696
headers={
97-
"User-Agent": "cosilico-arch/0.1",
97+
"User-Agent": "policyengine-arch-data/0.1",
9898
"Accept": "*/*",
9999
},
100100
)

db/supabase_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Supabase client for Arch.
33
4-
Provides connection to Cosilico Supabase database for:
4+
Provides connection to PolicyEngine Supabase database for:
55
- Source metadata and dataset registries
66
- Raw microdata tables (e.g., microdata.us_census_cps_asec_2024_person)
77
- Target inputs
@@ -22,9 +22,9 @@
2222
from supabase import create_client, Client
2323

2424

25-
ARCH_SCHEMA = os.environ.get("COSILICO_ARCH_SCHEMA", "arch")
26-
MICRODATA_SCHEMA = os.environ.get("COSILICO_MICRODATA_SCHEMA", "microdata")
27-
TARGETS_SCHEMA = os.environ.get("COSILICO_TARGETS_SCHEMA", "targets")
25+
ARCH_SCHEMA = os.environ.get("POLICYENGINE_ARCH_SCHEMA", "arch")
26+
MICRODATA_SCHEMA = os.environ.get("POLICYENGINE_MICRODATA_SCHEMA", "microdata")
27+
TARGETS_SCHEMA = os.environ.get("POLICYENGINE_TARGETS_SCHEMA", "targets")
2828

2929

3030
@dataclass
@@ -40,23 +40,23 @@ def from_env(cls) -> "SupabaseConfig":
4040
Load configuration from environment variables.
4141
4242
Required:
43-
COSILICO_SUPABASE_URL: Supabase project URL
44-
COSILICO_SUPABASE_SECRET_KEY: Service role key for full access
43+
POLICYENGINE_SUPABASE_URL: Supabase project URL
44+
POLICYENGINE_SUPABASE_SECRET_KEY: Service role key for full access
4545
4646
Raises:
4747
ValueError: If required environment variables are missing
4848
"""
49-
url = os.environ.get("COSILICO_SUPABASE_URL")
49+
url = os.environ.get("POLICYENGINE_SUPABASE_URL")
5050
if not url:
5151
raise ValueError(
52-
"COSILICO_SUPABASE_URL not set. "
52+
"POLICYENGINE_SUPABASE_URL not set. "
5353
"Set this to your Supabase project URL."
5454
)
5555

56-
secret_key = os.environ.get("COSILICO_SUPABASE_SECRET_KEY")
56+
secret_key = os.environ.get("POLICYENGINE_SUPABASE_SECRET_KEY")
5757
if not secret_key:
5858
raise ValueError(
59-
"COSILICO_SUPABASE_SECRET_KEY not set. "
59+
"POLICYENGINE_SUPABASE_SECRET_KEY not set. "
6060
"Set this to your service role key."
6161
)
6262

docs/PUF_INTEGRATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ def add_synthetic_high_income(df, pareto_alpha=1.5):
8888
If IRS PUF license obtained:
8989

9090
```python
91-
class CosilicoPUF:
91+
class PolicyEnginePUF:
9292
"""Load and process IRS PUF."""
9393

9494
def __init__(self, puf_path: str):
9595
self.raw = pd.read_csv(puf_path)
9696
self.records = self._build_tax_units()
9797

9898
def _build_tax_units(self):
99-
"""Map PUF variables to Cosilico schema."""
99+
"""Map PUF variables to PolicyEngine schema."""
100100
return pd.DataFrame({
101101
'weight': self.raw['S006'] / 100, # PUF weights are x100
102102
'adjusted_gross_income': self.raw['E00100'],

docs/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
Arch is Cosilico's source-data foundation for social simulation. It captures
5+
Arch is PolicyEngine's source-data foundation for social simulation. It captures
66
source publications, preserves provenance, and represents published values as
77
structured, queryable facts. Microplex consumes Arch facts to produce final
88
calibrated simulation inputs.
@@ -134,7 +134,7 @@ target_input = as_target(
134134
```
135135

136136
Projection facts from official sources such as CBO, OBR, and ONS can be loaded
137-
as source facts directly. Cosilico-owned inflation, aging, projection, or
137+
as source facts directly. PolicyEngine-owned inflation, aging, projection, or
138138
cross-source reconciliation assumptions belong in Microplex Targets, not Arch.
139139

140140
## Calibration Pipeline

docs/cps-variable-coverage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ The ETL pipeline (`db/etl_soi.py`) loads IRS SOI targets for calibration:
131131
python micro/us/census/download_cps.py --year 2024
132132
```
133133

134-
### 2. Convert to Cosilico Format
134+
### 2. Convert to PolicyEngine Format
135135
```bash
136-
python scripts/cps_to_cosilico.py --year 2024 --calibrate --summary
136+
python scripts/cps_to_policyengine.py --year 2024 --calibrate --summary
137137
```
138138

139139
### 3. Validate Against Targets
@@ -149,8 +149,8 @@ with Session(get_engine()) as session:
149149

150150
### 4. Run Microsimulation
151151
```bash
152-
# In cosilico-us repository
153-
python -m cosilico_us.microsim --input cosilico_input_2024.parquet
152+
# In policyengine-us repository
153+
python -m policyengine_us.microsim --input policyengine_input_2024.parquet
154154
```
155155

156156
## Data Quality Recommendations
@@ -199,7 +199,7 @@ definition: "What this variable measures"
199199
maps_to:
200200
- jurisdiction: us
201201
statute: "26 USC section"
202-
variable: cosilico_variable_name
202+
variable: policyengine_variable_name
203203
coverage: full | partial
204204
notes: "Mapping notes"
205205

@@ -244,7 +244,7 @@ db/
244244

245245
```
246246
scripts/
247-
├── cps_to_cosilico.py # Main conversion script
247+
├── cps_to_policyengine.py # Main conversion script
248248
└── export_to_json.py # JSON export utility
249249
250250
micro/us/

docs/pe-calibration-targets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ PolicyEngine-US-Data uses a three-table schema:
227227

228228
## Target Count Comparison
229229

230-
| Category | PolicyEngine (est.) | cosilico (current) | Gap |
230+
| Category | PolicyEngine (est.) | policyengine (current) | Gap |
231231
|----------|---------------------|-------------------|-----|
232232
| IRS SOI Tax | ~500 | ~80 | ~420 |
233233
| Demographics | ~900 | ~50 | ~850 |

0 commit comments

Comments
 (0)