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

Test the changes on staging before pushing to production #103

Closed
shankari opened this issue Dec 5, 2023 · 61 comments
Closed

Test the changes on staging before pushing to production #103

shankari opened this issue Dec 5, 2023 · 61 comments

Comments

@shankari
Copy link
Contributor

shankari commented Dec 5, 2023

                    $.getJSON('https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/' + STUDY_CONFIG + '.nrel-op.json', function(data) {
                        // Load list of plots corresponding to study/program
                        dynamic_labels = data.label_options
                        if (data.intro.program_or_study=='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.
                            if (dynamic_labels)
                            {
                                load_file = "metrics_program_withoutEnergyMetrics.html"
                                console.log("Dynamic Labels are available for: " + STUDY_CONFIG)
                            }
                            else
                            {
                                load_file = "metrics_program_withoutEnergyMetrics.html"
                                console.log("Dynamic Labels are unavailable for: " + STUDY_CONFIG)
                            }

Confirmed using https://openpath-stage.nrel.gov/public/?study_config=smart-commute-ebike
which does not have the energy impact calculation

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

@iantei can you please address this?

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

Yes, I will fix this.

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

I couldn't wait any longer for Laos (they have been collecting data for two weeks and wanted a check-in today), so I pushed this to production for the Lao EV project

And it looks like it works, at least for the months. Still showing old values for overall, but hopefully that is just a caching issue. I don't see any other errors in the logs.

Dec 2024 All data
Screen Shot 2023-12-04 at 7 45 38 PM Screen Shot 2023-12-04 at 7 50 22 PM

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

@iantei Please also test against staging and the USAID Laos project to see if there are any other showstoppers before we push out to production in general.

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

Ah the "All Data" has now been updated 🎉

However, @iantei unlike the previous implementation, the colors are not consistent between graphs, which makes it a bit confusing while comparing - i.e. "Dark Blue" = Motorcycle in trip count versus "Dark Blue" = Airplane in trip distance.

If you have the stacked bar chart implementation ready, and it fixes this, I am OK with fixing it then. But if you don't have that yet, we may need to fix it sooner. Comments?

Screen Shot 2023-12-04 at 8 17 58 PM

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

Confirmed using https://openpath-stage.nrel.gov/public/?study_config=smart-commute-ebike which does not have the energy impact calculation

Completed the changes for the STUDY_CONFIG=smart-commute-ebike. Now it'll reflect the energy impact calculation option as a metric dropdown list.

Smart Commute eBike Program Public Dashboard
image

I am facing some issue while trying to push the changes [Cloned the repo again, created branch, tried to push changes.],

ashrest2-35384s:em-public-dashboard ashrest2$ git push --set-upstream origin Fix_Same_Metrics_For_Dynamic_and_Default_Mapping
remote: Permission to e-mission/em-public-dashboard.git denied to iantei.
fatal: unable to access 'https://github.com/e-mission/em-public-dashboard/': The requested URL returned error: 403
remote: Permission to e-mission/em-public-dashboard.git denied to iantei.
fatal: unable to access 'https://github.com/e-mission/em-public-dashboard/': The requested URL returned error: 403

I am trying to fix this. I regenerated the Personal Access Token, and tried to use it using the below command. Still getting the same error.
git remote set-url origin https://iantei:<Personal Access Token>@github.com/e-mission/em-public-dashboard

Meanwhile, I will some further testing with staging and USAID Laos Project too.

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

Ah the "All Data" has now been updated 🎉

However, @iantei unlike the previous implementation, the colors are not consistent between graphs, which makes it a bit confusing while comparing - i.e. "Dark Blue" = Motorcycle in trip count versus "Dark Blue" = Airplane in trip distance.

If you have the stacked bar chart implementation ready, and it fixes this, I am OK with fixing it then. But if you don't have that yet, we may need to fix it sooner. Comments?

The stacked bar chart implementation in plot_canbikeco.py is good to experiment with, but I am not ready to integrate this with generic_metrics to replace the existing pie-chart yet.
Meanwhile, I can look into incorporating this color association with Mode_confirm - should have been handled in previous implementation which has been changed now.

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

@iantei

remote: Permission to e-mission/em-public-dashboard.git denied to iantei.

we use fork + pull request. you don't have access to the upstream fork

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

I observe different behaviors for the STUDY_CONFIG=usaid-loas-ev in stage vs development testing.

Comparing the difference in Staging environment and Development environment:

Process followed to generate the development mode STUDY_CONFIG=usaid-laos-ev:
Code changes:

       - CRON_MODE=
-      - STUDY_CONFIG=stage-program
+      - STUDY_CONFIG=usaid-laos-ev
     ports:
       # ipynb in numbers
       - "47962:8888"

Execution steps:

(emission) root@c80c308627f2:/usr/src/app/saved-notebooks# PYTHON=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@c80c308627f2:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev
Running at 2023-12-05T07:14:27.268219+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-05-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-05T07:14:27.304945+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

Process to Launch:

Staging: [https://openpath-stage.nrel.gov/public/?study_config=usaid-laos-ev](https://openpath-stage.nrel.gov/public/?study_config=usaid-laos-ev)
Development: [http://localhost:3274/?study_config=usaid-laos-ev](http://localhost:3274/?study_config=usaid-laos-ev)

Results:

Staging Development Mode
image image

Even though usaid-laos-ev study config has dynamic config available i.e. label_options is available, it shows as the default mapping mode in the Staging environment. That is different from the development testing environment.

I am not sure what could be resulting in this issue.

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

@iantei can you please address this?

I have fixed the changes for this issue here. #104

I am keeping this open with the consideration, we might want to test, observe any other required changes and deliver the fix changes in this PR itself.

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

@iantei please put the PR into "Ready for review"

wrt differences between

Staging: https://openpath-stage.nrel.gov/public/?study_config=usaid-laos-ev
Development: http://localhost:3274/?study_config=usaid-laos-ev

the study_config GET param is only used for the frontend display (think about it - how would you pass the information from the frontend to the viz_scripts?). So the actual images will still be from the staging config.

As I said in #103 (comment)

I couldn't wait any longer for Laos (they have been collecting data for two weeks and wanted a check-in today), so I pushed this to production for the Lao EV project

The Laos production environment is at: https://usaid-laos-ev-openpath.nrel.gov/public/

If we had more time before it was pushed to production, we would have been able to take better before and after snapshots, but the code was not ready until the last minute.

You can use the snapshots above (for the trip count before and after the change) for the comparison.

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

@iantei please put the PR into "Ready for review"

I have moved the PR into "Ready for Review" stage. #104

The Laos production environment is at: https://usaid-laos-ev-openpath.nrel.gov/public/

Things look good at the Laos production environment.

@iantei
Copy link
Contributor

iantei commented Dec 5, 2023

Laos Production Charts Test [Aggregate Data]

Launched the following site https://usaid-laos-ev-openpath.nrel.gov/public/
Loaded all the charts with Month = All data

For the aggregated data, I have enlisted all the charts.

Laos Production Charts (Aggregate)
image

Laos Production Charts Test [11/2023]

Launched the following site https://usaid-laos-ev-openpath.nrel.gov/public/
Loaded all the charts with Month = 11/2023

For the aggregated data, I have enlisted all the charts.

Laos Production Chart (11/2023)
image

Common observations in both the cases above:

  1. There are no charts available for Average trip length (selected by users) All data Default and Average trip length (sensed) All data Default.
  2. As mentioned above comment there not a fixed association of color palette with the Mode_confirm. This might lead to some confusion to the end-user.
  3. The emission timeseries charts like
  • "Timeseries of emissions per kilometer"
  • "Timeseries of emissions"

displays the distance/weight in Metric system (as the Laos config has dynamic config) i.e. kg/km

while the following other charts like:

  • "Trip count under 10 miles",
  • "Trip count under 10 miles (sensed) All data",
  • "Trip miles by mode All data Default",
  • "Trip miles by mode (sensed) All Data Default",
  • "Trip miles by land mode (sensed) All data Default",
  • "Average trip length All data Default" still uses Imperial system (existing implementation), depicting distance as in miles

Could this be a cause of concern or confusion to the end user?

@shankari
Copy link
Contributor Author

shankari commented Dec 5, 2023

There are no charts available for Average trip length (selected by users) All data Default and Average trip length (sensed) All data Default.

Interesting. Is this also true on staging (with the default study_config? Let's try to reproduce and see if there was a regression.

As mentioned above #103 (comment) there not a fixed association of color palette with the Mode_confirm. This might lead to some confusion to the end-user.

Correct, we need to fix this, either immediately, or (if the stacked bar charts are imminent), then while implementing them.

while the following other charts like: .... still uses Imperial system (existing implementation), depicting distance as in miles
Could this be a cause of concern or confusion to the end user?

Yes. There are many aspects of the public dashboard that need to respect the dynamic config. The first and most important one was the mode_of_interest (implemented much earlier). The second was the dynamic labels, which we finished just barely in time (I had deploy to Laos without waiting for the full testing on staging). IIRC, we discussed using imperial units earlier, but decided to defer to focus on higher priority dynamic label change.
#89 (comment)

Per the comment, have you already filed an issue? If so, we should track the useImperial change there but link it here for context.

@iantei
Copy link
Contributor

iantei commented Dec 6, 2023

Executed on staging mode (in development setting) for `study_config` as `smart-commute-ebike`

Code changes:

ashrest2-35384s:em-public-dashboard ashrest2$ git diff docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index 73a9875..9e495ab 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -21,7 +21,7 @@ services:
       - DB_HOST=db
       - WEB_SERVER_HOST=0.0.0.0
       - CRON_MODE=TRUE
-      - STUDY_CONFIG=stage-program
+      - STUDY_CONFIG=smart-commute-ebike
     ports:
       # ipynb in numbers
       - "47962:8888"

Steps followed:

  1. Spin up the docker-compose
docker-compose -f docker-compose.dev.yml  up
  1. Launch bash for em-public-dashboard-notebook-server
    In the next terminal to execute generate plots for different notebooks:
docker exec -it em-public-dashboard-notebook-server-1 /bin/bash
3. Execution for different notebooks

Generic_Metrics notebook:

(emission) root@43a25923608a:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@43a25923608a:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/smart-commute-ebike.nrel-op.json
Successfully downloaded config with version 1 for Smart Commute eBike Program and data collection URL https://smart-commute-ebike-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in smart-commute-ebike
Running at 2023-12-06T17:46:59.268655+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-03-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-06T17:46:59.312257+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:14.897413+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=3), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:22.676692+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=4), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:29.420816+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:36.110161+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:42.733415+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:49.275537+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:48:56.033590+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:49:02.605112+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:49:10.017333+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T17:49:16.665559+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]

Generic Timeseries notebook:

(emission) root@43a25923608a:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/smart-commute-ebike.nrel-op.json
Successfully downloaded config with version 1 for Smart Commute eBike Program and data collection URL https://smart-commute-ebike-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in smart-commute-ebike
Running at 2023-12-06T18:05:20.821141+00:00 with args Namespace(plot_notebook='generic_timeseries.ipynb', program='default', date=None) for range (<Arrow [2023-03-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-06T18:05:20.869685+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:05:39.557977+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=3), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:05:44.714619+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=4), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:05:49.899169+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:05:54.989905+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:06:00.015315+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:06:05.370726+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:06:10.494625+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:06:15.615391+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:06:20.862873+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:06:26.071122+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]

Mode_specific_metrics notebook

(emission) root@43a25923608a:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/smart-commute-ebike.nrel-op.json
Successfully downloaded config with version 1 for Smart Commute eBike Program and data collection URL https://smart-commute-ebike-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in smart-commute-ebike
Running at 2023-12-06T18:07:08.210813+00:00 with args Namespace(plot_notebook='mode_specific_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-03-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-06T18:07:08.251620+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:22.910122+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=3), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:28.580102+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=4), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:34.334198+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:39.907773+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:45.417852+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:51.189368+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:07:56.768261+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:08:02.479935+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:08:08.110607+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:08:13.875984+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]

Mode specific timeseries notebook:

(emission) root@43a25923608a:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/smart-commute-ebike.nrel-op.json
Successfully downloaded config with version 1 for Smart Commute eBike Program and data collection URL https://smart-commute-ebike-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in smart-commute-ebike
Running at 2023-12-06T18:10:54.616696+00:00 with args Namespace(plot_notebook='mode_specific_timeseries.ipynb', program='default', date=None) for range (<Arrow [2023-03-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-06T18:10:54.652321+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:11:34.486061+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=3), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:11:40.714461+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=4), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:11:46.995355+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:11:53.220028+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:11:59.429893+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:12:05.667969+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:12:13.317264+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:12:19.655123+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:12:25.790018+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:12:32.041578+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]

Energy calculations notebook:


/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/smart-commute-ebike.nrel-op.json
Successfully downloaded config with version 1 for Smart Commute eBike Program and data collection URL https://smart-commute-ebike-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in smart-commute-ebike
Running at 2023-12-06T18:13:37.385766+00:00 with args Namespace(plot_notebook='energy_calculations.ipynb', program='default', date=None) for range (<Arrow [2023-03-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-06T18:13:37.428080+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:13:51.197153+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=3), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:13:54.672927+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=4), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:13:58.112755+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:01.669998+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:05.349595+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:09.324795+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:13.106214+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:16.766730+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:20.481391+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-06T18:14:24.233571+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]

Results:

Charts for study_config = smart-commute-ebike
image

Observations:

There is a slight issue with the arrangement of charts like "Timeseries of proposition of e-bike specific miles All data Default", which was immobile and was placed on top of the existing charts.

Illustration of the overlapping charts issue:

Overlapping_Charts.mov

There is a work-around for this issue though. Close those overlapping charts and re-launch it.

Possible work around solution:
Results:

After following possible work-around solution
image

We can observe no charts are available for Average trip length (selected by users) All data Default even with this study_config = smart-commute-ebike.

@iantei
Copy link
Contributor

iantei commented Dec 6, 2023

Execution of Smart Commute E-bike:
Working on with the same charts generated from earlier iteration for Smart Commute E-bike.

Using dataset: vail dataset

Some observation:

Smart Commute eBike Program Public Dashboard
image

Each the individual month selection were not able to generate charts, while the aggregate one was able to give the chart representation properly. Isn't it required that at least one of the individual chart should have enough data to generate the chart alongside aggregate one?

Observed the same for the below metrics too:

- Number of Trips
- Number of commute trips
- Trip count by purpose
- Trip count under 10 miles

Available dates: 3/2023 - 12/2023
Tested on Chrome.

@shankari
Copy link
Contributor Author

shankari commented Dec 6, 2023

@iantei when you are checking the frontend and not the graphs, is there a reason you are not testing on staging directly?
You are still using the same dataset, so if there are errors in working with the data, they will (largely) apply across all configs. Can you please understand the interplay between frontend config, viz scripts config, container type and dataset and come up with a testing plan?

@iantei
Copy link
Contributor

iantei commented Dec 6, 2023

Ah the "All Data" has now been updated 🎉

The below test have been conducted after launching:
https://usaid-laos-ev-openpath.nrel.gov/public/

In reference to this comment's status about the chart representation in Laos

Previous Latest (06/Dec/2023)
Previous_Laos image

It's not possible to compare between these two charts distinctly because the total number of testers has changed from 6 to 10 and 19 to 20 respectively for 12/2023 charts and All Data charts.
Similarly, the participants's total trips and number of users have also changed.

One of the observation in the below chart is: [Observed on 6 Dec 2023]

Number of trips 12/2023
Number of Trips 12/2023

Even though the distribution of Other is higher (7.8% (6)) than Walk (6.5% (5)), it is shows in the later pie order, which doesn't look right, accounting all distribution of charts' pie are happening in anti-clockwise order in increasing distribution.

@iantei
Copy link
Contributor

iantei commented Dec 6, 2023

@iantei when you are checking the frontend and not the graphs, is there a reason you are not testing on staging directly? You are still using the same dataset, so if there are errors in working with the data, they will (largely) apply across all configs. Can you please understand the interplay between frontend config, viz scripts config, container type and dataset and come up with a testing plan?

According to the meeting discussion we had yesterday, I understood that I do not have access to staging, dataset or configuration changes related with staging.
So, I would have to make change on the docker-compose environment for study_config for docker.compose.yml, generate the charts and observe the changes via. access to the http://localhost:3274/?study_config=smart-commute-ebike
I have scheduled a meeting with you. It would be great if we can clarify it over the meeting.

@shankari
Copy link
Contributor Author

shankari commented Dec 6, 2023

@iantei given that we did discuss it yesterday and it wasn't clear, can you please add in what your understanding and proposal is, and I can respond in writing? That might make it easier to have a clear plan going forward.

@iantei
Copy link
Contributor

iantei commented Dec 7, 2023

Sure.
Let me explain you my understanding first. Please correct me accordingly.

  1. We have two docker compose files for viz_scripts. The first one is docker-compose.dev.yml and the second one is docker-compose.yml.
    For development testing:
    I would launch docker-compose.dev.yml with the required study_config in the environment section of it.
    In the next terminal, launch docker exec -it em-public-dashboard-notebook-server-1 /bin/bash
    Execute the following scripts:
PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default 
...

This will load the corresponding charts file in the /plots folder.
Then correspondingly, the frontend would pick up these plots to showcase on the dashboard, according to the selection of options.

My understanding is, since I do not have access to staging environment configuration changes. I would try to emulate it by spinning up the docker-compose.yml instead itself.

@iantei when you are checking the frontend and not the graphs, is there a reason you are not testing on staging directly?

My understanding is I do not have access to the staging configuration changes or the dataset used in staging environment. I tried the following,

You are still using the same dataset, so if there are errors in working with the data, they will (largely) apply across all configs.

For this part - the vail dataset is only giving issues with the sensed related chart representation. In this case, the charts are being generated well for the aggregated data while none of the individual ones are being generated.
My concern was - how could it generate the chart well for aggregated data while none of the individual charts are generated properly?

Can you please understand the interplay between frontend config, viz scripts config, container type and dataset and come up with a testing plan?

Here's my understanding about this.
I had initially loaded the vail dataset, with which I am conducting the test in development mode. There are three services specified in the docker-compose file:

  1. frontend
  2. server
  3. db

I have been using the vail dataset, which I have loaded and stored in the db and is being used by the viz_scripts to generate the charts, which would in turn be used by frontend to display charts according to metrics selected on the dashboard.

When you asked me to test against staging, I wasn't sure about proceed to test in staging environment, and felt that emulating the development testing scenario but with docker-compose.yml spin up could be equivalent.

Could you please let me know the appropriate way to "test against staging"?

@shankari
Copy link
Contributor Author

shankari commented Dec 7, 2023

@iantei there are three aspects that come together in the public dashboard:

  1. the study/program configuration
  2. the dataset
  3. the location where the containers are run (laptop/cloud)

(1) is public for all studies and all programs
(2) we can pull datasets as needed (vail is not a canonical dataset)
(3) you can launch containers locally, and access public interfaces of containers in the cloud

You need to think through what you are testing, and how you can assemble the pieces to check that it works.

As a concrete example and an explanation for "test against staging", consider testing the frontend.
You can access http://localhost:... by running "prod" containers on your laptop, but that is not really different from accessing the dev frontend. Note that the dev and prod Dockerfiles are not substantially different for the frontend (only the exposed port is different).

For the frontend, you want to check that the cloud deployment is correct since that is the big difference. So you should test using https://openpath-stage.nrel.gov/public which you can access (as can anybody else in the world).

When running the viz_scripts, the difference between dev and production is in other areas, and you should focus on testing those. Hope that helps!

I would suggest thinking through what those differences are, and coming up with a plan to test them. This may involve additional support from me.

@shankari shankari changed the title 🚑 for programs, we show the same set of metrics for dynamic and non-dynamic labels Test the changes on staging before pushing to production Dec 7, 2023
@iantei
Copy link
Contributor

iantei commented Dec 7, 2023

For the frontend, you want to check that the cloud deployment is correct since that is the big difference. So you should test using https://openpath-stage.nrel.gov/public which you can access (as can anybody else in the world).

The https://openpath-stage.nrel.gov/public/ takes the study_config as stage-study as default.
When I change the study_config to usaid-laos-ev and load https://openpath-stage.nrel.gov/public/?study_config=usaid-laos-ev, I am unable to see the changes in the charts since the viz_scripts are not executed with this changed study_config param.

For the development testing in localhost, I change the environment in the docker-compose.dev.yml and/or docker-compose.yml for study_config to the required one and load the frontend with the updated config param.
In this way:
Changes in the docker-compose.dev.yml

  notebook-server:
   ...
    environment:
      ...
      - STUDY_CONFIG=smart-commute-ebike

Re-generate all the charts by getting inside the public-dashboard-notebook-server.
Testing these changes:
Launch: http://localhost:<3274>/?study_config=smart-commute-ebike

For the staging testing, is there any specific container (other than docker-compose.dev.yml or docker-compose.yml ), which I can modify to integrate the change of config, so it gets reflected on the https://openpath-stage.nrel.gov/public/?study_config=smart-commute-ebike?
Basically, I want to know the process of using different config to test in staging environment.

@shankari
Copy link
Contributor Author

shankari commented Dec 8, 2023

Your comment in #103 (comment) is focused on testing viz_scripts. My comment in #103 (comment) talked about the frontend and not the graphs.

when you are checking the frontend and not the graphs, is there a reason you are not testing on staging directly?

I repeated this in #103 (comment)

For the frontend, you want to check that the cloud deployment is correct since that is the big difference. So you should test using https://openpath-stage.nrel.gov/public which you can access (as can anybody else in the world).

You need to test both the frontend and the viz_scripts and you need to do test them in different ways because the meaningful differences between dev and staging are different for the two components.

For the staging testing, is there any specific container ... which I can modify to integrate the change of config, so it gets reflected on the https://openpath-stage.nrel.gov/public/?study_config=smart-commute-ebike?

No. How can there be?

Other comments:

The https://usaid-laos-ev-openpath.nrel.gov/public/ takes the study_config as stage-study as default.

This is incorrect. This takes usaid-laos-ev as the study_config by default.

(other than docker-compose.dev.yml or docker-compose.dev.yml ),

Not sure what you mean here - these are the same file.

@iantei
Copy link
Contributor

iantei commented Dec 8, 2023

Other comments:

The https://usaid-laos-ev-openpath.nrel.gov/public/ takes the study_config as stage-study as default.

This is incorrect. This takes usaid-laos-ev as the study_config by default.

Yes, that's right. Updated the above comment - I used the wrong text representation for the right hyperlink.
I meant for https://openpath-stage.nrel.gov/public

(other than docker-compose.dev.yml or docker-compose.dev.yml ),

Not sure what you mean here - these are the same file.

Corrected the above comment: I meant, docker-compose.dev.yml or docker-compose.yml instead.

@iantei
Copy link
Contributor

iantei commented Dec 8, 2023

For the staging testing, is there any specific container ... which I can modify to integrate the change of config, so it gets reflected on the https://openpath-stage.nrel.gov/public/?study_config=smart-commute-ebike?

No. How can there be?

I have tested the viz_scripts execution in docker-compose.yml already #103(comment). My question to look up for different container was to understand if are ways to validate for charts in the staging environment for different configurations.

@iantei
Copy link
Contributor

iantei commented Dec 8, 2023

Based on the above discussion,
Here's my high level test plan to test the changes on staging before pushing to production. Please let me know if any revision in the approach is required.

There are two aspects we need to check for:

  1. Frontend: [Testing in both localhost, and staging environment]
    There is either a Study or Program with or without dynamic labels.
    A. For Study -
    a. Are all the default charts being displayed?
    b. Are all Metrics being listed for selection?
    c. Are all these metrics generating the charts [The values of the chart might not depict the correct values]?
    B. For Program -
    a. Are all the default charts being displayed?
    b. Are all Metrics being listed for selection?
    c. Are all these metrics generating the charts [The values of the chart might not depict the correct values]?

  2. Viz_scripts: [Test with both dev and prod docker compose, and load into localhost]
    Can be deployed in either production environment or development environment
    1. Executed using the docker-compose.yml vs docker-compose.dev.yml
    2. The generated charts needs to be accessed via. localhost and further validated.
    3. Are all charts generated? Does the charts look right - default mapping vs dynamic config has significant difference with the mapping of labels?

Test both the aspects above with the below combination:
1. default mapping + study washingtoncommons
2. default mapping + program ebikegj
4. dynamic config + study usaid-laos-ev
5. dynamic config + program dev-emulator-program

This way, we're validating all the default and list of metrics to be displayed for both program/study with/out dynamic labels in the em-public-dashboard.
Secondly, we're validating the charts are being generated or not in both development and production environment for all notebooks.

We are already validating the charts generated in prod environment through localhost.
Still - I am not sure, I have a question. How can we test the charts (not frontend) in staging environment with different configurations. Could you please help me understand this?

Note: The Laos config has already been tested in the production environment #103(comment)

@iantei
Copy link
Contributor

iantei commented Dec 12, 2023

NOTE: Still updating

Frontend Testing:

Process of testing:

Launch the following sites:

  1. https://openpath-stage.nrel.gov/public/?study_config=washingtoncommons
  2. https://openpath-stage.nrel.gov/public/?study_config=ebikegj
  3. https://openpath-stage.nrel.gov/public/?study_config=usaid-laos-ev
  4. https://openpath-stage.nrel.gov/public/?study_config=dev-emulator-program

And test for the below configurations, which are presented as columns below -

Index Config Type Are all the default charts being displayed? Are all metrics being listed for selection? Are all metrics generating the charts?
1 Default Mapping + Study washingtoncommons Yes (7/7) Yes (21/21) image No (Average Trip Length (sensed), Average Trip Length (selected by users) missing)
2 Default Mapping + Program ebikegj Yes (7/7) No (33/35) image No (Average Trip Length (sensed), Average Trip Length (selected by users) missing)
3 Dynamic Config + Study usaid-laos-ev Yes (7/7) Yes (20/20)image No (Average Trip Length (sensed), Average Trip Length (selected by users) missing)
4 Dynamic Config + Program dev-emulator-program Yes (7/7) Yes (33/33) image No (Average Trip Length (sensed), Average Trip Length (selected by users) missing)

Observations:

  1. All these metrics are not able to generate charts for "Average Trip Length (sensed)" and "Average Trip Length (selected by users) missing".
  2. For Default Mapping + Program, there are missing selection options for "Timeseries of energy" and "Sketch of e-bike specific Energy Impact".

@shankari
Copy link
Contributor Author

shankari commented Dec 13, 2023

We are already validating the charts generated in prod environment through localhost.
Still - I am not sure, I have a question. How can we test the charts (not frontend) in staging environment with different configurations. Could you please help me understand this?

We cannot [1]. Pop quiz: why can't we?

Let's not lose the forest for the trees. Our overall goal is to ensure that when we go to production, it will not break. Staging offers a production-like environment to help ensure that. So while planning testing, you need to think about what is different between dev and prod, and how you can test those differences before pushing to prod.

[1] That is a very blanket statement. Of course, we can do many things if we had lots of time and resources. But we cannot do so without completely changing our current staging setup in ways that will cause it to diverge from

All these metrics are not able to generate charts for "Average Trip Length (sensed)" and "Average Trip Length (selected by users) missing".

  1. you need to see why "Average Trip Length" is missing.
  2. all of these are on staging, so all the figures will be the same. I am not sure what you get by the "Are all metrics generating the charts?" column. You need to test that differently.

For Default Mapping + Program, there are missing selection options for "Timeseries of energy" and "Sketch of e-bike specific Energy Impact".

isn't this what was originally reported and fixed in #103 (comment)

@shankari
Copy link
Contributor Author

shankari commented Dec 14, 2023

all of these are on staging, so all the figures will be the same. I am not sure what you get by the "Are all metrics generating the charts?" column. You need to test that differently.

Yes, I will be testing the scenario of generating the charts with running the docker-compose.yml as explained above.

Please read through #103 (comment) carefully
Which of the three aspects does your proposed viz_script testing strategy tackle?

@iantei
Copy link
Contributor

iantei commented Dec 14, 2023

I have the following understanding about the missing charts above:

  1. For "Average Trip Length (selected by users)"

The generation of chart associated with "Average Trip Length (selected by users)" have been removed in the commit #51 . Further, I do not see any file_name associated with average_miles_mode_confirm2 in the current main branch.
image

Possible solution:
There's barplot_mode2() present on plots.py. We could revert back this change, and it would likely work.

  1. For "Average Trip Length (sensed)"

I do not see any changes which would generate the file average_miles_sensed_mode, while all other sensed related metric chart files are being generated here. #92

Possible solution:
We will need to incorporate changes for the average_miles_sensed_mode in the generic_metrics_sensed.ipynb.

Used the following command to identify the last commits consisting of these keywords:

ashrest2-35384s:em-public-dashboard ashrest2$ git log --oneline --all -S'average_miles_mode_confirm2' -- '*.ipynb'
85a4cce Use database value for mode
28449df Fixes from the production code
ashrest2-35384s:em-public-dashboard ashrest2$ git log --oneline --all -S'average_miles_sensed_mode' -- '*.ipynb'
ashrest2-35384s:em-public-dashboard ashrest2$ git log --oneline --all -S'ntrips_sensed_per_day' -- '*.ipynb'
8903b11 ✨ add the `sensed` prefix to the metrics generated from sensed data

Then looked up for these commits to observe the changes.

Note: These observations are not the collateral of the deliverables from #91
since it doesn't have changes related with these.

@iantei
Copy link
Contributor

iantei commented Dec 14, 2023

all of these are on staging, so all the figures will be the same. I am not sure what you get by the "Are all metrics generating the charts?" column. You need to test that differently.

Yes, I will be testing the scenario of generating the charts with running the docker-compose.yml as explained above.

Please read through #103 (comment) carefully Which of the three aspects does your proposed viz_script testing strategy tackle?

I have tested the public dashboard functionality like the default metrics loading, and metrics options list and the metrics options selection loading a chart with the Frontend testing.

With the viz_script, I want to cover the part for the production docker container where all the charts are being generated well for different study/ program with default mapping/dynamic config setting.
I think my viz_scripts testing strategy tests for the 1st aspect of testing against different "study/program configuration" alongside the third aspect of testing with prod container over the dev container.

I didn't understand the idea of testing the publicly available interfaces from the locally run container.
I understand there is two approaches to do the test of charts:

  1. Using the staging URL
  2. Using the local host - I have used this approach to test the charts.

@iantei
Copy link
Contributor

iantei commented Dec 14, 2023

Testing with different variations of dataset in prod container.

Testing with blank database:

> show dbs
Stage_database  0.000GB
admin           0.000GB
config          0.000GB
local           0.000GB
Execution For STUDY_CONFIG = `washingtoncommons` Runs successfully for all notebooks

(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/washingtoncommons.nrel-op.json
Successfully downloaded config with version 1 for Impact of Collaborative Neighborhoods on Vehicle Miles Traveled and data collection URL https://washingtoncommons-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in washingtoncommons
Running at 2023-12-14T09:46:19.623763+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T09:46:19.662950+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:46:31.288555+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:46:39.568740+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:46:46.081978+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:46:54.359181+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]


(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics_sensed.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/washingtoncommons.nrel-op.json
Successfully downloaded config with version 1 for Impact of Collaborative Neighborhoods on Vehicle Miles Traveled and data collection URL https://washingtoncommons-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in washingtoncommons
Running at 2023-12-14T09:57:01.257880+00:00 with args Namespace(plot_notebook='generic_metrics_sensed.ipynb', program='default', date=None) for range (<Arrow [2023-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T09:57:01.306818+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T09:57:06.687847+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T09:57:11.653076+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T09:57:16.954941+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T09:57:21.919721+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')]
(emission) root@b6cde2031614:/usr/src/app/saved-notebooks#

(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default    
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/washingtoncommons.nrel-op.json
Successfully downloaded config with version 1 for Impact of Collaborative Neighborhoods on Vehicle Miles Traveled and data collection URL https://washingtoncommons-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in washingtoncommons
Running at 2023-12-14T09:59:35.342001+00:00 with args Namespace(plot_notebook='generic_timeseries.ipynb', program='default', date=None) for range (<Arrow [2023-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T09:59:35.381028+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:59:40.806785+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:59:45.773126+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:59:51.007093+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T09:59:56.036005+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={})]

For the below ones:

(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_metrics.ipynb default
(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_timeseries.ipynb default
(emission) root@b6cde2031614:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py energy_calculations.ipynb default

Exception: The plots in this notebook are only relevant to programs

Execution For STUDY_CONFIG = `ebikegj` Runs successfully for all notebooks

(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/ebikegj.nrel-op.json
Successfully downloaded config with version 1 for eBike to Work Ownership Program and data collection URL https://ebikegj-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in ebikegj
Running at 2023-12-14T10:12:26.022948+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-06-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:12:26.068508+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:12:33.705292+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:12:40.392836+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:12:47.622352+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:12:54.258306+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:13:01.401787+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:13:08.069723+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:13:16.452121+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]

(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics_sensed.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/ebikegj.nrel-op.json
Successfully downloaded config with version 1 for eBike to Work Ownership Program and data collection URL https://ebikegj-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in ebikegj
Running at 2023-12-14T10:14:47.079136+00:00 with args Namespace(plot_notebook='generic_metrics_sensed.ipynb', program='default', date=None) for range (<Arrow [2023-06-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:14:47.121681+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:14:52.454201+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:14:58.093866+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:15:03.225133+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:15:08.156487+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:15:13.391677+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:15:18.672387+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]
Running at 2023-12-14T10:15:23.777420+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]

(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/ebikegj.nrel-op.json
Successfully downloaded config with version 1 for eBike to Work Ownership Program and data collection URL https://ebikegj-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in ebikegj
Running at 2023-12-14T10:16:00.599539+00:00 with args Namespace(plot_notebook='generic_timeseries.ipynb', program='default', date=None) for range (<Arrow [2023-06-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:16:00.631624+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:06.050082+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:11.134447+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:16.331228+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:21.597083+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:26.917071+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:32.316824+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:16:37.482577+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]


(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/ebikegj.nrel-op.json
Successfully downloaded config with version 1 for eBike to Work Ownership Program and data collection URL https://ebikegj-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in ebikegj
Running at 2023-12-14T10:17:17.939184+00:00 with args Namespace(plot_notebook='mode_specific_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-06-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:17:17.974844+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:23.812267+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:29.469349+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:35.163171+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:40.875374+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:46.718197+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:52.548819+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:17:58.169568+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]


(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_timeseries.ipynb default 
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/ebikegj.nrel-op.json
Successfully downloaded config with version 1 for eBike to Work Ownership Program and data collection URL https://ebikegj-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in ebikegj
Running at 2023-12-14T10:18:32.393646+00:00 with args Namespace(plot_notebook='mode_specific_timeseries.ipynb', program='default', date=None) for range (<Arrow [2023-06-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:18:32.426776+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:18:38.690444+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:18:44.779113+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:18:50.993761+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:18:57.216065+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:19:03.645201+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:19:10.073427+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:19:16.212971+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={})]

(emission) root@30250175f3cc:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py energy_calculations.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/ebikegj.nrel-op.json
Successfully downloaded config with version 1 for eBike to Work Ownership Program and data collection URL https://ebikegj-openpath.nrel.gov/api/
label_options is unavailable for the dynamic_config in ebikegj
Running at 2023-12-14T10:20:29.640717+00:00 with args Namespace(plot_notebook='energy_calculations.ipynb', program='default', date=None) for range (<Arrow [2023-06-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:20:29.678891+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:33.569610+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:37.127474+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:40.856992+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:44.382361+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:48.081034+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:51.629156+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]
Running at 2023-12-14T10:20:55.565734+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={})]

Execution For STUDY_CONFIG = `dev-emulator-program` Runs successfully for all notebooks

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
Running at 2023-12-14T10:29:28.501570+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics_sensed.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:34:39.727942+00:00 with args Namespace(plot_notebook='generic_metrics_sensed.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:34:39.770637+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('sensed_algo_prefix', str, value='cleaned')]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:36:44.028428+00:00 with args Namespace(plot_notebook='generic_timeseries.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:36:44.061316+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:37:36.280077+00:00 with args Namespace(plot_notebook='mode_specific_metrics.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:37:36.318847+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:38:28.579496+00:00 with args Namespace(plot_notebook='mode_specific_timeseries.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:38:28.611681+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]


(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py energy_calculations.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:39:21.482637+00:00 with args Namespace(plot_notebook='energy_calculations.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:39:21.521732+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

Testing with fc_* dataset:

Changes:

ashrest2-35384s:em-public-dashboard ashrest2$ bash viz_scripts/docker/load_mongodump.sh fc_2022-05-09.tar.gz
2023-12-14T10:46:58.329+0000    2562838 document(s) restored successfully. 0 document(s) failed to restore.

ashrest2-35384s:em-public-dashboard ashrest2$ docker exec -it em-public-dashboard-db-1 mongo
> show dbs
Stage_database  1.109GB
admin           0.000GB
config          0.000GB
local           0.000GB

Execution For STUDY_CONFIG = `dev-emulator-program` Runs successfully for all notebooks EXCEPT `generic_metrics_sensed.ipynb` notebook


(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:54:22.006452+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:54:22.151311+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:56:40.279612+00:00 with args Namespace(plot_notebook='generic_timeseries.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:56:40.313975+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]


(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:57:19.124235+00:00 with args Namespace(plot_notebook='mode_specific_metrics.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:57:19.162044+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py mode_specific_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:59:16.527869+00:00 with args Namespace(plot_notebook='mode_specific_timeseries.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:59:16.560846+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

(emission) root@cef28cd6ee37:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py energy_calculations.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/dev-emulator-program.nrel-op.json
Successfully downloaded config with version 1 for Development environment (program) and data collection URL default
Dynamic labels download was successful for nrel-openpath-deploy-configs: dev-emulator-program
Running at 2023-12-14T10:59:52.482703+00:00 with args Namespace(plot_notebook='energy_calculations.ipynb', program='default', date=None) for range (<Arrow [2020-09-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-14T10:59:52.524263+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='program'), Parameter('mode_of_interest', str, value='e-bike'), Parameter('include_test_users', bool, value=False), Parameter('is_debug_mode', bool, value=False), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'value': 'bikeshare', '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'REPLACED_MODE': [{'value': 'no_travel'}, {'value': 'walk'}, {'value': 'bike'}, {'value': 'bikeshare'}, {'value': 'scootershare'}, {'value': 'drove_alone'}, {'value': 'shared_ride'}, {'value': 'e_car_drove_alone'}, {'value': 'e_car_shared_ride'}, {'value': 'taxi'}, {'value': 'bus'}, {'value': 'train'}, {'value': 'free_shuttle'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-bike': 'E-bike', 'bike': 'Regular Bike', 'bikeshare': 'Bikeshare', 'scootershare': 'Scooter share', 'drove_alone': 'Gas Car Drove Alone', 'shared_ride': 'Gas Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'moped': 'Moped', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Air', 'not_a_trip': 'Not a trip', 'no_travel': 'No travel', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'es': {'walk': 'Caminando', 'e-bike': 'e-bicicleta', 'bike': 'Bicicleta', 'bikeshare': 'Bicicleta compartida', 'scootershare': 'Motoneta compartida', 'drove_alone': 'Coche de Gas, Condujo solo', 'shared_ride': 'Coche de Gas, Condujo con otros', 'e_car_drove_alone': 'e-coche, Condujo solo', 'e_car_shared_ride': 'e-coche, Condujo con ontras', 'moped': 'Ciclomotor', 'taxi': 'Taxi/Uber/Lyft', 'bus': 'Autobús', 'train': 'Tren', 'free_shuttle': 'Colectivo gratuito', 'air': 'Avión', 'not_a_trip': 'No es un viaje', 'no_travel': 'No viajar', 'home': 'Inicio', 'work': 'Trabajo', 'at_work': 'En el trabajo', 'school': 'Escuela', 'transit_transfer': 'Transbordo', 'shopping': 'Compras', 'meal': 'Comida', 'pick_drop_person': 'Recoger/ Entregar Individuo', 'pick_drop_item': 'Recoger/ Entregar Objeto', 'personal_med': 'Personal/ Médico', 'access_recreation': 'Acceder a Recreación', 'exercise': 'Recreación/ Ejercicio', 'entertainment': 'Entretenimiento/ Social', 'religious': 'Religioso', 'other': 'Otros'}}})]

@iantei
Copy link
Contributor

iantei commented Dec 21, 2023

@shankari Issue observed while testing with the dataset for usaid-laos-ev:

Procedure followed:

  1. Cloned a new repo from main branch.
  2. Updated the docker-compose.yml 's STUDY_CONFIG=usaid-laos-ev
  3. Deleted the existing dataset from the MongoDB
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
  1. Re-loaded the dataset associated with usaid-laos-ev for 20th Dec 2023.
> show dbs
Stage_database               4.409GB
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.761GB
  1. Executed the following:
  1. Executed for generic_metrics and generic_timeseries
  2. Couldn't launch for mode_specific_metrics, mode_specific_timeseries and energy_calculations with the following error:
----- stderr -----
Exception: The plots in this notebook are only relevant to programs
------------------

(emission) root@d66e8c456113:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@d66e8c456113:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev
Running at 2023-12-21T01:43:03.426453+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-05-01T00:00:00+00:00]>, <Arrow [2023-12-01T00:00:00+00:00]>)
Running at 2023-12-21T01:43:03.474642+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]
Running at 2023-12-21T01:49:13.191138+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]


(emission) root@d66e8c456113:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev

Running at 2023-12-21T01:51:01.265912+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

  1. Comparison between Results:
http://localhost:3274/?study_config=usaid-laos-ev https://usaid-laos-ev-openpath.nrel.gov/public/
image image
Total Confirmed Trips: 7856 , Participants: 19954, Testers: 29 Total Confirmed Trips: 599 , Participants: 5253, Testers: 20

There seems to be a difference in data between these charts, and thereby all other charts are also different.

Am I doing something wrong in the above process?

@shankari
Copy link
Contributor Author

shankari commented Dec 21, 2023

Couldn't launch for mode_specific_metrics, mode_specific_timeseries and energy_calculations with the following error:
Exception: The plots in this notebook are only relevant to programs

As you can see from the exception, this will happen for all studies. Did you not see this in WashingtonCommons?

Total Confirmed Trips: 7856 , Participants: 19954, Testers: 29

This is not what the graph is showing. The one on the left does not have ~ 20k participants.

Re-loaded the dataset associated with usaid-laos-ev for 20th Dec 2023.

Looks like it has both stage data and laos data loaded. Are you sure you are reading the correct one?

> show dbs
Stage_database               4.409GB
openpath_prod_usaid_laos_ev  0.761GB

@iantei
Copy link
Contributor

iantei commented Dec 21, 2023

Couldn't launch for mode_specific_metrics, mode_specific_timeseries and energy_calculations with the following error:
Exception: The plots in this notebook are only relevant to programs

As you can see from the exception, this will happen for all studies. Did you not see this in WashingtonCommons?

Yes, this is well expected with all studies. I did observe this with other studies too. I just wanted to make a note for it here.

Total Confirmed Trips: 7856 , Participants: 19954, Testers: 29

This is not what the graph is showing. The one on the left does not have ~ 20k participants.

Left Chart: The chart represents total confirmed trips: 2782 + 2052 + 1500 + 1065 + 457 = 7856 (Total Confirmed Trips)
Right Chart: The chart represents total confirmed trips: 348 + 111 + 70 + 47 = 576 + Car Shared Ride (23) =~ 599.
The share for Car Shared Ride is less ~ 3.84% therefore it is not displayed on the chart.
The ~20K is the Total Trips (referred from text above the chart).

Re-loaded the dataset associated with usaid-laos-ev for 20th Dec 2023.

Looks like it has both stage data and laos data loaded. Are you sure you are reading the correct one?

> show dbs
Stage_database               4.409GB
openpath_prod_usaid_laos_ev  0.761GB

Yes, I removed the existing dataset, and loaded the dataset which you've shared with me.
Dropping the Stage_database leads to error in generation of charts "Unable to generate plot Number of trips for each mode (selected by users) Reason:".

I am placing the openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz file inside em-public-dashboard folder, and executing the following command to load the dataset.

bash viz_scripts/docker/load_mongodump.sh openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz

@shankari
Copy link
Contributor Author

Total Confirmed Trips: 7856 , Participants: 19954, Testers: 29
This is not what the graph is showing. The one on the left does not have ~ 20k participants.

was referring to "Participants: 19954". I am not sure what the rest of your comment refers to, but I am glad that you see that
"The ~20K is the Total Trips (referred from text above the chart)."

I am placing the openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz file inside em-public-dashboard folder, and executing the following command to load the dataset.

You do not need to place the file in the em-public-dashboard folder. You can specify the fully qualified name instead.

Dropping the Stage_database leads to error in generation of charts "Unable to generate plot Number of trips for each mode (selected by users) Reason:".

What is the reason? You should not have the Stage_database loaded at the same time. I bet the issue is that you are not specifying the alternate DB name openpath_prod_usaid_laos_ev in the DB environment variable. We had discussed this when you first started - @achasmita had this issue and we discussed a resolution back in August.

If you are using a database that is not called Stage_database you need to set the DB environment variable to the appropriate mongo:// URL. Note that you may need to change the start script to use _ instead of -

@iantei
Copy link
Contributor

iantei commented Jan 3, 2024

Similar to @achasmita 's changes -
I incorporated the following changes on docker-compose.yml and start_notebook.sh

Changes in docker-compose.yml


ashrest2-35384s:em-public-dashboard ashrest2$ git diff docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index 73a9875..dc8331c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -18,10 +18,10 @@ services:
     depends_on:
       - db
     environment:
-      - DB_HOST=db
+      - DB_HOST="mongodb://db/openpath_prod_usaid_laos_ev"
       - WEB_SERVER_HOST=0.0.0.0
       - CRON_MODE=TRUE
-      - STUDY_CONFIG=stage-program
+      - STUDY_CONFIG=usaid-laos-ev
     ports:
       # ipynb in numbers
       

Changes in start_notebook.sh

   ashrest2-35384s:docker ashrest2$ git diff start_notebook.sh 
diff --git a/viz_scripts/docker/start_notebook.sh b/viz_scripts/docker/start_notebook.sh
index c02cf29..f40a1ce 100755
--- a/viz_scripts/docker/start_notebook.sh
+++ b/viz_scripts/docker/start_notebook.sh
@@ -7,7 +7,7 @@ if [ -z ${DB_HOST} ] ; then
     local_host=`hostname -i`
     sed "s_localhost_${local_host}_" conf/storage/db.conf.sample > conf/storage/db.conf
 else
-    sed "s_localhost_${DB_HOST}_" conf/storage/db.conf.sample > conf/storage/db.conf
+    sed "s-localhost-${DB_HOST}-" conf/storage/db.conf.sample > conf/storage/db.conf
 fi
 
 ### configure the saved-notebooks directory for persistent notebooks
> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.758GB

This yields in json loading error.

Detailed Error log:

JSONDecodeError                           Traceback (most recent call last)
Cell In[2], line 7
      4 import pandas as pd
      6 from plots import *
----> 7 import scaffolding
      9 sns.set_style("whitegrid")
     10 sns.set()

File /usr/src/app/saved-notebooks/scaffolding.py:16
     10 # Module for pretty-printing outputs (e.g. head) to help users
     11 # understand what is going on
     12 # However, this means that this module can only be used in an ipython notebook
     14 import IPython.display as disp
---> 16 import emission.core.get_database as edb
     18 def no_traceback_handler(exception_type, exception, traceback):
     19     print("%s: %s" % (exception_type.__name__, exception), file=sys.stderr)

File /usr/src/app/emission/core/get_database.py:19
     16     print("storage not configured, falling back to sample, default configuration")
     17     config_file = open('conf/storage/db.conf.sample')
---> 19 config_data = json.load(config_file)
     20 url = config_data["timeseries"]["url"]
     21 result_limit = config_data["timeseries"]["result_limit"]

File ~/miniconda-23.1.0/envs/emission/lib/python3.9/json/__init__.py:293, in load(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    274 def load(fp, *, cls=None, object_hook=None, parse_float=None,
    275         parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
    276     """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
    277     a JSON document) to a Python object.
    278 
   (...)
    291     kwarg; otherwise ``JSONDecoder`` is used.
    292     """
--> 293     return loads(fp.read(),
    294         cls=cls, object_hook=object_hook,
    295         parse_float=parse_float, parse_int=parse_int,
    296         parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)

File ~/miniconda-23.1.0/envs/emission/lib/python3.9/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    341     s = s.decode(detect_encoding(s), 'surrogatepass')
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:
    348     cls = JSONDecoder

File ~/miniconda-23.1.0/envs/emission/lib/python3.9/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
    332 def decode(self, s, _w=WHITESPACE.match):
    333     """Return the Python representation of ``s`` (a ``str`` instance
    334     containing a JSON document).
    335 
    336     """
--> 337     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338     end = _w(s, end).end()
    339     if end != len(s):

File ~/miniconda-23.1.0/envs/emission/lib/python3.9/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
    353     obj, end = self.scan_once(s, idx)
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

The dataset is available as seen with the show dbs command, but there's still some issue with it.

@iantei
Copy link
Contributor

iantei commented Jan 6, 2024

There were a few changes which were required in the above approach:
I have to execute docker-compose -f docker-compose.yml build before up command.

NOTE: I will rearrange the snapshots accordingly if needed.

Code changes:

For docker-compose.yml:

ashrest2-35384s:em-public-dashboard ashrest2$ git diff docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index 73a9875..8b3a3ba 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -19,9 +19,10 @@ services:
       - db
     environment:
       - DB_HOST=db
+      - DB_HOST=mongodb://db/openpath_prod_usaid_laos_ev
       - WEB_SERVER_HOST=0.0.0.0
       - CRON_MODE=TRUE
-      - STUDY_CONFIG=stage-program
+      - STUDY_CONFIG=usaid-laos-ev
     ports:
       # ipynb in numbers
       - "47962:8888"

For start_notebook.sh:

-    sed "s_localhost_${DB_HOST}_" conf/storage/db.conf.sample > conf/storage/db.conf
+    sed "s-localhost-${DB_HOST}-" conf/storage/db.conf.sample > conf/storage/db.conf

Database changes:

> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.757GB

Execution Process:

docker-compose -f docker-compose.yml build

docker-compose -f docker-compose.yml up

Make sure the changes in start_notebook.sh is being reflected inside the docker container.

Execute Jupyter notebooks:

1. Generic Metrics: Executed properly

ashrest2-35384s:em-public-dashboard ashrest2$ docker exec -it em-public-dashboard-notebook-server-1 /bin/bash root@fe3d5eb64501:/usr/src/app# source setup/activate.sh (emission) root@fe3d5eb64501:/usr/src/app# cd saved-notebooks (emission) root@fe3d5eb64501:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb (emission) root@fe3d5eb64501:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default /usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="? if r.status_code is not 200: About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/ Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev Running at 2024-01-05T23:10:55.325373+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (, ) Running at 2024-01-05T23:10:55.367695+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

2. Generic Metrics Sensed: Executed properly

(emission) root@fe3d5eb64501:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics_sensed.ipynb default /usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="? if r.status_code is not 200: About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/ Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev Running at 2024-01-05T23:12:47.282348+00:00 with args Namespace(plot_notebook='generic_metrics_sensed.ipynb', program='default', date=None) for range (, ) Running at 2024-01-05T23:12:47.323788+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:12:53.781223+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=5), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:12:59.575014+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=6), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:04.877180+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=7), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:09.940155+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=8), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:15.856148+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=9), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:21.157176+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=10), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:26.737892+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=11), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:31.919421+00:00 with params [Parameter('year', int, value=2023), Parameter('month', int, value=12), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')] Running at 2024-01-05T23:13:37.726137+00:00 with params [Parameter('year', int, value=2024), Parameter('month', int, value=1), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('sensed_algo_prefix', str, value='cleaned')]

3. Generic Timeseries: Executed Properly

(emission) root@fe3d5eb64501:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_timeseries.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev
Running at 2024-01-05T23:14:23.334011+00:00 with args Namespace(plot_notebook='generic_timeseries.ipynb', program='default', date=None) for range (<Arrow [2023-05-01T00:00:00+00:00]>, <Arrow [2024-01-01T00:00:00+00:00]>)
Running at 2024-01-05T23:14:23.372966+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

Results:
Dataset used: openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz
Comparison between charts in https://usaid-laos-ev-openpath.nrel.gov/public/ vs http://localhost:3274/?study_config=usaid-laos-ev

Production Production container
image image
image image

These comparison would not be a valid one, since there would be new data every other day. So, comparing between 20th Dec 2023 dataset with 5th Jan 2024 dataset would not yield a rightful comparison.

@iantei
Copy link
Contributor

iantei commented Jan 6, 2024

Comparing between charts generated for both 20th Dec 2023 dataset.

(https://usaid-laos-ev-openpath.nrel.gov/public/) (http://localhost:3274/?study_config=usaid-laos-ev)
Screenshot 2023-12-21 at 9 30 23 AM image

Update:
The number of confirmed trips and total trips is increased on the one captured in the production site. Upon further detail analysis, All the individual data within the each of the charts has increased values or has remained same. I think the data might have been updated from the point when the data for dataset was collected.

Comparing individual chart:
For Metric : Number of trips All data Default

(https://usaid-laos-ev-openpath.nrel.gov/public/) (http://localhost:3274/?study_config=usaid-laos-ev)
Screenshot 2023-12-20 at 7 12 49 PM image

There seems to be some discrepancy with these two chart.

Possible cause:
Each time I load the dataset by deleting the existing database, I get different size of database for the same dataset.
Loading the dataset using the following command:

bash viz_scripts/docker/load_mongodump.sh openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz

Result: Different database size for same dataset-

> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.756GB
> use openpath_prod_usaid_laos_ev
switched to db openpath_prod_usaid_laos_ev
> db.dropDatabase()
{ "dropped" : "openpath_prod_usaid_laos_ev", "ok" : 1 }
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.757GB
> use openpath_prod_usaid_laos_ev
switched to db openpath_prod_usaid_laos_ev
> db.dropDatabase()
{ "dropped" : "openpath_prod_usaid_laos_ev", "ok" : 1 }
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.755GB
> use openpath_prod_usaid_laos_ev
switched to db openpath_prod_usaid_laos_ev
> db.dropDatabase()
{ "dropped" : "openpath_prod_usaid_laos_ev", "ok" : 1 }
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.757GB
> use openpath_prod_usaid_laos_ev
switched to db openpath_prod_usaid_laos_ev
> db.dropDatabase()
{ "dropped" : "openpath_prod_usaid_laos_ev", "ok" : 1 }
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> show dbs
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.758GB

Update: In last both cases, where the db size were 0.758GB and 0.757GB - the 4441126 document(s) restored successfully. 0 document(s) failed to restore.
The number of documents restored has been same.

@iantei
Copy link
Contributor

iantei commented Jan 8, 2024

Inside the openpath_prod_usaid_laos_ev database, there are the following collections:

show dbs
Stage_database 0.000GB
admin 0.000GB
config 0.000GB
local 0.000GB
openpath_prod_usaid_laos_ev 0.767GB
use openpath_prod_usaid_laos_ev
switched to db openpath_prod_usaid_laos_ev
show collections
Stage_Profiles
Stage_analysis_timeseries
Stage_pipeline_state
Stage_push_token_mapping
Stage_timeseries
Stage_timeseries_error
Stage_updateable_models
Stage_usercache
Stage_uuids

Deleted all data which has timestamp greater than 2023-12-20T03:27:00

db.Stage_analysis_timeseries.find({ "data.fmt_time": { $gte: "2023-12-20T03:27:00" } }).count()
0
db.Stage_analysis_timeseries.find({ "metadata.write_fmt_time": { $gte: "2023-12-20T03:27:00" } }).count()
0
db.Stage_timeseries.find({ "metadata.write_fmt_time": { $gte: "2023-12-20T03:27:00" } }).count()
0

Reloaded the Generic Metrics notebook charts.

Details

(emission) root@d839eeb20ee0:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@d839eeb20ee0:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev
Running at 2024-01-08T18:22:07.613942+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-05-01T00:00:00+00:00]>, <Arrow [2024-01-01T00:00:00+00:00]>)
Running at 2024-01-08T18:22:07.658095+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

Cleared cache from the Firefox browser.
Reloaded the charts.

Result
I do not see any difference in the charts. There is still disparity in the confirmed trips and total trips.

@iantei
Copy link
Contributor

iantei commented Jan 11, 2024

@shankari
The results are identical in both snapshot of https://usaid-laos-ev-openpath.nrel.gov/public/ on 20th December 2023 and for the charts generated using production docker compose with the dataset openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz.

Here we are loading the dataset, and validating the changes are reflecting as the snapshot on the production website.

Steps involved:

Loading the dataset openpath-prod-usaid-laos-ev-snapshot-dec-20.tar.gz for the docker-compose.yml and testing it against the snapshot of https://usaid-laos-ev-openpath.nrel.gov/public/ on 20th December 2023.

After loading the open path_prod_usaid_laos_ev dataset into the database.

> show dbs
Stage_database               0.000GB
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.757GB

Executed the following command for Generic Metrics notebook:

ashrest2-35384s:em-public-dashboard ashrest2$ docker exec -it em-public-dashboard-notebook-server-1 /bin/bash
root@e74c321b6e79:/usr/src/app# source setup/activate.sh
(emission) root@e74c321b6e79:/usr/src/app# cd saved-notebooks
(emission) root@e74c321b6e79:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@e74c321b6e79:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev
Running at 2024-01-11T00:07:51.138520+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-05-01T00:00:00+00:00]>, <Arrow [2024-01-01T00:00:00+00:00]>)
Running at 2024-01-11T00:07:51.180319+00:00 with params [Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

Introduced a new function in scaffolding.py

def remove_confirmed_trip_labels(): 
    TS_LIMIT = 1703042805
    
    #first, remove all trips written after a cutoff time
    print("counting records for removal")
    print(edb.get_timeseries_db().count_documents({ "metadata.write_ts": { "$gt": TS_LIMIT } }))
    print(edb.get_analysis_timeseries_db().count_documents({ "metadata.write_ts": { "$gt": TS_LIMIT } }))
    
    #then, find manual inputs added after the cutoff time
    print("counting manual records after cutoff")
    print(edb.get_timeseries_db().count_documents({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}}))
    
    for t in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})):
        confirmed_trip = edb.get_analysis_timeseries_db().find_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]}) #gets confirmed trip with matching user id & timestamp
        if confirmed_trip is None:
            print("No matching confirmed trip for %s" % t["data"]["start_fmt_time"])
            continue
 
        if confirmed_trip["data"]["user_input"] == {}:
            print("Found confirmed trip with matching inferred trip, without user labels")
        else:
            print("Getting here")
            update_results = edb.get_analysis_timeseries_db().update_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]}, { "$set": { 'data.user_input': {} } })
            print("Update results")
            print(update_results)
    print("delete after timestamp")
    edb.get_timeseries_db().delete_many({ "metadata.write_ts": { "$gt": TS_LIMIT } })
    edb.get_analysis_timeseries_db().delete_many({ "metadata.write_ts": { "$gt": TS_LIMIT } })

This is called in Generic Metrics notebook, before call to scaffolding.load_viz_notebook_data() as:
scaffolding.remove_confirmed_trip_labels()

Mongo DB after the removal of the entries later than 20th Dec 2023 3:28:45 GMT and removing the extra confirmed trips.

> show dbs
Stage_database               0.000GB
admin                        0.000GB
config                       0.000GB
local                        0.000GB
openpath_prod_usaid_laos_ev  0.771GB

Results:

Overall comparison:

Production snapshot Docker-compose prod snapshot
image image_

Individual comparison:

Production snapshot Docker-compose prod snapshot
NumberofTrip_Prod NumberofTrip_Docker
TripMilesbyMode_Prod TripMilesbyMode_Docker
TripCountPurpose_Prod TripCountPurpose_Docker
image Timeseries_Docker

Thank you @Abby-Wheelis for the suggestions and support in completing this.

@shankari
Copy link
Contributor Author

shankari commented Jan 11, 2024

For the record, the code used here is not what I suggested

        confirmed_trip = edb.get_analysis_timeseries_db().find_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]}) #gets confirmed trip with matching user id & timestamp

