api.benefits

api.benefits

Functions

Name Description
check_benefit_scenarios Return a dataframe with the scenarios needed for this benefit assessment run.
create_benefit Create a new benefit object.
create_benefit_scenarios Create the benefit scenarios.
delete_benefit Delete a benefit object from the database.
edit_benefit Edit a benefit object in the database.
get_aggregation_benefits Get the aggregation benefits for a benefit assessment.
get_benefit Get a benefit from the database by name.
get_benefits Get all benefits from the database.
run_benefit Run the benefit assessment.
save_benefit Save a benefit object to the database.

check_benefit_scenarios

api.benefits.check_benefit_scenarios(benefit)

Return a dataframe with the scenarios needed for this benefit assessment run.

Parameters

Name Type Description Default
benefit IBenefit The benefit object to check. required

Returns

Name Type Description
pd.DataFrame A dataframe with the scenarios needed for this benefit assessment run.

create_benefit

api.benefits.create_benefit(attrs)

Create a new benefit object.

Parameters

Name Type Description Default
attrs dict[str, Any] The attributes of the benefit object to create. Should adhere to the BenefitModel schema. required

create_benefit_scenarios

api.benefits.create_benefit_scenarios(benefit)

Create the benefit scenarios.

Parameters

Name Type Description Default
benefit IBenefit The benefit object to create scenarios for. required

delete_benefit

api.benefits.delete_benefit(name)

Delete a benefit object from the database.

Parameters

Name Type Description Default
name str The name of the benefit object to delete. required

Raises

Name Type Description
ValueError If the benefit object does not exist.

edit_benefit

api.benefits.edit_benefit(benefit)

Edit a benefit object in the database.

Parameters

Name Type Description Default
benefit IBenefit The benefit object to edit. required

Raises

Name Type Description
ValueError If the benefit object does not exist.

get_aggregation_benefits

api.benefits.get_aggregation_benefits(name)

Get the aggregation benefits for a benefit assessment.

Parameters

Name Type Description Default
name str The name of the benefit assessment. required

Returns

Name Type Description
gpd.GeoDataFrame The aggregation benefits for the benefit assessment.

get_benefit

api.benefits.get_benefit(name)

Get a benefit from the database by name.

Parameters

Name Type Description Default
name str The name of the benefit to retrieve. required

Returns

Name Type Description
IBenefit The benefit object with the given name.

Raises

Name Type Description
ValueError If the benefit with the given name does not exist.

get_benefits

api.benefits.get_benefits()

Get all benefits from the database.

Returns

Name Type Description
dict[str, Any] A dictionary containing all benefits. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each benefit.

run_benefit

api.benefits.run_benefit(name)

Run the benefit assessment.

Parameters

Name Type Description Default
name Union[str, list[str]] The name of the benefit object to run. required

save_benefit

api.benefits.save_benefit(benefit)

Save a benefit object to the database.

Parameters

Name Type Description Default
benefit IBenefit The benefit object to save. required

Raises

Name Type Description
ValueError If the benefit object is not valid.
Back to top