Skip to content

Commit

Permalink
Merge pull request #2017 from bharateshwq/enhanced_cps_2022_to_enhanc…
Browse files Browse the repository at this point in the history
…ed_cps_2024

Changing from enhanced_cps_2022 to 2024
  • Loading branch information
anth-volk authored Sep 25, 2024
2 parents 42b0c6b + cb22661 commit b2c2d42
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
7 changes: 7 additions & 0 deletions src/data/countries.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export const STATUS_TEXT_COLORS = {
Pending: colors.BLACK,
};

// Map region entries to default datasets;
// at the moment, this only applies to the
// "enhanced_us" region selection
export const DEFAULT_DATASETS = {
enhanced_us: "enhanced_cps_2024",
};

const DEFAULT_US_HOUSEHOLD = {
families: {
"your family": {
Expand Down
15 changes: 9 additions & 6 deletions src/data/reformDefinitionCode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { optimiseHousehold } from "../api/variables";
import { defaultYear } from "./constants";
import { DEFAULT_DATASETS } from "./countries";

export function getReproducibilityCodeBlock(
type,
Expand Down Expand Up @@ -154,28 +155,30 @@ export function getImplementationCode(type, region, timePeriod, policy) {

const hasBaseline = Object.keys(policy?.baseline?.data).length > 0;
const hasReform = Object.keys(policy?.reform?.data).length > 0;
const hasDatasetSpecified = region === "enhanced_us";
const dataset = hasDatasetSpecified ? '"enhanced_cps_2022"' : "";

// Check if the region has a dataset specified
const hasDatasetSpecified = Object.keys(DEFAULT_DATASETS).includes(region);
const dataset = hasDatasetSpecified ? DEFAULT_DATASETS[region] : "";

return [
"",
"",
`baseline = Microsimulation(${
hasDatasetSpecified && hasBaseline
? `reform=baseline, dataset=${dataset}`
? `reform=baseline, dataset='${dataset}'`
: hasBaseline
? `reform=baseline`
: hasDatasetSpecified
? `dataset=${dataset}`
? `dataset='${dataset}'`
: ""
})`,
`reformed = Microsimulation(${
hasDatasetSpecified && hasReform
? `reform=reform, dataset=${dataset}`
? `reform=reform, dataset='${dataset}'`
: hasReform
? `reform=reform`
: hasDatasetSpecified
? `dataset=${dataset}`
? `dataset='${dataset}'`
: ""
})`,
`baseline_income = baseline.calculate("household_net_income", period=${timePeriod || defaultYear})`,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/policy/output/promptContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const promptContent = (
}. Explain how the parameters are changing from the baseline to the reform values using the given data.
${
isEnhancedCPS &&
"* Explicitly mention that this analysis uses PolicyEngine's Enhanced CPS, constructed from the 2022 Current Population Survey and the 2015 IRS Public Use File, and calibrated to tax, benefit, income, and demographic aggregates."
"* Explicitly mention that this analysis uses PolicyEngine's Enhanced CPS, constructed from the 2024 Current Population Survey and the 2015 IRS Public Use File, and calibrated to tax, benefit, income, and demographic aggregates."
}
* Round large numbers like: ${metadata.currency}3.1 billion, ${
metadata.currency
Expand Down
2 changes: 1 addition & 1 deletion src/posts/articles/enhanced-cps-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ To use the ECPS in the PolicyEngine web app, run a microsimulation as normal, an
To use the ECPS in the policyengine-us Python package, specify it in the Microsimulation call as follows, then use it as you would otherwise.

```python
ecps = Microsimulation(dataset="enhanced_cps_2022")
ecps = Microsimulation(dataset="enhanced_cps_2024")
```

To download the ECPS, visit the [release page](https://github.com/PolicyEngine/policyengine-us/releases/tag/enhanced-cps-2022) and download the h5 file.
Expand Down

0 comments on commit b2c2d42

Please sign in to comment.