This is not the matching algorithm. This will not work for labels on draft trips, for example.
I had asked you to run the matching algorithm from the server code - e.g. something like

matching_confirmed_trip = ea...find_matching_confirmed_trip(me)

@iantei can you please report the results after fixing the code? I anticipate they will be similar, but the goal is is to check the calculation so we want to make the data massaging as accurate as possible.

@Abby-Wheelis
Copy link
Member

@shankari is there a specific matching algorithm in the server code that you're thinking of? From ea.. that would indicate that we should focus on emission/analysis, but I'm not sure I've been able to find what you're referring to.

Ok, wait, digging in a little deeper today I've found something that looks promising:
get_confirmed_obj_for_user_input_obj(ts, ui_obj): in trip_queries.py takes a timestamp and a user input object, and looks like it selects the "analysis/confirmed_trip" object that matches.
There is an example of how this function has been used in match_incoming_inputs of matcher.py which seems more focused on an individual user than we need to be, but could be a good example of context.

Maybe that's a good place to start, I had skimmed over it yesterday because it looked like it dealt with place user inputs, but I think it's more general than I first thought.

@iantei
Copy link
Contributor

iantei commented Jan 12, 2024

Inside emission/storage/decorations/trip_queries.py there is a function, get_confirmed_obj_for_user_input_obj(ts, ui_obj): which makes use of potential_candidates = ts.find_entries(["analysis/confirmed_trip"], tq).
This get_confirmed_obj_for_user_input_obj is being used from match_incoming_inputs which is available in emission/analysis/userinput/matcher.py.

