Skip to content

Commit

Permalink
update custom label-options to new format
Browse files Browse the repository at this point in the history
As part of the work on unifying footprint calculations, the label options spec gets the following changes:
- baseMode renamed to base_mode (to be consistent with other config fields which are snake_case)
- the new 'footprint' field, which is an object with energy intensities broken down by fuel type. This will replace 'kgCo2PerKm'.
- properties are inherited from the base_mode. For example, a mode label option with base_mode of CAR will inherit the icon, color, met, and footprint of CAR. These can still be overridden if given on the mode label option.

I have updated the existing label options to adhere to this. Many of the existing fields will no longer be used or will be redundant because the base mode already provide them. I have left these fields in the JSON files for backwards-compatibility reasons, organized onto a separate, indented line. Once we are confident that users are on a new version of the app, we can remove them. Only the fields on the unindented lines will remain.

example-program-label-options.json and example-study-label-options.json are removed. Instead of these, we are going to have the docs point to the "default" label options (https://github.com/JGreenlee/e-mission-common/blob/master/src/emcommon/resources/label-options.default.json) to give deployers an example of how to set up a label options file
the example label-options were not used by anything except the dev-emulator configs. I removed the label_options field from these, so they will just use the default label options.
  • Loading branch information
JGreenlee committed Sep 12, 2024
1 parent 84e8b25 commit ad5f991
Show file tree
Hide file tree
Showing 9 changed files with 280 additions and 477 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/add-new-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ body:
attributes:
label: Custom Labels
description: If you chose false above, and want drowdown style labeling, please provide the file name for your custom labels. You will need to submit a PR to add it to our repo - https://github.com/e-mission/nrel-openpath-deploy-configs/tree/main/label_options
placeholder: example-program-label-options.json
placeholder: your-program-name-label-options.json

- type: markdown
attributes:
Expand Down
1 change: 0 additions & 1 deletion configs/dev-emulator-program.nrel-op.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
}
}
},
"label_options": "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/label_options/example-program-label-options.json",
"display_config": {
"use_imperial": false
},
Expand Down
1 change: 0 additions & 1 deletion configs/dev-emulator-study.nrel-op.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
}
}
},
"label_options": "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/label_options/example-study-label-options.json",
"display_config": {
"use_imperial": false
},
Expand Down
30 changes: 20 additions & 10 deletions label_options/caebike-label-options.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"MODE": [
{"value":"walk_run", "baseMode":"WALKING", "met": {"ALL": {"range": [0, -1], "mets": 3}}, "kgCo2PerKm": 0},
{"value":"auto_driver", "baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.22031},
{"value":"auto_passenger", "baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.110155},
{"value":"e-bike", "baseMode":"E_BIKE", "met": {"ALL": {"range": [0, -1], "mets": 5}}, "kgCo2PerKm": 0.00728},
{"value":"bike", "baseMode":"BICYCLING", "met": {"ALL": {"range": [0, -1], "mets": 6}}, "kgCo2PerKm": 0},
{"value":"taxi", "baseMode":"TAXI", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.30741},
{"value":"bike_scooter_share", "baseMode":"BICYCLING", "met": {"ALL": {"range": [0, -1], "mets": 3.5}}, "kgCo2PerKm": 0.00447},
{"value":"bus_train", "baseMode":"BUS", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.179033},
{"value":"other_mode", "baseMode":"OTHER", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0},
{"value":"not_a_trip", "baseMode":"UNKNOWN", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0}
{"value":"walk_run", "base_mode": "WALKING", "met": {"ALL": {"range": [0, -1], "mets": 3}},
"baseMode":"WALKING", "kgCo2PerKm": 0},
{"value":"auto_driver", "base_mode": "CAR",
"baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.22031},
{"value":"auto_passenger", "base_mode": "CAR", "passengers": 2,
"baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.110155},
{"value":"e-bike", "base_mode": "E_BIKE",
"baseMode":"E_BIKE", "met": {"ALL": {"range": [0, -1], "mets": 5}}, "kgCo2PerKm": 0.00728},
{"value":"bike", "base_mode": "BICYCLING",
"baseMode":"BICYCLING", "met": {"ALL": {"range": [0, -1], "mets": 6}}, "kgCo2PerKm": 0},
{"value":"taxi", "base_mode": "TAXI",
"baseMode":"TAXI", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.30741},
{"value":"bike_scooter_share", "base_mode": "BICYCLING", "footprint": {"electric": {"wh_per_km": 8.39, "wh_per_trip": 2.05 }},
"baseMode":"BICYCLING", "met": {"ALL": {"range": [0, -1], "mets": 3.5}}, "kgCo2PerKm": 0.00447},
{"value":"bus_train", "base_mode": "BUS",
"baseMode":"BUS", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.179033},
{"value":"other_mode", "base_mode": "OTHER",
"baseMode":"OTHER", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0},
{"value":"not_a_trip", "base_mode": "NONE",
"baseMode":"NONE", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0}
],
"PURPOSE": [
{"value":"to_home"},
Expand Down
124 changes: 0 additions & 124 deletions label_options/example-program-label-options.json

This file was deleted.

106 changes: 0 additions & 106 deletions label_options/example-study-label-options.json

This file was deleted.

45 changes: 30 additions & 15 deletions label_options/godcgo-label-options.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
{
"MODE": [
{"value":"walk", "baseMode":"WALKING", "met_equivalent":"WALKING", "kgCo2PerKm": 0},
{"value":"bike", "baseMode":"BICYCLING", "met_equivalent":"BICYCLING", "kgCo2PerKm": 0},
{"value":"scootershare", "baseMode":"E_SCOOTER", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.00894},
{"value":"drove_alone", "baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.22031},
{"value":"shared_ride", "baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.11015},
{"value":"e_car_drove_alone", "baseMode":"E_CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.08216},
{"value":"e_car_shared_ride", "baseMode":"E_CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.04108},
{"value":"moped", "baseMode":"MOPED", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.05555},
{"value":"taxi", "baseMode":"TAXI", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.30741},
{"value":"bus", "baseMode":"BUS", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.20727},
{"value":"train", "baseMode":"TRAIN", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.12256},
{"value":"free_shuttle", "baseMode":"BUS", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.20727},
{"value":"air", "baseMode":"AIR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.09975},
{"value":"not_a_trip", "baseMode":"UNKNOWN", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0},
{"value":"other", "baseMode":"OTHER", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0}
{"value":"walk", "base_mode": "WALKING",
"baseMode":"WALKING", "met_equivalent":"WALKING", "kgCo2PerKm": 0},
{"value":"bike", "base_mode": "BICYCLING",
"baseMode":"BICYCLING", "met_equivalent":"BICYCLING", "kgCo2PerKm": 0},
{"value":"scootershare", "base_mode": "E_SCOOTER",
"baseMode":"E_SCOOTER", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.00894},
{"value":"drove_alone", "base_mode": "CAR",
"baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.22031},
{"value":"shared_ride", "base_mode": "CAR", "passengers": 2,
"baseMode":"CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.11015},
{"value":"e_car_drove_alone", "base_mode": "E_CAR",
"baseMode":"E_CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.08216},
{"value":"e_car_shared_ride", "base_mode": "E_CAR", "passengers": 2,
"baseMode":"E_CAR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.04108},
{"value":"moped", "base_mode": "MOPED",
"baseMode":"MOPED", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.05555},
{"value":"taxi", "base_mode": "TAXI",
"baseMode":"TAXI", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.30741},
{"value":"bus", "base_mode": "BUS",
"baseMode":"BUS", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.20727},
{"value":"train", "base_mode": "TRAIN",
"baseMode":"TRAIN", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.12256},
{"value":"free_shuttle", "base_mode": "BUS",
"baseMode":"BUS", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.20727},
{"value":"air", "base_mode": "AIR",
"baseMode":"AIR", "met_equivalent":"IN_VEHICLE", "kgCo2PerKm": 0.09975},
{"value":"not_a_trip", "base_mode": "NONE",
"baseMode":"UNKNOWN", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0},
{"value":"other", "base_mode": "OTHER",
"baseMode":"OTHER", "met_equivalent":"UNKNOWN", "kgCo2PerKm": 0}
],
"PURPOSE": [
{"value":"home"},
Expand Down
Loading

0 comments on commit ad5f991

Please sign in to comment.