Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base mode and footprint to the labeled trips dataframe #152

Merged
merged 33 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
12e5824
temporary bump of e-mission-common version for this branch
Abby-Wheelis Sep 16, 2024
bd33afc
refactor trip loading to fetch base mode and footprint
Abby-Wheelis Sep 16, 2024
2226b29
await the async load function
Abby-Wheelis Sep 16, 2024
6409725
create a list from iterator
Abby-Wheelis Sep 16, 2024
f2de060
add footprint and replaced mode footprint to the df
Abby-Wheelis Sep 16, 2024
7ee9d4a
separate footprint data from metadata
Abby-Wheelis Sep 16, 2024
f56d4d2
replace footprint calculations
Abby-Wheelis Sep 16, 2024
696417a
remove old code, add TODOs
Abby-Wheelis Sep 16, 2024
391aa17
wait for data before proceeding
Abby-Wheelis Sep 17, 2024
af5ace7
rename energy and emissions columns
Abby-Wheelis Sep 17, 2024
ff0a697
missing await
Abby-Wheelis Sep 17, 2024
814b3c2
parameterize footprint calculations
Abby-Wheelis Sep 17, 2024
579b349
use the newest version of e-mission-common
Abby-Wheelis Sep 18, 2024
b94561a
Merge remote-tracking branch 'upstream/main' into add-footprint-to-df
Abby-Wheelis Sep 22, 2024
e70d693
remove label dictionaries
Abby-Wheelis Sep 22, 2024
d44e3c6
remove csvs
Abby-Wheelis Sep 22, 2024
6f2335a
Remove COPY auxillary_files in Dockerfile since we do not have auxill…
iantei Sep 23, 2024
768c38b
Remove mapping_dictionaries from crontab. We don't have mapping_dicti…
iantei Sep 23, 2024
5255e1d
Remove dic_re as the param from load_viz_notebook_data().
iantei Sep 23, 2024
e15de8e
Add check to see if there is mode_confirm_footprint in expanded_ct.co…
iantei Sep 23, 2024
a804f22
Update check for mode_confirm_footprint instead of mode_confirm, as u…
iantei Sep 23, 2024
1ca1e56
Use internal label over Display label for trip_purpose_query.
iantei Sep 23, 2024
1fbe879
Update the bar label for commute trips.
iantei Sep 23, 2024
aaa07ac
Update stacked_bar_quality_text_commute_labeled/inferred for commute …
iantei Sep 23, 2024
ea3cd89
Remove check for replaced_mode since replaced_mode are only available…
iantei Sep 23, 2024
4ccd159
Add a check to not execute generic_metrics notebook for survey metric…
iantei Sep 23, 2024
22f720c
Update the exception message in stopping execution of survey info rel…
iantei Sep 23, 2024
468d40e
Change the notebook execution check to look up for trip-labels as MUL…
iantei Sep 24, 2024
2ebb1cf
revert addition of emcommon import
Abby-Wheelis Sep 25, 2024
3f43e00
update condition for generic metrics
Abby-Wheelis Sep 25, 2024
1a8629d
correct import
Abby-Wheelis Sep 25, 2024
29f99b1
Remove metrics_program/study_withoutEnergyMetrics.html, and its use i…
iantei Sep 25, 2024
edfc6ec
Remove check to build ts_energy_user only when dynamic labels is avai…
iantei Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,16 +426,13 @@
});
}
else if (data.intro.program_or_study == 'program') { //CASE: PROGRAM
// Note: We're disabling energy metrics on public dashboard when dynamic labels are available.
// TODO: Remove the if (data.label_options) in future when energy computation is handled properly.
Comment on lines -429 to -430
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! So happy to handle the TODO!

if (dynamic_labels) {
load_file = "metrics_program_withoutEnergyMetrics.html"
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
}
else {
load_file = "metrics_program.html"
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
}
load_file = "metrics_program.html"
$.get(load_file, function (response) {
const configuredResponse = response.replaceAll("${data.intro.mode_studied}", mode_studied);
console.log("configuring units");
Expand All @@ -454,15 +451,13 @@
else // CASE: STUDY
{
if (dynamic_labels) {
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
load_file = 'metrics_study_withoutEnergyMetrics.html'
// $('#metric').load('metrics_study_withoutEnergyMetrics.html');
console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
}
else {
console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
load_file = 'metrics_study.html'
// $('#metric').load('metrics_study.html');
};
}
load_file = 'metrics_study.html'
// $('#metric').load('metrics_study.html');
console.log("loading study, replacing units")
$.get(load_file, function (response) {
console.log("configuring units");
Expand Down
34 changes: 0 additions & 34 deletions frontend/metrics_program_withoutEnergyMetrics.html

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/metrics_study_withoutEnergyMetrics.html

This file was deleted.

1 change: 0 additions & 1 deletion viz_scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ RUN /bin/bash -c "source setup/activate.sh && conda env update --name emission -
RUN mkdir -p /usr/src/app/saved-notebooks
WORKDIR /usr/src/app/saved-notebooks

COPY auxiliary_files ./auxiliary_files
COPY bin ./bin
COPY *.ipynb .
COPY *.py .
Expand Down
17 changes: 0 additions & 17 deletions viz_scripts/auxiliary_files/energy_intensity.csv

This file was deleted.

33 changes: 0 additions & 33 deletions viz_scripts/auxiliary_files/mode_labels.csv

This file was deleted.

47 changes: 0 additions & 47 deletions viz_scripts/auxiliary_files/purpose_labels.csv

This file was deleted.

1 change: 0 additions & 1 deletion viz_scripts/docker/crontab
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
0 7 * * * python bin/update_mappings.py mapping_dictionaries.ipynb >> /var/log/intake.stdinout 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am so glad that we were able to delete this as well. Fun fact: when people start working with the public dashboard, they would typically not read the instructions to run the mapping_dictionaries first and would report that the run failed.

Glad to see that we won't have that issue any more

0 8 * * * python bin/generate_plots.py generic_metrics.ipynb default >> /var/log/intake.stdinout 2>&1
0 8 * * * python bin/generate_plots.py generic_metrics_sensed.ipynb default >> /var/log/intake.stdinout 2>&1
0 8 * * * python bin/generate_plots.py generic_timeseries.ipynb default >> /var/log/intake.stdinout 2>&1
Expand Down
28 changes: 4 additions & 24 deletions viz_scripts/energy_calculations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,6 @@
" raise Exception(\"The plots in this notebook are only relevant to programs\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "nearby-fruit",
"metadata": {},
"outputs": [],
"source": [
"# Loading mapping dictionaries from mapping_dictionaries notebook\n",
"%store -r df_ei\n",
"%store -r dic_re\n",
"%store -r dic_pur\n",
"%store -r dic_fuel\n",
"\n",
"# convert a dictionary to a defaultdict\n",
"dic_re = defaultdict(lambda: 'Other',dic_re)\n",
"dic_pur = defaultdict(lambda: 'Other',dic_pur)\n",
"dic_fuel = defaultdict(lambda: 'Other',dic_fuel)"
]
},
{
"cell_type": "markdown",
"id": "parallel-patch",
Expand All @@ -111,11 +92,10 @@
" program,\n",
" study_type,\n",
" dynamic_labels,\n",
" dic_re,\n",
" dic_pur=dic_pur,\n",
" include_test_users=include_test_users)\n",
"# CASE 1 of https://github.com/e-mission/em-public-dashboard/issues/69#issuecomment-1256835867 \n",
"expanded_ct = scaffolding.add_energy_impact(expanded_ct, df_ei, dic_fuel, dynamic_labels) if 'Replaced_mode' in expanded_ct.columns else expanded_ct"
" include_test_users=include_test_users,\n",
" add_footprint=True)\n",
"\n",
"expanded_ct = scaffolding.unpack_energy_emissions(expanded_ct) if \"mode_confirm_footprint\" in expanded_ct.columns else expanded_ct"
]
},
{
Expand Down
Loading