Since we are not looking for specific user_id, I tried to use the code available inside get_confirmed_obj_for_user_input_obj.
Use potential_candidates = ts.find_entries(["analysis/confirmed_trip"], tq), to list out the confirmed trips directly.

So, in the function get_confirmed_obj_for_user_input_obj, there is call to final_candidate(valid_timeline_entry(ts, ui_obj), potential_candidates). I am not sure if this is required in our case or not.
[final_candidate() does filter out and return a single item, so I might have to incorporate that too. ]

Even with the potential_candidates, we have a list. So, I am not sure which item from the list to choose from.

    for t in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})):
        ts = esta.TimeSeries.get_aggregate_time_series()

        ONE_DAY = 24 * 60 * 60
        if 'data' in t and 'start_ts' in t['data']:
            start_ts_value = t['data']['start_ts']
        else:
            pass

        tq = estt.TimeQuery("data.start_ts", start_ts_value - ONE_DAY,
            start_ts_value + ONE_DAY)

        # iff the input's key is one of these, the input belongs on a place
        # all other keys are only used for trip inputs
        place_keys = ["manual/place_user_input", "manual/place_addition_input"]
        # print("Hello")

        confirmed_trip_list = list(ts.find_entries(["analysis/confirmed_trip"], tq))

        if confirmed_trip_list is None:
            print("No matching confirmed trip for %s" % t["data"]["start_fmt_time"])
            continue
        
        confirmed_trip = confirmed_trip_list[0]

        if confirmed_trip and 'data' in confirmed_trip and 'user_input' in confirmed_trip['data'] and not confirmed_trip['data']['user_input']:
            # print("Confirmed trip has an empty user_input")
            pass
        else:
            print("Confirmed trip either doesn't exist or has non-empty user_input")

            update_results = edb.get_analysis_timeseries_db().update_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]}, { "$set": { 'data.user_input': {} } })
            confirmed_trip["data"]["user_input"] = {}

