Skip to content

Commit 6a30c20

Browse files
committed
fixes
1 parent 3e98654 commit 6a30c20

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

policyengine_api/ai_prompts/simulation_analysis_prompt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def generate_simulation_analysis_prompt(params: InboundParameters) -> str:
9090

9191
audience_description: str = audience_descriptions[parameters.audience]
9292

93-
country_id_uppercase: Annotated[
94-
str, "Uppercase two-letter country ID"
95-
] = parameters.country_id.upper()
93+
country_id_uppercase: Annotated[str, "Uppercase two-letter country ID"] = (
94+
parameters.country_id.upper()
95+
)
9696

9797
impact_budget: str = json.dumps(parameters.impact["budget"])
9898
impact_intra_decile: dict[str, Any] = json.dumps(

policyengine_api/jobs/calculate_economy_simulation_job.py

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -254,22 +254,22 @@ def run(
254254
**comparison_data,
255255
}
256256
)
257-
sim_config: dict[
258-
str, Any
259-
] = self.api_v2._setup_sim_options(
260-
country_id=country_id,
261-
scope="macro",
262-
reform_policy=reform_policy,
263-
baseline_policy=baseline_policy,
264-
time_period=time_period,
265-
region=region,
266-
dataset=dataset,
267-
model_version=COUNTRY_PACKAGE_VERSIONS[country_id],
268-
data_version=(
269-
uk_dataset_version
270-
if country_id == "uk"
271-
else us_dataset_version
272-
),
257+
sim_config: dict[str, Any] = (
258+
self.api_v2._setup_sim_options(
259+
country_id=country_id,
260+
scope="macro",
261+
reform_policy=reform_policy,
262+
baseline_policy=baseline_policy,
263+
time_period=time_period,
264+
region=region,
265+
dataset=dataset,
266+
model_version=COUNTRY_PACKAGE_VERSIONS[country_id],
267+
data_version=(
268+
uk_dataset_version
269+
if country_id == "uk"
270+
else us_dataset_version
271+
),
272+
)
273273
)
274274

275275
api_v2_execution = self.api_v2.run(sim_config)
@@ -369,15 +369,17 @@ def run(
369369

370370
v2_country_package_version = api_v2_output["model_version"]
371371

372-
completion_log: V2V1Comparison = V2V1Comparison.model_validate(
373-
{
374-
**comparison_data,
375-
"v1_impact": impact,
376-
"v2_impact": api_v2_output,
377-
"v1_v2_diff": None,
378-
"v2_country_package_version": v2_country_package_version,
379-
"message": "APIv2 job completed",
380-
}
372+
completion_log: V2V1Comparison = (
373+
V2V1Comparison.model_validate(
374+
{
375+
**comparison_data,
376+
"v1_impact": impact,
377+
"v2_impact": api_v2_output,
378+
"v1_v2_diff": None,
379+
"v2_country_package_version": v2_country_package_version,
380+
"message": "APIv2 job completed",
381+
}
382+
)
381383
)
382384

383385
logger.log_struct(
@@ -390,15 +392,17 @@ def run(
390392
y=api_v2_output,
391393
)
392394
# Push relevant info into logging schema
393-
comparison_log: V2V1Comparison = V2V1Comparison.model_validate(
394-
{
395-
**comparison_data,
396-
"v1_impact": impact,
397-
"v2_impact": api_v2_output,
398-
"v1_v2_diff": v1_v2_diff,
399-
"v2_country_package_version": v2_country_package_version,
400-
"message": "APIv2 job comparison with APIv1 completed",
401-
}
395+
comparison_log: V2V1Comparison = (
396+
V2V1Comparison.model_validate(
397+
{
398+
**comparison_data,
399+
"v1_impact": impact,
400+
"v2_impact": api_v2_output,
401+
"v1_v2_diff": v1_v2_diff,
402+
"v2_country_package_version": v2_country_package_version,
403+
"message": "APIv2 job comparison with APIv1 completed",
404+
}
405+
)
402406
)
403407
logger.log_struct(
404408
comparison_log.model_dump(mode="json"),
@@ -552,9 +556,9 @@ def _compute_economy(
552556
def _create_simulation_uk(
553557
self, country, reform, region, time_period
554558
) -> Microsimulation:
555-
CountryMicrosimulation: Type[
556-
Microsimulation
557-
] = country.country_package.Microsimulation
559+
CountryMicrosimulation: Type[Microsimulation] = (
560+
country.country_package.Microsimulation
561+
)
558562

559563
simulation = CountryMicrosimulation(
560564
reform=reform,

0 commit comments

Comments
 (0)