@shankari Could you please let know if I looking into the right direction?

@iantei
Copy link
Contributor

iantei commented Jan 12, 2024

Got the working code: Updated filtering code to identify the right confirmed trip item.
RESULT: The charts are identical with this approach too.

def remove_confirmed_trip_labels(): 
    TS_LIMIT = 1703042805
    print("Inside test_function")

    
    #first, remove all trips written after a cutoff time

    for t in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})):
        # Below code is referenced from function get_confirmed_obj_for_user_input_obj(ts, ui_obj): in 
        # emission/storage/decorations/trip_queries.py
        ts = esta.TimeSeries.get_aggregate_time_series()

        ONE_DAY = 24 * 60 * 60
        if 'data' in t and 'start_ts' in t['data']:
            start_ts_value = t['data']['start_ts']
        else:
            pass

        tq = estt.TimeQuery("data.start_ts", start_ts_value - ONE_DAY,
            start_ts_value + ONE_DAY)

        # iff the input's key is one of these, the input belongs on a place
        # all other keys are only used for trip inputs
        place_keys = ["manual/place_user_input", "manual/place_addition_input"]

        if t['metadata']['key'] in place_keys:
            # if place, we'll query the same time range, but with 'enter_ts'
            tq.timeType = "data.enter_ts"
            confirmed_trip_list = list(ts.find_entries(["analysis/confirmed_place"], tq))
            # print("Hi")
        else:
            confirmed_trip_list = list(ts.find_entries(["analysis/confirmed_trip"], tq))

        if confirmed_trip_list is None:
            print("No matching confirmed trip for %s" % t["data"]["start_fmt_time"])
            continue

        # Assuming t is your current iteration from the loop
        current_user_id = t["user_id"]
        current_start_ts = t["data"]["start_ts"]

        # Filter the confirmed_list based on the specified conditions
        matching_items = [item for item in confirmed_trip_list if
                        item.get("user_id") == current_user_id
                        and item.get("metadata", {}).get("key") == "analysis/confirmed_trip"
                        and item.get("data", {}).get("start_ts") == current_start_ts]

        # Check if any matching items were found
        if matching_items:
            # Access the first matching item
            confirmed_trip = matching_items[0]
            print("Matching item found:")
            if confirmed_trip["data"]["user_input"] == {}:
                print("Found confirmed trip with matching inferred trip, without user labels")
            else:
                print("Getting here")
                print(confirmed_trip['data']['user_input'])
                update_results = edb.get_analysis_timeseries_db().update_one({"user_id": t["user_id"],
                    "metadata.key": "analysis/confirmed_trip",
                    "data.start_ts": t["data"]["start_ts"]}, { "$set": { 'data.user_input': {} } })
                print("Update results")
                print(update_results)
                confirmed_trip["data"]["user_input"] = {} 
        else:
            print("No matching item found for the specified conditions.")
    
    print("delete after timestamp")
    edb.get_timeseries_db().delete_many({ "metadata.write_ts": { "$gt": TS_LIMIT } })
    edb.get_analysis_timeseries_db().delete_many({ "metadata.write_ts": { "$gt": TS_LIMIT } })

Steps of execution:

1. Dropped the existing database `openpath_prod_usaid_laos_ev`
2. Re-loaded the database from the original snapshot
3. Executed the following commands:
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up
4. Executed the Generic Metric notebook loading script

Executed the following script for Generic Metrics:

ashrest2-35384s:em-public-dashboard ashrest2$ docker exec -it em-public-dashboard-notebook-server-1 /bin/bash
root@a053cc45b642:/usr/src/app# source setup/activate.sh
(emission) root@a053cc45b642:/usr/src/app# cd saved-notebooks
(emission) root@a053cc45b642:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/update_mappings.py mapping_dictionaries.ipynb
(emission) root@a053cc45b642:/usr/src/app/saved-notebooks# PYTHONPATH=.. python bin/generate_plots.py generic_metrics.ipynb default
/usr/src/app/saved-notebooks/bin/generate_plots.py:30: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if r.status_code is not 200:
About to download config from https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/usaid-laos-ev.nrel-op.json
Successfully downloaded config with version 1 for USAID-NREL Support for Electric Vehicle Readiness and data collection URL https://USAID-laos-EV-openpath.nrel.gov/api/
Dynamic labels download was successful for nrel-openpath-deploy-configs: usaid-laos-ev
Running at 2024-01-12T15:30:32.264590+00:00 with args Namespace(plot_notebook='generic_metrics.ipynb', program='default', date=None) for range (<Arrow [2023-05-01T00:00:00+00:00]>, <Arrow [2024-01-01T00:00:00+00:00]>)
Running at 2024-01-12T15:30:32.308029+00:00 with params [Parameter('year', int), Parameter('month', int), Parameter('program', str, value='default'), Parameter('study_type', str, value='study'), Parameter('include_test_users', bool, value=True), Parameter('dynamic_labels', dict, value={'MODE': [{'value': 'walk', 'baseMode': 'WALKING', 'met_equivalent': 'WALKING', 'kgCo2PerKm': 0}, {'value': 'e-auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.085416859}, {'value': 'auto_rickshaw', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.231943784}, {'value': 'motorcycle', 'baseMode': 'MOPED', 'met_equivalent': 'IN_VEHICLE', 'kgCo2PerKm': 0.113143309}, {'value': 'e-bike', 'baseMode': 'E_BIKE', 'met': {'ALL': {'range': [0, -1], 'mets': 4.9}}, 'kgCo2PerKm': 0.00728}, {'value': 'bike', 'baseMode': 'BICYCLING', 'met_equivalent': 'BICYCLING', 'kgCo2PerKm': 0}, {'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': '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}], 'PURPOSE': [{'value': 'home'}, {'value': 'work'}, {'value': 'at_work'}, {'value': 'school'}, {'value': 'transit_transfer'}, {'value': 'shopping'}, {'value': 'meal'}, {'value': 'pick_drop_person'}, {'value': 'pick_drop_item'}, {'value': 'personal_med'}, {'value': 'access_recreation'}, {'value': 'exercise'}, {'value': 'entertainment'}, {'value': 'religious'}, {'value': 'other'}], 'translations': {'en': {'walk': 'Walk', 'e-auto_rickshaw': 'E-tuk tuk', 'auto_rickshaw': 'Tuk Tuk', 'motorcycle': 'Motorcycle', 'e-bike': 'E-bike', 'bike': 'Bicycle', 'drove_alone': 'Car Drove Alone', 'shared_ride': 'Car Shared Ride', 'e_car_drove_alone': 'E-Car Drove Alone', 'e_car_shared_ride': 'E-Car Shared Ride', 'taxi': 'Taxi/Loca/inDrive', 'bus': 'Bus', 'train': 'Train', 'free_shuttle': 'Free Shuttle', 'air': 'Airplane', 'not_a_trip': 'Not a trip', 'home': 'Home', 'work': 'To Work', 'at_work': 'At Work', 'school': 'School', 'transit_transfer': 'Transit transfer', 'shopping': 'Shopping', 'meal': 'Meal', 'pick_drop_person': 'Pick-up/ Drop off Person', 'pick_drop_item': 'Pick-up/ Drop off Item', 'personal_med': 'Personal/ Medical', 'access_recreation': 'Access Recreation', 'exercise': 'Recreation/ Exercise', 'entertainment': 'Entertainment/ Social', 'religious': 'Religious', 'other': 'Other'}, 'lo': {'walk': 'ດ້ວຍການຍ່າງ', 'e-auto_rickshaw': 'ລົດ 3 ລໍ້ໄຟຟ້າ ຫລື ຕຸກຕຸກໄຟຟ້າ', 'auto_rickshaw': 'ເດີນທາດ້ວຍ ລົດຕຸກຕຸກ ຫລື ລົດສາມລໍ້', 'motorcycle': 'ລົດຈັກ', 'e-bike': 'ວຍລົດຈັກໄຟຟ້າ', 'bike': 'ລົດຖີບ', 'drove_alone': 'ເດີນທາງ ດ້ວຍລົດໃຫ່ຍ ເຊີ່ງເປັນລົດທີ່ຂັບເອງ', 'shared_ride': 'ເດີນທາງດ້ວຍລົດໃຫ່ຍ ຮ່ວມກັບລົດຄົນອຶ່ນ', 'e_car_drove_alone': 'ດ້ວຍການຂັບລົດໄຟຟ້າໄປເອງ', 'e_car_shared_ride': 'ດ້ວຍການຈ້າງລົດໄຟຟ້າໄປ', 'taxi': 'ແທັກຊີ', 'bus': 'ລົດເມ', 'train': 'ລົດໄຟ', 'free_shuttle': 'ລົດຮັບສົ່ງຟຣີ', 'air': 'ຍົນ', 'not_a_trip': 'ບໍ່ແມ່ນການເດີນທາງ', 'home': 'ບ້ານ', 'work': 'ໄປເຮັດວຽກ', 'at_work': 'ຢູ່ບ່ອນເຮັດວຽກ', 'school': 'ໄປໂຮງຮຽນ', 'transit_transfer': 'ການຖ່າຍໂອນການເດີນທາງ', 'shopping': 'ຊອບປິ້ງ', 'meal': 'ອາຫານ', 'pick_drop_person': 'ໄປຮັບ ຫລື ສົນ ຄົນ', 'pick_drop_item': 'ໄປຮັບ ຫລື ສົ່ງສິນຄ້າ', 'personal_med': 'ໄປຫາໝໍ', 'access_recreation': 'ເຂົ້າເຖິງການພັກຜ່ອນ', 'exercise': 'ພັກຜ່ອນ/ອອກກຳລັງກາຍ', 'entertainment': 'ບັນເທີງ/ສັງຄົມ', 'religious': 'ຈຸດປະສົງທາງສາດສະໜາ', 'other': 'ອື່ນໆ'}}})]

Result:
Cleared the cache, and accessed: http://localhost:3274/?study_config=usaid-laos-ev
Validated the charts are identical.

Production Snapshot Dec 20th Docker compose prod
Screenshot 2023-12-21 at 9 29 30 AM Collective
NumberofTrip_Prod Individual
TripMilesbyMode_Prod Trip_milesByMode_New
TripCountPurpose_Prod TripCountByPurpose_New
Timeseries_Prod Timeseries_New

@shankari
Copy link
Contributor Author

shankari commented Jan 13, 2024

@iantei

Got the working code: Updated filtering code to identify the right confirmed trip item.

This is not using the correct code to identify the right confirmed trip item. I don't see you using match_incoming_inputs.
Instead, you continue to filter based on the start_ts

        # Filter the confirmed_list based on the specified conditions
        matching_items = [item for item in confirmed_trip_list if
                        item.get("user_id") == current_user_id
                        and item.get("metadata", {}).get("key") == "analysis/confirmed_trip"
                        and item.get("data", {}).get("start_ts") == current_start_ts]

I am not sure where you found that "the specified conditions" include matching by start_ts

Also, is there a reason why you are copy-pasting code instead of just calling the server function?

@iantei
Copy link
Contributor

iantei commented Jan 14, 2024

@shankari

UPDATE: FIXED - I encountered a challenge while trying to call the server function in the following way:

import emission.analysis.userinput.matcher as eum
...

def remove_confirmed_trip_labels(): 
    TS_LIMIT = 1703042805
    print("Inside test_function")
    for t in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})):
        current_user_id = t["user_id"]
        time_query = epq.get_time_range_for_incoming_userinput_match(current_user_id)
        confirmed_trip = eum.match_incoming_inputs(current_user_id, time_query)

        if confirmed_trip["data"]["user_input"] == {}:
            print("Found confirmed trip with matching inferred trip, without user labels")
        else:
            print("Getting here")
            print(confirmed_trip['data']['user_input'])
            update_results = edb.get_analysis_timeseries_db().update_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]}, { "$set": { 'data.user_input': {} } })
            print("Update results")
            print(update_results)
            confirmed_trip["data"]["user_input"] = {}
    
    print("delete after timestamp")
    edb.get_timeseries_db().delete_many({ "metadata.write_ts": { "$gt": TS_LIMIT } })
    edb.get_analysis_timeseries_db().delete_many({ "metadata.write_ts": { "$gt": TS_LIMIT } })

This resulted into the following error:

File /usr/src/app/emission/analysis/config.py:8, in get_config_data()
      6 except:
      7     print("analysis.debug.conf.json not configured, falling back to sample, default configuration")
----> 8     config_file = open('conf/analysis/debug.conf.json.sample')
      9 ret_val = json.load(config_file)
     10 config_file.close()

FileNotFoundError: [Errno 2] No such file or directory: 'conf/analysis/debug.conf.json.sample'

Upon investigating a little more, I found the following. Currently, we have the following:

(emission) root@92cf7066cfd9:/usr/src/app/saved-notebooks# ls conf/
storage
(emission) root@92cf7066cfd9:/usr/src/app/saved-notebooks# 

We still have the following:

root@92cf7066cfd9:/usr/src/app# ls conf/storage/
db.conf  db.conf.docker.sample  db.conf.sample
root@92cf7066cfd9:/usr/src/app# ls conf/analysis/
debug.conf.json.sample  trip_model.conf.json.sample
root@92cf7066cfd9:/usr/src/app#

We don’t have conf/analysis/ inside the emission environment, unlike conf/storage/
Therefore, when I try to call import emission.analysis.userinput.matcher as eum from scaffolding.py, this results into an error.

I will try to see if I can fix this.

@iantei
Copy link
Contributor

iantei commented Jan 14, 2024

Adding the below code in the start_notebook.sh and executing docker-compose -f docker-compose.yml build then up.

mkdir -p saved-notebooks/conf/analysis
cp conf/analysis/debug.conf.json.sample saved-notebooks/conf/analysis/debug.conf.json.sample
cat saved-notebooks/conf/analysis/debug.conf.json.sample

Re-execution of the Generic metrics. There are some issues with the function remove_confirmed_trip_labels(), investigating to fix it.

Update: Added case to handle when confirmed_trip is None.

Getting assertion error for:

epq.get_time_range_for_incoming_userinput_match(current_user_id)

340 assert curr_state.curr_run_ts is None, "curr_state.curr_run_ts = %s" % curr_state.curr_run_ts

AssertionError: curr_state.curr_run_ts = 1705224557.5451016

I don't have much insights about pipeline_queries.py.

@iantei
Copy link
Contributor

iantei commented Jan 14, 2024

@iantei

Got the working code: Updated filtering code to identify the right confirmed trip item.

This is not using the correct code to identify the right confirmed trip item. I don't see you using match_incoming_inputs. Instead, you continue to filter based on the start_ts

        # Filter the confirmed_list based on the specified conditions
        matching_items = [item for item in confirmed_trip_list if
                        item.get("user_id") == current_user_id
                        and item.get("metadata", {}).get("key") == "analysis/confirmed_trip"
                        and item.get("data", {}).get("start_ts") == current_start_ts]

I am not sure where you found that "the specified conditions" include matching by start_ts

I took inference for this above condition from here, where there is computation of confirmed_trip.
https://github.com/e-mission/e-mission-server/blob/master/bin/debug/label_stats.py

for t in list(edb.get_analysis_timeseries_db().find({"metadata.key": "analysis/inferred_trip", "user_id": sel_uuid})):
    if t["data"]["inferred_labels"] != []:
        confirmed_trip = edb.get_analysis_timeseries_db().find_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]})
        if confirmed_trip is None:
            print("No matching confirmed trip for %s" % t["data"]["start_fmt_time"])
            continue

        if confirmed_trip["data"]["user_input"] == {}:
            print("Found confirmed trip with matching inferred trip, without user labels")

@iantei
Copy link
Contributor

iantei commented Jan 14, 2024

Getting assertion error for:

epq.get_time_range_for_incoming_userinput_match(current_user_id)

340 assert curr_state.curr_run_ts is None, "curr_state.curr_run_ts = %s" % curr_state.curr_run_ts

AssertionError: curr_state.curr_run_ts = 1705224557.5451016

Debugging update: Getting this error when the current_user_id is same in following call to the epq.get_time_range_for_incoming_userinput_match().

def identify_unique_uuids():
    TS_LIMIT = 1703042805
    unique_uuids = set(item["user_id"] for item in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})))
    for unique_uuid in unique_uuids:
        print("The uuid is: " + str(unique_uuid))
        time_query = epq.get_time_range_for_incoming_userinput_match(unique_uuid)
        print ("Time Query is: " + str(time_query))

Re-execution of the above block leads to same ASSERTION error again.

Clear the database, load the dataset and re-execute.

@iantei
Copy link
Contributor

iantei commented Jan 14, 2024

Since, epq.get_time_range_for_incoming_userinput_match() throws ASSERTION error when we try to call it with same UUID again (user_id). I created a map such that we have key value pairing of the UUIDs and corresponding time range.

def identify_unique_uuids():
    TS_LIMIT = 1703042805
    unique_uuids = set(item["user_id"] for item in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})))
    
    uuid_time_map = {}

    for unique_uuid in unique_uuids:
        # print("The uuid is: " + str(unique_uuid))
        time_query = epq.get_time_range_for_incoming_userinput_match(unique_uuid)
        # print ("Time Query is: " + str(time_query))

        uuid_time_map[unique_uuid] = time_query

    return uuid_time_map

Now, we will make a call to epq.get_time_range_for_incoming_userinput_match(unique_uuid) just once for an unique uuid.

def remove_confirmed_trip_labels(): 
    TS_LIMIT = 1703042805
    print("Inside test_function")
    # Create a set of current_user_id s
    # Map of this unique current_user_id with the timerange

    resulting_uuid_time_map = identify_unique_uuids()

    for uuid, time_query in resulting_uuid_time_map.items():
        print(f"UUID: {uuid}, Time Query: {time_query}")

    # Other alternative is that some values needs to be reset.
    # I really don't see that happening in the server code which is calling get_time_range_for_incoming_userinput_match - so I am gonna ignore that for now
    for t in list(edb.get_timeseries_db().find({"metadata.write_ts": {"$gt": TS_LIMIT}, "metadata.key": {"$regex": '^manual/(mode_confirm|purpose_confirm|replaced_mode)$'}})):
        # print("Values associated with t")
        # print(t)
        # print("\n")
        current_user_id = t["user_id"]
        print ("The current user id is: " + str(current_user_id))

        time_query = resulting_uuid_time_map[current_user_id]
        print ("Time Query is: " + str(time_query))
        confirmed_trip = eum.match_incoming_inputs(current_user_id, time_query)

        # time_query = epq.get_time_range_for_incoming_userinput_match(current_user_id)
        # print ("Time Query is: " + str(time_query))
        # confirmed_trip = eum.match_incoming_inputs(current_user_id, time_query)

        print("The value of confirmed trip")
        print(confirmed_trip)

        if confirmed_trip is None:
            # Code to be executed if confirmed_trip is None
            print("No confirmed trip found.")
        else:
            # Code to be executed if confirmed_trip is not None
            print("Confirmed trip found.")
            print("Inside here")
            if confirmed_trip["data"]["user_input"] == {}:
                print("Found confirmed trip with matching inferred trip, without user labels")
            else:
                print("Getting here")
                print(confirmed_trip['data']['user_input'])
                update_results = edb.get_analysis_timeseries_db().update_one({"user_id": t["user_id"],
                    "metadata.key": "analysis/confirmed_trip",
                    "data.start_ts": t["data"]["start_ts"]}, { "$set": { 'data.user_input': {} } })
                print("Update results")
                print(update_results)
                confirmed_trip["data"]["user_input"] = {}

Calling scaffolding.remove_confirmed_trip_labels().

This results in getting all the confirmed_trip values as None, which likely happens inside the match_incoming_inputs(user_id, timerange) in matcher.py

    if len(toMatchInputs) == 0:
        logging.debug("len(toMatchInputs) == 0, early return")
        return None

I am unsure whether using the unique corresponding timerange for a unique UUID is a good idea, but the other way around
epq.get_time_range_for_incoming_userinput_match(unique_uuid) is throwing error for the second encounter of the same UUID. I am a bit cornered about what to do next.
Both of these approaches doesn't seem to work properly.

@iantei
Copy link
Contributor

iantei commented Jan 14, 2024

Summary of the approach attempted:

The function inside matcher.py - match_incoming_inputs(user_id, timerange) takes two arguments - user_id, timerange
I have extracted user_id from the list of items in edb.get_timeseries_db() filtered with with timestamp and manual/mode*.
To get the timerange, I used the following:
time_query = epq.get_time_range_for_incoming_userinput_match(user_id) which is used in match_incoming_user_inputs() function in matcher.py itself.
Since, second call to the match_incoming_inputs(user_id, timerange) with same user_id was resulting in ASSERTION error. I created a map for two unique user_id to its corresponding time range.
This way, I expected to get the confirmed_trip, but it just returned None.

Since the calculation of timerange only depends on the user_id, the approach of using mapping for user_id to timerange should be fine as well?

@shankari
Copy link
Contributor Author

I took inference for this above condition from here, where there is computation of confirmed_trip.
https://github.com/e-mission/e-mission-server/blob/master/bin/debug/label_stats.py

That finds the confirmed trip for an inferred trip, not for a user input. It is not enough to check the output, you also need to check the input.

Why are you trying to call get_time_range_for_incoming_userinput_match?
Here's the pseudocode that I suggested

for me in to_be_deleted_manual_entries:
    matching_confirmed_trip = ea...find_matching_confirmed_trip(me)
    del matching_confirmed_trip['data']['user_input']

Where does that have time_range_for_incoming_userinput?
I am taking over now

shankari added a commit to shankari/em-public-dashboard that referenced this issue Jan 14, 2024
This is very simple pseudocode.
- delete all entries written after a particular timestamp
- reset all labels that were entered after the timestamp by finding the
  corresponding confirmed trip and removing the `user_input`

```
to_be_deleted_manual_entries = # entries whose metadata.write_ts > timestamp
for me in to_be_deleted_manual_entries:
    matching_confirmed_trip = ea...find_matching_confirmed_trip(me)
    del matching_confirmed_trip['data']['user_input']

edb.get_analysis_timeseries_db.delete_many({"metadata.write_ts" > timestamp )
```

This is essentially the same code as
e-mission#103 (comment)
but with the matching code changed from

```
        confirmed_trip = edb.get_analysis_timeseries_db().find_one({"user_id": t["user_id"],
                "metadata.key": "analysis/confirmed_trip",
                "data.start_ts": t["data"]["start_ts"]}) #gets confirmed trip with matching user id & timestamp
```

to

```
        confirmed_trip = esdt.get_confirmed_obj_for_user_input_obj(ts, ecwe.Entry(t))
```

to support the richer matching algorithm.

And lots of improvements to the logging

Testing done:

```
After parsing, the reset timestamp is 2023-12-20T03:27:00+00:00 -> 1703042820.0
Planning to delete 40502 records from the timeseries
Planning to delete 6477 records from the analysis timeseries
6477
number of manual records after cutoff 143
For input 2023-12-20T15:49:36.486127+07:00 of type manual/purpose_confirm, labeled at 2023-12-20T19:04:06.452000+07:00, found confirmed trip starting at 2023-12-20T14:22:50.209000+07:00 with no user input
For input 2023-12-19T06:28:58.685000+07:00 of type manual/purpose_confirm, labeled at 2023-12-20T19:05:11.080000+07:00, found confirmed trip starting at 2023-12-19T06:28:58.685000+07:00 with user input {'purpose_confirm': 'ໄປວຽກ', 'mode_confirm': 'motorcycle'}
Resetting input of type purpose_confirm
Update results = {'n': 1, 'nModified': 1, 'ok': 1.0, 'updatedExisting': True}
For input 2023-12-19T05:33:56.424000+07:00 of type manual/purpose_confirm, labeled at 2023-12-20T19:05:18.335000+07:00, found confirmed trip starting at 2023-12-19T05:33:56.424000+07:00 with user input {'purpose_confirm': 'ໄປວຽກ', 'mode_confirm': 'motorcycle'}
Resetting input of type purpose_confirm
Update results = {'n': 1, 'nModified': 1, 'ok': 1.0, 'updatedExisting': True}
For input 2023-12-18T20:12:15.920000+07:00 of type manual/purpose_confirm, labeled at 2023-12-20T19:05:28.385000+07:00, found confirmed trip starting at 2023-12-18T20:12:15.920000+07:00 with user input {'purpose_confirm': 'ໄປວຽກ', 'mode_confirm': 'motorcycle'}
Resetting input of type purpose_confirm
Update results = {'n': 1, 'nModified': 1, 'ok': 1.0, 'updatedExisting': True}
For input 2023-12-18T20:12:15.920000+07:00 of type manual/mode_confirm, labeled at 2023-12-20T19:06:27.949000+07:00, found confirmed trip starting at 2023-12-18T20:12:15.920000+07:00 with user input {'mode_confirm': 'motorcycle'}
Resetting input of type mode_confirm
Update results = {'n': 1, 'nModified': 1, 'ok': 1.0, 'updatedExisting': True}
...
For input 2023-12-20T19:31:21.577000+07:00 of type manual/purpose_confirm, labeled at 2023-12-20T20:14:33.454000+07:00, found confirmed trip starting at 2023-12-20T19:05:27.266615+07:00 with no user input
For input 2023-12-20T20:02:07.148000+07:00 of type manual/mode_confirm, labeled at 2023-12-20T20:15:57.305000+07:00, found confirmed trip starting at 2023-12-20T19:05:27.266615+07:00 with no user input
For input 2023-12-20T20:02:07.148000+07:00 of type manual/purpose_confirm, labeled at 2023-12-20T20:16:02.741000+07:00, found confirmed trip starting at 2023-12-20T19:05:27.266615+07:00 with no user input
delete all entries after timestamp 1703042820.0
deleting all timeseries entries after 1703042820.0, {'n': 40502, 'ok': 1.0}
deleting all analysis timeseries entries after 1703042820.0, {'n': 6477, 'ok': 1.0}
```
@shankari
Copy link
Contributor Author

shankari commented Jan 15, 2024

After reverting to a previous snapshot by using the script in #112, which uses the standard matching algorithm, and incorporates multiple assertions to validate the reset, I still get the same values #112 (comment)

next steps:

@shankari
Copy link
Contributor Author

Changes have been pushed to production, closing this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants