Datasets:

Modalities:
Text
Formats:
parquet
Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
pandas
License:
murphp15 commited on
Commit
4954eb2
1 Parent(s): d9cc0c4

Automatic commit by vdk-huggingface

Browse files
https:/github.com/versatile-data-kit-demo/dsc ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"content": "# Temporary and binary files\n*~\n*.py[cod]\n*.so\n*.cfg\n!.isort.cfg\n!setup.cfg\n*.orig\n*.log\n*.pot\n__pycache__/*\n.cache/*\n.*.swp\n*/.ipynb_checkpoints/*\n.DS_Store\n.eggs\nbuild\ndist\nsrc/*.egg-info\n\n# Project files\n.ropeproject\n.project\n.pydevproject\n.settings\n.idea\ntags\nvenv\n*.iml\n\n# Package files\n*.egg\n*.eggs/\n.installed.cfg\n*.egg-info\nChart.lock\n\n# Unittest and coverage\nhtmlcov/*\n.coverage\n.tox\njunit.xml\ncoverage.xml\n.pytest_cache/\n\n# Build and docs folder/files\nbuild/*\ndist/*\nsdist/*\ndocs/api/*\ndocs/_rst/*\ndocs/_build/*\ncover/*\nMANIFEST\ntests.xml\n\n# Per-project virtualenvs\n.venv*/\n.python-version\n\n# Ignore Gradle project-specific cache directory\n.gradle\ntemp\ngradlew\ngradlew.bat\n"}, {"content": " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n"}, {"content": "# Table of Contents\n- [Purpose](#purpose)\n- [Background](#background)\n * [Linear Regression](#linear-regression)\n * [Electric Car Battery Example](#electric-car-battery-example)\n + [Data Source](#data-source)\n + [Explanation](#explanation)\n + [Sources Referred To](#sources-referred-to)\n * [VDK](#vdk)\n * [Create the Data Job Files](#create-the-data-job-files)\n * [Data Job Code](#data-job-code)\n * [Deploy Data Job](#deploy-data-job)\n- [Exercises](#exercises)\n- [Lessons Learned](#lessons-learned)\n\n<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>\n\n## Purpose\n\nThe purpose of this scenario is to show how to:\n* Create a data job with VDK\n* Write Python scripts within a data job\n* Read from local files (CSV/Excel)\n* Perform exploratory data analysis\n* Process data\n* Build and test a linear regression model\n* Create an interactive visualization through Streamlit\n\nIf you feel comfortable with the concept of Linear Regression, please feel free to skip down to the\nExercises section, where you will find links to the MyBinder environments.\n\n\n## Background\n### Linear Regression\n\n\n<details>\n<summary><i>Short explanation about Linear regression</i></summary>\n---\n\nLinear regression is often referred to as the building block of statistical learning methods. In a nutshell,\nit is an attempt to model a relationship between two or more variables by fitting a linear equation\nto the data at hand. For example, suppose you plot people's salaries on the y-axis and their years of\neducation on the x-axis in a simple scatter plot. In this sense, you are trying to estimate a dependent\nvariable (salary) by using a predictor (years of education) by drawing a line of best fit through the data.\nA line of best fit is a line that minimizes the sum of the distances from itself to each point in the data. The resulting\nline's slope, is the coefficient of the predictor (i.e., what kind of effect one unit change of years of education\nhas on the predicted salary). For example, let's say that the line of best fit follows the equation below:\n```\ny = 30000 + 5000x1, where y = salary, x1 = years of education, and 30000 is a constant y intercept\n```\nThis means that for one more year of education, a person's salary is estimated to increase by 5000, all else held constant.\nThus, for someone with 12 years of education, their predicted salary is:\n```\ny = 30000 + 5000*(12)\ny = 90000\n```\nThis is a rather simplistic example. In reality, we know there are many factors that influence a person's salary.\nThis is where multivariate linear regression comes into play. For example, suppose you now have information not only on\nthe person's salary and years of education, but their parents' last combined income, the years of work experience,\netc. You can estimate a model where each factor's effect is being considered, though visualizing the line of best fit\nwill get more difficult as you keep adding dimensions! Not to worry, the math still works! Here's an example of a\nmultivariate linear regression:\n```\nsalary = 20000 + 4000*years_of_education + 1.1*last_combined_parents_income + 1000*years_of_experience\n```\nThus, a person with 12 years of education, 100000 as their parents' last combined income and 5 years of experience\nis estimated to earn:\n```\ny = 20000 + 4000*12 + 1.1*100000 + 1000*5\ny = 183000\n```\nLinear regression contains a lot of aspects to it that need to be considered. Topics such as:\n* How to estimate the coefficients\n* The tradeoff between bias and variance\n* Measuring the quality of fit and model accuracy\n* Omitted variable bias\n* Non-linear transformations of the predictors\n* Interaction and dummy/binary variables\n\nare only just a handful of topics that need to be considered.\n\n---\n</details>\n\n\nFor a much better and a lot more detailed explanation of linear regression (and statistical methods, in general) there are plenty of resources on the internet. For example: https://www.statlearning.com/.\n\n### Electric Car Battery Example\n#### Data Source\nhttps://www.kaggle.com/gktuzgl/id-3-pro-max-ev-consumption-data\n\n#### Explanation\n\n<details>\n<summary><i>Short explanation about the main use case and goals</i></summary>\n\nUsing the data provided by G\u00f6ktu\u011f \u00d6zg\u00fcl on Kaggle.com, we will build a simple linear regression\nmodel that predicts battery drainage: how much will your electric car's battery drain if you drive it\nin certain ways. For example, how much should you expect your battery to be drained if you drive 50 km at\n50 km per hour, using heated seats?\n\nWe will cover:\n* How to read in the data and deal with special characters\n* How to explore the data, both for numerical variables and categorical variables\n* How to process the data and very light feature engineering (i.e., creating new variables from existing ones)\n* One of the many possible ways to perform feature selection\n* How to build high quality data ot be used as input for your model\n* How to follow Dimensional design process to do the above.\n* How to build a simple linear regression model\n* How to extract the results and predictions from the model\n* How to build a simple Streamlit dashboard showcasing your model's predictive ability\n\n**Sources Referred To**\n* https://www.kaggle.com/gktuzgl/id-3-pro-max-ev-consumption-data\n* https://www.statlearning.com/\n* https://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.html#sphx-glr-auto-examples-linear-model-plot-ols-py\n* https://towardsdatascience.com/feature-selection-with-pandas-e3690ad8504b\n* https://www.youtube.com/watch?v=Klqn--Mu2pE\n* https://medium.com/codex/step-by-step-guide-to-simple-and-multiple-linear-regression-in-python-867ac9a30298\n\n\n---\n</details>\n\n### Versatile Data Kit (VDK)\nThe Versatile Data Kit framework allows you to implement automated pull ingestion and batch data processing.\n\n<details>\n<summary><i>Short explanation about Versatile Data Kit</i></summary>\n\n**Create the Data Job Files**\n\nData Job directory can contain any files, however there are some files that are treated in a specific way:\n\n* SQL files (.sql) - called SQL steps - are directly executed as queries against your configured database;\n* Python files (.py) - called Python steps - are Python scripts that define run function that takes as argument the job_input object;\n* config.ini is needed in order to configure the Job. This is the only file required to deploy a Data Job;\n* requirements.txt is an optional file needed when your Python steps use external python libraries.\n\nDelete all files you do not need and replace them with your own.\n\n**Data Job Code**\n\nVDK supports having many Python and/or SQL steps in a single Data Job. Steps are executed in ascending alphabetical order based on file names.\nPrefixing file names with numbers makes it easy to have meaningful file names while maintaining the steps' execution order.\n\nRun the Data Job from a Terminal:\n* Make sure you have vdk installed. See Platform documentation on how to install it.\n```\nvdk run <path to Data Job directory>\n```\n\n**Deploy Data Job**\n\nWhen a Job is ready to be deployed in a Versatile Data Kit runtime (cloud):\nRun the command below and follow its instructions (you can see its options with `vdk --help`)\n```python\nvdk deploy\n```\n\n---\n</details>\n\n\n## Exercises\nPlease open up MyBinder to get started on the exercises!\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/versatile-data-kit-demo/dsc/HEAD?urlpath=lab/tree/exercise.ipynb)\n\nIf you have any issue with above link try\n - [this one](https://ovh.mybinder.org/v2/gh/versatile-data-kit-demo/dsc/HEAD?urlpath=lab/tree/exercise.ipynb)\n - [or this](https://gesis.mybinder.org/v2/gh/versatile-data-kit-demo/dsc/HEAD?urlpath=lab/tree/exercise.ipynb)\n\n\nFor more information on MyBinder, please visit:\n\nhttps://mybinder.readthedocs.io\n\n## Lessons Learned\nThrough this scenario, you created a data job, which:\n* Read in a local CSV file and stripped it off its special characters\n* Process the data using dimensional modelling\n* Built and tested a linear regression model\n* Built an interactive Streamlit dashboard, which showcased your model's predictive ability\n* Create, develop and deploy jobs using Versatile Data Kit (VDK)\n\n**Congrats!**\n\n**[> Go back to main page of the Workshop.](https://github.com/vmware/versatile-data-kit/tree/main/events/dsc#feedback)**\n\n"}, {"content": "trip,date,location,tyres,temperature_start_c,temperature_end_c,distance_km,duration_minutes,average_speed_kmh,average_consumption_kwhkm,charge_level_start,charge_level_end,ac_c,heated_front_seats_level,mode\n1,2021-02-08,Istanbul,Bridgestone 215/45 R20 LM32,14.0,17.5,31,35,53,14.3,81.0,73.0,OFF,0,ECO\n2,2021-02-08,Istanbul,Bridgestone 215/45 R20 LM32,19.5,19.0,32,52,37,14.0,73.0,65.0,OFF,0,ECO\n3,2021-02-10,Istanbul,Bridgestone 215/45 R20 LM32,15.0,12.5,31,37,51,17.2,81.0,72.0,22,0,COMFORT\n4,2021-02-11,Istanbul,Bridgestone 215/45 R20 LM32,16.0,14.5,31,31,61,14.5,81.0,72.0,OFF,0,COMFORT\n5,2021-02-11,Istanbul,Bridgestone 215/45 R20 LM32,18.0,18.0,28,99,18,15.1,72.0,,OFF,0,ECO\n6,2021-02-12,Istanbul,Bridgestone 215/45 R20 LM32,15.5,3.5,31,37,50,19.6,81.0,71.0,22,0,ECO\n7,2021-02-12,Istanbul,Bridgestone 215/45 R20 LM32,3.0,5.5,31,38,50,18.7,70.0,59.0,22,1,ECO\n8,2021-02-15,Istanbul,Bridgestone 215/45 R20 LM32,11.5,1.5,31,34,54,20.9,80.0,68.0,22,1,ECO\n9,2021-02-15,Istanbul,Bridgestone 215/45 R20 LM32,2.0,4.0,31,30,64,24.4,68.0,54.0,22,0,ECO\n10,2021-02-16,Istanbul,Bridgestone 215/45 R20 LM32,10.5,1.0,31,34,54,18.5,81.0,71.0,22,0,ECO\n11,2021-02-16,Istanbul,Bridgestone 215/45 R20 LM32,1.5,1.5,30,42,43,25.0,71.0,57.0,22,0,ECO\n12,2021-02-16,Istanbul,Bridgestone 215/45 R20 LM32,1.5,3.0,1,6,18,15.8,57.0,56.0,22,0,ECO\n13,2021-02-19,Istanbul,Bridgestone 215/45 R20 LM32,9.5,4.5,31,34,54,17.3,78.0,68.0,22,0,ECO\n14,2021-02-19,Istanbul,Bridgestone 215/45 R20 LM32,5.0,6.5,31,31,62,17.9,68.0,57.0,OFF,2,ECO\n15,2021-02-23,Istanbul,Bridgestone 215/45 R20 LM32,8.5,5.5,31,34,54,17.0,81.0,72.0,22,0,ECO\n16,2021-02-23,Istanbul,Bridgestone 215/45 R20 LM32,14.0,13.0,32,70,28,13.9,72.0,64.0,OFF,0,ECO\n17,2021-02-24,Istanbul,Bridgestone 215/45 R20 LM32,9.5,8.0,31,35,53,17.4,76.0,66.0,22,0,ECO\n18,2021-02-24,Istanbul,Bridgestone 215/45 R20 LM32,9.0,10.0,40,90,27,18.4,64.0,,22,0,ECO\n19,2021-02-25,Istanbul,Bridgestone 215/45 R20 LM32,11.0,7.5,31,37,51,17.6,81.0,72.0,22,0,ECO\n20,2021-02-25,Istanbul,Bridgestone 215/45 R20 LM32,12.0,11.0,31,52,37,14.9,72.0,63.0,OFF,0,ECO\n21,2021-02-26,Istanbul,Bridgestone 215/45 R20 LM32,9.0,6.5,31,33,56,18.1,81.0,71.0,22,0,ECO\n22,2021-02-26,Istanbul,Bridgestone 215/45 R20 LM32,14.5,15.5,31,34,56,13.2,71.0,63.0,OFF,0,ECO\n23,2021-03-01,Istanbul,Bridgestone 215/45 R20 LM32,9.0,5.5,31,43,44,19.1,61.0,50.0,22,1,ECO\n24,2021-03-01,Istanbul,Bridgestone 215/45 R20 LM32,9.0,9.5,31,41,46,15.1,50.0,40.0,OFF,0,ECO\n25,2021-03-02,Istanbul,Bridgestone 215/45 R20 LM32,10.5,5.5,31,38,49,15.1,81.0,73.0,OFF,1,ECO\n26,2021-03-02,Istanbul,Bridgestone 215/45 R20 LM32,6.0,7.0,36,164,14,30.3,73.0,52.0,22,1,ECO\n27,2021-03-03,Istanbul,Bridgestone 215/45 R20 LM32,8.5,4.5,31,36,51,17.0,81.0,72.0,22,2,ECO\n28,2021-03-03,Istanbul,Bridgestone 215/45 R20 LM32,9.0,9.5,38,94,25,19.0,72.0,58.0,22,0,ECO\n29,2021-03-04,Istanbul,Bridgestone 215/45 R20 LM32,8.5,5.0,31,34,55,14.1,81.0,74.0,OFF,0,ECO\n30,2021-03-04,Istanbul,Bridgestone 215/45 R20 LM32,11.5,11.0,33,80,25,15.1,74.0,65.0,OFF,0,ECO\n31,2021-03-05,Istanbul,Bridgestone 215/45 R20 LM32,10.5,,31,35,54,17.6,81.0,71.0,22,0,ECO\n32,2021-03-05,Istanbul,Bridgestone 215/45 R20 LM32,16.0,16.5,32,34,56,13.4,71.0,63.0,22,0,ECO\n33,2021-03-08,Istanbul,Bridgestone 215/45 R20 LM32,10.5,4.0,31,45,43,17.2,81.0,72.0,22,0,ECO\n34,2021-03-08,Istanbul,Bridgestone 215/45 R20 LM32,,9.0,26,45,36,17.0,70.0,61.0,OFF,0,ECO\n35,2021-03-08,Istanbul,Bridgestone 215/45 R20 LM32,9.0,9.0,12,37,21,17.2,61.0,56.0,22,2,ECO\n36,2021-03-09,Istanbul,Bridgestone 215/45 R20 LM32,10.0,7.5,31,38,50,16.9,55.0,45.0,22,0,ECO\n37,2021-03-09,Istanbul,Bridgestone 215/45 R20 LM32,11.0,11.0,29,59,30,15.2,39.0,31.0,OFF,0,ECO\n38,2021-03-10,Istanbul,Bridgestone 215/45 R20 LM32,11.0,8.5,31,37,51,14.4,81.0,73.0,OFF,0,ECO\n39,2021-03-10,Istanbul,Bridgestone 215/45 R20 LM32,12.0,,21,42,30,18.7,73.0,66.0,OFF,0,ECO\n40,2021-03-10,Istanbul,Bridgestone 215/45 R20 LM32,15.0,10.0,19,49,23,16.7,66.0,60.0,OFF,0,ECO\n41,2021-03-11,Istanbul,Bridgestone 215/45 R20 LM32,12.0,7.0,31,43,43,15.9,81.0,72.0,OFF,1,ECO\n42,2021-03-12,Istanbul,Bridgestone 215/45 R20 LM32,11.0,5.5,31,32,58,16.9,81.0,72.0,22,0,ECO\n43,2021-03-15,Istanbul,Bridgestone 215/45 R20 LM32,12.5,13.0,31,37,50,13.6,81.0,74.0,OFF,0,ECO\n44,2021-03-15,Istanbul,Bridgestone 215/45 R20 LM32,18.5,18.0,31,49,39,14.6,74.0,66.0,OFF,0,ECO\n45,2021-03-16,Istanbul,Bridgestone 215/45 R20 LM32,12.5,12.0,31,36,51,14.3,81.0,73.0,OFF,0,ECO\n46,2021-03-16,Istanbul,Bridgestone 215/45 R20 LM32,11.0,12.5,32,56,35,14.5,73.0,66.0,OFF,0,ECO\n47,2021-03-17,Istanbul,Bridgestone 215/45 R20 LM32,11.5,12.5,31,38,49,18.5,81.0,71.0,22,0,ECO\n48,2021-03-17,Istanbul,Bridgestone 215/45 R20 LM32,,9.0,31,41,46,18.7,,60.0,22,0,ECO\n49,2021-03-18,Istanbul,Bridgestone 215/45 R20 LM32,11.5,7.5,31,36,52,14.6,81.0,73.0,OFF,0,ECO\n50,2021-03-18,Istanbul,Bridgestone 215/45 R20 LM32,10.0,10.5,31,52,37,14.3,73.0,65.0,OFF,0,ECO\n51,2021-03-22,Istanbul,Bridgestone 215/45 R20 LM32,11.5,9.0,31,37,51,13.6,81.0,73.0,OFF,0,ECO\n52,2021-03-22,Istanbul,Bridgestone 215/45 R20 LM32,7.0,9.0,32,62,31,21.7,73.0,60.0,22,1,ECO\n53,2021-03-23,Istanbul,Bridgestone 215/45 R20 LM32,12.0,6.5,31,37,51,17.3,81.0,72.0,22,0,ECO\n54,2021-03-23,Istanbul,Bridgestone 215/45 R20 LM32,5.5,8.0,32,46,42,21.7,72.0,59.0,22,1,ECO\n55,2021-03-24,Istanbul,Bridgestone 215/45 R20 LM32,12.0,3.0,31,33,56,19.6,81.0,70.0,22,0,ECO\n56,2021-03-24,Istanbul,Bridgestone 215/45 R20 LM32,5.0,7.0,31,36,53,20.4,70.0,58.0,22,0,ECO\n57,2021-03-25,Istanbul,Bridgestone 215/45 R20 LM32,11.5,3.5,31,31,59,18.0,81.0,72.0,22,0,ECO\n58,2021-03-25,Istanbul,Bridgestone 215/45 R20 LM32,7.5,9.0,26,45,34,19.5,71.0,62.0,22,0,ECO\n59,2021-03-25,Istanbul,Bridgestone 215/45 R20 LM32,11.0,7.0,12,29,25,16.0,62.0,,22,0,ECO\n60,2021-03-26,Istanbul,Bridgestone 215/45 R20 LM32,11.0,6.0,31,31,59,17.2,81.0,72.0,22,0,ECO\n61,2021-03-26,Istanbul,Bridgestone 215/45 R20 LM32,9.0,10.5,28,54,32,18.5,72.0,62.0,22,0,ECO\n62,2021-03-27,Istanbul,Bridgestone 215/45 R20 LM32,11.0,4.5,18,17,64,22.2,62.0,55.0,22,0,COMFORT\n63,2021-03-27,Istanbul,Bridgestone 215/45 R20 LM32,12.5,11.5,17,31,32,16.8,55.0,48.0,OFF,0,COMFORT\n64,2021-03-29,Istanbul,Bridgestone 215/45 R20 LM32,12.0,9.5,31,41,46,14.5,81.0,72.0,OFF,1,COMFORT\n65,2021-03-29,Istanbul,Bridgestone 215/45 R20 LM32,13.0,11.0,21,40,32,16.5,72.0,66.0,OFF,0,ECO\n66,2021-03-29,Istanbul,Bridgestone 215/45 R20 LM32,15.0,10.5,19,43,27,16.8,66.0,59.0,OFF,0,ECO\n67,2021-03-30,Istanbul,Bridgestone 215/45 R20 LM32,12.0,8.5,46,76,37,18.3,81.0,66.0,22,0,ECO\n68,2021-03-30,Istanbul,Bridgestone 215/45 R20 LM32,8.5,9.5,31,39,48,16.0,66.0,56.0,OFF,0,ECO\n69,2021-04-01,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,12.0,7.0,9,17,34,16.8,39.0,36.0,OFF,0,ECO\n70,2021-04-01,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,11.0,11.5,7,15,29,11.4,36.0,34.0,OFF,0,ECO\n71,2021-04-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,11.5,9.5,9,16,36,17.9,81.0,78.0,OFF,0,ECO\n72,2021-04-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,15.5,15.0,6,16,25,9.4,77.0,76.0,OFF,0,ECO\n73,2021-04-05,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,12.5,7.5,31,40,47,14.7,76.0,68.0,OFF,0,ECO\n74,2021-04-05,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,9.0,10.5,28,64,27,14.2,68.0,61.0,OFF,0,ECO\n75,2021-04-06,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,12.5,10.5,31,36,52,13.7,81.0,73.0,OFF,0,ECO\n76,2021-04-06,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.5,19.5,11,19,37,11.0,73.0,71.0,OFF,0,ECO\n77,2021-04-06,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.0,17.5,25,26,58,13.5,71.0,65.0,OFF,0,ECO\n78,2021-04-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.5,16.0,31,31,60,13.4,81.0,74.0,OFF,0,ECO\n79,2021-04-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,21.0,20.5,31,52,37,12.1,74.0,67.0,OFF,0,ECO\n80,2021-04-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.5,5.5,31,36,52,15.8,81.0,72.0,OFF,2,ECO\n81,2021-04-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,6.0,7.5,31,54,36,22.8,72.0,59.0,22,1,ECO\n82,2021-04-11,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,12.5,13.0,2,7,25,13.3,81.0,81.0,OFF,0,ECO\n83,2021-04-11,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,16.5,13.0,3,5,33,15.5,81.0,80.0,OFF,0,ECO\n84,2021-04-12,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,12.5,9.0,17,49,22,13.6,80.0,75.0,OFF,0,ECO\n85,2021-04-12,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,11.0,13.0,17,39,27,15.5,75.0,70.0,OFF,0,ECO\n86,2021-04-13,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.0,7.0,17,30,35,13.5,70.0,66.0,OFF,0,ECO\n87,2021-04-13,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,11.5,18.5,17,37,29,16.1,66.0,60.0,OFF,0,ECO\n88,2021-04-14,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.5,11.0,17,21,49,15.1,61.0,55.0,OFF,1,ECO\n89,2021-04-14,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.0,19.5,18,63,17,16.1,56.0,49.0,OFF,0,ECO\n90,2021-04-15,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.5,9.5,17,19,57,14.5,81.0,77.0,OFF,0,ECO\n91,2021-04-15,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.0,15.0,11,16,43,21.7,77.0,72.0,OFF,0,COMFORT\n92,2021-04-15,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.0,12.0,15,67,14,13.2,72.0,68.0,OFF,0,ECO\n93,2021-04-16,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,17.0,9.5,17,20,53,15.9,69.0,63.0,22,1,ECO\n94,2021-04-16,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.0,13.5,18,58,19,17.1,63.0,57.0,OFF,0,ECO\n95,2021-04-17,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.0,12.0,8,13,39,22.0,58.0,54.0,OFF,0,ECO\n96,2021-04-17,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.0,13.0,8,16,32,12.5,54.0,50.0,OFF,0,ECO\n97,2021-04-19,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.0,10.5,17,29,36,14.2,51.0,46.0,OFF,1,ECO\n98,2021-04-19,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,13.0,14.0,18,150,7,21.4,46.0,39.0,OFF,1,ECO\n99,2021-04-20,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.0,11.5,17,19,55,13.1,81.0,77.0,OFF,1,ECO\n100,2021-04-20,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,16.5,17.0,18,53,21,16.4,77.0,71.0,OFF,1,ECO\n101,2021-04-21,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.5,8.0,17,19,55,13.7,72.0,67.0,OFF,2,ECO\n102,2021-04-21,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.0,18.5,10,35,18,22.5,63.0,67.0,OFF,0,ECO\n103,2021-04-21,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,16.0,16.0,13,26,30,9.3,63.0,60.0,OFF,0,ECO\n104,2021-04-22,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.0,9.0,17,19,56,13.6,60.0,55.0,OFF,1,ECO\n105,2021-04-22,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,15.0,19.5,23,101,14,16.8,56.0,47.0,OFF,0,ECO\n106,2021-04-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.5,10.5,17,23,46,13.5,48.0,43.0,OFF,0,ECO\n107,2021-04-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,14.5,18.0,18,48,23,15.3,44.0,38.0,OFF,0,ECO\n108,2021-04-28,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,15.5,18.5,7,48,9,18.4,38.0,36.0,OFF,1,ECO\n109,2021-04-29,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,15.0,20.0,6,23,17,15.0,81.0,79.0,OFF,0,ECO\n110,2021-05-17,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,17.0,16.5,17,28,37,13.5,80.0,76.0,OFF,0,ECO\n111,2021-05-17,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,24.0,16,42,24,15.4,73.0,68.0,OFF,0,ECO\n112,2021-05-18,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.0,20.0,17,29,36,12.7,68.0,65.0,OFF,1,ECO\n113,2021-05-18,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,16.5,19.0,18,61,18,15.0,64.0,59.0,OFF,0,ECO\n114,2021-05-20,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.0,16.5,17,21,50,12.7,59.0,54.0,OFF,0,ECO\n115,2021-05-21,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,17.5,16.5,18,39,29,15.1,45.0,39.0,OFF,0,ECO\n116,2021-05-24,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.0,16.0,17,41,26,13.0,69.0,65.0,OFF,1,ECO\n117,2021-05-24,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,,26.0,18,50,22,16.3,,60.0,22,0,ECO\n118,2021-05-25,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,17.5,17,25,43,12.3,60.0,55.0,OFF,1,ECO\n119,2021-05-25,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.0,21.5,18,67,17,17.6,55.0,48.0,OFF,0,ECO\n120,2021-05-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,17.0,17,22,49,12.5,48.0,44.0,OFF,0,ECO\n121,2021-05-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,21.5,18,52,21,15.9,45.0,39.0,OFF,0,ECO\n122,2021-05-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,,23.5,8,55,9,15.7,39.0,37.0,OFF,0,ECO\n123,2021-05-27,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,18.0,17,22,48,13.0,81.0,76.0,OFF,1,ECO\n124,2021-05-27,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,20.5,29,64,28,12.6,77.0,70.0,OFF,0,ECO\n125,2021-05-28,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,18.0,17,24,43,12.3,70.0,66.0,OFF,0,ECO\n126,2021-05-28,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,22.5,18,54,21,15.6,66.0,60.0,OFF,0,ECO\n127,2021-05-31,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,18.0,17,28,37,12.2,61.0,56.0,OFF,0,ECO\n128,2021-05-31,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,19.5,18,34,33,13.5,56.0,51.0,OFF,0,ECO\n129,2021-06-01,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,14.5,17,34,31,13.7,51.0,46.0,OFF,2,ECO\n130,2021-06-01,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.0,20.0,18,63,18,15.3,46.0,41.0,OFF,0,ECO\n131,2021-06-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,14.5,17,25,43,12.4,81.0,77.0,OFF,0,ECO\n132,2021-06-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,16.5,28,36,47,15.6,78.0,70.0,OFF,0,ECO\n133,2021-06-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,17.5,18.0,24,42,35,11.9,70.0,64.0,OFF,0,ECO\n134,2021-06-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,17.5,18,39,28,14.9,64.0,59.0,OFF,0,ECO\n135,2021-06-03,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,14.0,17,22,47,14.4,59.0,54.0,OFF,0,ECO\n136,2021-06-03,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,17.5,18.0,18,49,23,14.8,54.0,47.0,OFF,0,ECO\n137,2021-06-04,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,14.5,17,21,51,11.6,48.0,45.0,OFF,0,ECO\n138,2021-06-04,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,21.0,22.0,9,49,11,15.8,40.0,37.0,OFF,0,ECO\n139,2021-06-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,18.5,17,47,23,12.5,81.0,76.0,OFF,0,ECO\n140,2021-06-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,21.0,18,20,54,15.1,76.0,71.0,OFF,0,ECO\n141,2021-06-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,18.5,19.5,17,27,39,12.6,71.0,67.0,OFF,0,ECO\n142,2021-06-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,24.0,23,65,22,14.6,67.0,61.0,OFF,0,ECO\n143,2021-06-09,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,16.5,17,24,44,12.4,61.0,56.0,OFF,0,ECO\n144,2021-06-09,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,17.0,21.0,18,39,28,15.1,55.0,50.0,OFF,0,ECO\n145,2021-06-10,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,18.0,17,23,45,11.0,50.0,46.0,OFF,0,ECO\n146,2021-06-10,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.0,26.5,18,48,23,13.9,46.0,42.0,OFF,0,ECO\n147,2021-06-11,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,19.0,17,24,44,11.6,42.0,37.0,OFF,0,ECO\n148,2021-06-12,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,21.5,23.0,11,14,51,10.4,35.0,32.0,OFF,0,ECO\n149,2021-06-14,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.0,18.0,17,42,25,12.7,81.0,76.0,OFF,0,ECO\n150,2021-06-14,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.0,20.0,18,38,29,13.5,76.0,71.0,OFF,0,ECO\n151,2021-06-15,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,15.0,17,39,28,13.3,72.0,67.0,OFF,0,ECO\n152,2021-06-16,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,16.5,17,28,39,12.7,55.0,49.0,OFF,2,ECO\n153,2021-06-16,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,20.0,18,49,23,15.2,50.0,45.0,OFF,0,ECO\n154,2021-06-17,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,16.0,17,25,42,12.2,45.0,40.0,OFF,0,ECO\n155,2021-06-17,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.0,24.5,18,42,26,13.5,41.0,36.0,OFF,0,ECO\n156,2021-06-18,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,19.0,17,23,46,11.9,37.0,32.0,OFF,0,ECO\n157,2021-06-18,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.5,19.0,18,45,25,15.6,33.0,27.0,OFF,0,ECO\n158,2021-06-21,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,19.5,17,33,32,12.9,80.0,76.0,OFF,0,ECO\n159,2021-06-22,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,19.5,18.0,17,23,46,12.0,72.0,67.0,OFF,0,ECO\n160,2021-07-05,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,22.5,23.5,17,43,25,11.9,81.0,76.0,OFF,0,ECO\n161,2021-07-05,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,29.0,18,46,24,17.3,77.0,71.0,22,0,ECO\n162,2021-07-06,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,22.0,20.5,17,34,31,12.9,71.0,66.0,OFF,0,ECO\n163,2021-07-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,22.0,22.5,17,28,38,11.9,62.0,58.0,OFF,0,ECO\n164,2021-07-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.0,24.5,23,73,20,17.5,58.0,50.0,22,0,ECO\n165,2021-07-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,22.5,23.0,17,25,43,12.6,67.0,62.0,OFF,0,ECO\n166,2021-07-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,26.5,18,37,30,14.5,63.0,57.0,OFF,0,ECO\n167,2021-07-09,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,22.5,24.0,17,25,42,12.3,53.0,48.0,OFF,0,ECO\n168,2021-07-09,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,29.0,18,32,35,16.4,49.0,44.0,22,0,ECO\n169,2021-07-12,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,22.5,23.5,10,17,38,13.5,72.0,69.0,22,0,ECO\n170,2021-07-12,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,24.0,17,45,24,14.7,69.0,64.0,22,0,ECO\n171,2021-07-12,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,25.0,28.5,18,36,31,16.5,65.0,59.0,22,0,ECO\n172,2021-07-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.0,23.5,17,26,40,13.6,81.0,77.0,OFF,0,ECO\n173,2021-07-26,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,26.0,28.0,46,84,33,15.5,77.0,63.0,21,0,ECO\n174,2021-07-27,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,,22.0,17,22,49,11.5,,60.0,OFF,0,ECO\n175,2021-07-27,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,26.0,28.5,21,45,29,17.4,60.0,52.0,21,0,ECO\n176,2021-07-28,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,23.5,17,22,48,11.6,52.0,47.0,OFF,0,ECO\n177,2021-07-28,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,26.0,29.5,18,32,35,16.9,47.0,43.0,22,0,ECO\n178,2021-07-29,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,24.0,17,23,46,11.5,43.0,38.0,OFF,0,ECO\n179,2021-07-29,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,26.0,31.5,18,32,34,15.7,38.0,33.0,22,0,ECO\n180,2021-07-30,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,22.5,17,31,34,12.4,34.0,29.0,OFF,0,ECO\n181,2021-07-30,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,,32.5,18,33,33,17.8,,21.0,21,0,ECO\n182,2021-07-30,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,32.5,35.5,7,19,22,17.4,27.0,26.0,21,0,ECO\n183,2021-08-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,22.5,17,36,30,12.0,81.0,77.0,OFF,0,ECO\n184,2021-08-02,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,26.5,32.0,18,36,31,14.6,77.0,72.0,21,0,ECO\n185,2021-08-03,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,24.0,17,23,46,10.8,67.0,63.0,OFF,0,ECO\n186,2021-08-03,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,27.0,29.5,18,35,32,15.0,63.0,58.0,21,0,ECO\n187,2021-08-04,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,24.5,17,23,47,10.6,58.0,53.0,OFF,0,ECO\n188,2021-08-04,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,27.0,31.0,30,47,39,14.2,47.0,40.0,21,0,ECO\n189,2021-08-05,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,25.5,17,29,37,12.0,41.0,36.0,22,0,ECO\n190,2021-08-05,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,27.0,33.5,23,27,52,14.7,37.0,30.0,22,0,ECO\n191,2021-08-06,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,25.0,23.5,17,25,42,11.9,23.0,18.0,OFF,0,ECO\n192,2021-08-24,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,23.5,17,29,37,12.8,41.0,35.0,OFF,0,ECO\n193,2021-08-24,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,26.0,27.5,18,52,21,17.8,35.0,30.0,22,0,ECO\n194,2021-08-25,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,25.5,24.0,21,32,40,12.8,80.0,75.0,22,0,ECO\n195,2021-08-27,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,23.0,17,33,32,11.7,80.0,78.0,OFF,0,ECO\n196,2021-09-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,21.5,21,46,28,11.4,78.0,73.0,OFF,0,ECO\n197,2021-09-08,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.5,24.0,18,76,15,15.6,49.0,43.0,OFF,0,ECO\n198,2021-09-10,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,19.0,17,50,21,12.7,35.0,30.0,OFF,0,ECO\n199,2021-09-13,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,23.5,17.5,17,41,26,12.3,80.0,75.0,OFF,0,ECO\n200,2021-09-13,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,24.0,25.0,23,61,23,14.8,75.0,69.0,23,0,ECO\n201,2021-10-04,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,21.0,20.0,18,42,26,12.6,45.0,41.0,OFF,0,COMFORT\n202,2021-10-07,Istanbul,Goodyear EfficientGrip Performance 215/45 R20,20.5,14.5,17,28,37,12.0,68.0,63.0,OFF,0,COMFORT\n"}, {"content": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"0ee62f01\",\n \"metadata\": {},\n \"source\": [\n \"# Welcome to the Versatile Data Kit Demo Example!\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"eda79260\",\n \"metadata\": {},\n \"source\": [\n \"## Workshop Steps\\n\",\n \"Now that you have opened up the MyBinder environment and are reading this, you are already on the right track! Inside this environment,\\n\",\n \"you will also find:\\n\",\n \"* samples: This is a folder containing the base of the scripts that you will be working with to finish the exercise. Please look for the triple exclamation points (!!!) as that means that you are being asked to write some code to get things to work!\\n\",\n \"* README.md: This is just the README file you saw on the Github page.\\n\",\n \"* requirements.txt: This is a list of the required libraries that were installed upon startup.\\n\",\n \"* exercise.ipynb: The file you are reading right now! Think of this as your home page.\\n\",\n \"* Other system files - postBuild and start: No need to worry about these. They are needed for the setup.\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"073a7011\",\n \"metadata\": {},\n \"source\": [\n \"### Step 0: Explore VDK's Functionalities\\n\",\n \"A simple command like that found in the exercise.ipynb \\\"!vdk --help\\\" gives you all the information you need.\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"2893be67\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"!vdk --help\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"98bfd927\",\n \"metadata\": {},\n \"source\": [\n \"### Step 1: Identify the business process\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"8d89e488\",\n \"metadata\": {},\n \"source\": [\n \"**Business request**: \\n\",\n \"\\n\",\n \"We work for Volkswagen. Latest market research has shown that our customers need to understand better their battery usage in order to be able to plan their trips better. We want to create application that will allow them to predict battery drainage based on different environment parameters (speed of travel, are they using heated seats, etc.). Using the app our customers would be able to plan their trips much better (e.g they'd drive slowly or they'd not use the heated seats, etc.)\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"e7622e41\",\n \"metadata\": {},\n \"source\": [\n \"**What is the business process we want to model ?**\\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> ...\\n\",\n \"\\n\",\n \"How do we find the business process \\n\",\n \"\\n\",\n \"* Look from the customer or user persona's point of view.\\n\",\n \"* It is usally expressed as action verbs/events. \\n\",\n \"* It generates key performance indicators\\n\",\n \"* Often it might be supported by an operational system\\n\",\n \"* Communication: talk to product team, marketing team, customer excelence team and the customers themselves (if feasible).\\n\",\n \"\\n\",\n \"\\n\",\n \"**Task: Describe the business process for the business reuqest we are tracking. \\n\",\n \" In our case we will make it up. In reality *never* get tempted to make things up. It must be a real business process.**\\n\",\n \"\\n\",\n \"\\n\",\n \"<!-- The business process we need to model is a car owner taking a trip using VW electric cars we'll track the EV consumption.. -->\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"fc17356a\",\n \"metadata\": {},\n \"source\": [\n \"#### Ingest data\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"316b7242-8f5a-4358-a5b7-8b2dda90aeab\",\n \"metadata\": {},\n \"source\": [\n \"We are using the data provided by G\u00f6ktu\u011f \u00d6zg\u00fcl on Kaggle.com\\n\",\n \"Now let's ingest our data. \\n\",\n \"\\n\",\n \"We are going to an easy way to ingest CSV data using Versatile Data Kit: `vdk ingest-csv`. <br>\\n\",\n \"Make sure to check the help! It has pretty good documentation and examples. \\n\",\n \"Full tutorial can also been seen [here](https://github.com/vmware/versatile-data-kit/wiki/Ingesting-local-CSV-file-into-Database).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"1542bdd7\",\n \"metadata\": {\n \"pycharm\": {\n \"name\": \"#%%\\n\"\n }\n },\n \"outputs\": [],\n \"source\": [\n \"! vdk ingest-csv --help\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"546670dc\",\n \"metadata\": {},\n \"source\": [\n \"The command did not work :) . That's because we need to install a plugin. Versatile Data Kit is extremely pluggbale and versatile. \\n\",\n \"\\n\",\n \"Let's install vdk-csv plugin: \"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"2ae651c1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"!pip install vdk-csv\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"87941f16\",\n \"metadata\": {},\n \"source\": [\n \"For this excercise we are going to use Trino. Let's tell VDK that we want to ingest and query data using Trino (the connection settingis preconfigured for us.). \\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> ...\\n\",\n \"\\n\",\n \"Change VDK_TRINO_SCHEMA with one of your own for example \\\"aivanov\\\" (for Antoni Ivanov) \"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"4b7cd219\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"%env VDK_DB_DEFAULT_TYPE=trino\\n\",\n \"%env VDK_INGEST_METHOD_DEFAULT=trino\\n\",\n \"%env VDK_TRINO_SCHEMA=ai4\\n\",\n \"\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"a293cfd7\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"!vdk trino-query -q \\\"create schema if not exists $VDK_TRINO_SCHEMA\\\"\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"bbb16098\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"!vdk trino-query -q \\\"create table if not exists staging_area_trips (\\\\\\n\",\n \"trip INTEGER ,\\\\\\n\",\n \"date VARCHAR ,\\\\\\n\",\n \"location VARCHAR ,\\\\\\n\",\n \"tyres VARCHAR ,\\\\\\n\",\n \"temperature_start_c REAL ,\\\\\\n\",\n \"temperature_end_c REAL ,\\\\\\n\",\n \"distance_km INTEGER ,\\\\\\n\",\n \"duration_minutes INTEGER ,\\\\\\n\",\n \"average_speed_kmh INTEGER ,\\\\\\n\",\n \"average_consumption_kwhkm REAL ,\\\\\\n\",\n \"charge_level_start REAL ,\\\\\\n\",\n \"charge_level_end REAL ,\\\\\\n\",\n \"ac_c VARCHAR ,\\\\\\n\",\n \"heated_front_seats_level INTEGER ,\\\\\\n\",\n \"mode VARCHAR \\\\\\n\",\n \" )\\\"\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"7059d126-70b5-4fba-9cd3-5a022ca0f2c8\",\n \"metadata\": {\n \"trusted\": true\n },\n \"outputs\": [],\n \"source\": [\n \"! vdk ingest-csv -f \\\"VW ID. 3 Pro Max EV Consumption.csv\\\" --table-name \\\"staging_area_trips\\\"\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"b1dee313\",\n \"metadata\": {},\n \"source\": [\n \"To verify that the data is ingested as expected, let's query the database. \\n\",\n \"\\n\",\n \"VDK comes with a easy way to query any pre-configured database using CLI: \\n\",\n \"\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"7dcca784\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"! vdk trino-query -q \\\"SELECT * FROM staging_area_trips\\\"\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"7e5615dc\",\n \"metadata\": {},\n \"source\": [\n \"<font color='blue'>**NOTICE:**</font> `vdk ingest-csv` might be great if you want to ingest a signle file quickly. But if we need continious ingestion over time of a lot more data we'd use Ingestion Data Jobs. For more information see [Ingestion examples](https://github.com/vmware/versatile-data-kit/wiki/Examples#ingestion-examples) \\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"279a05cb\",\n \"metadata\": {},\n \"source\": [\n \"### Step 2: Identify the Grain\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"625dba7f\",\n \"metadata\": {},\n \"source\": [\n \"At this point, we know the questions that we want to answer, we understand the business process and it\u2019s now time to start prepping up our data warehouse design.\\n\",\n \"\\n\",\n \"To be able to answer the request that we outlined above, we know that we will probably need the following attributes in our model.\\n\",\n \"\\n\",\n \"* consumption per trip, duration for that trip (both in time and distance) , status \\n\",\n \"\\n\",\n \"And following descriptive data: \\n\",\n \"\\n\",\n \"* vehicle information - model, battery type, etc. \\n\",\n \"\\n\",\n \"\\n\",\n \"Reminder: The grain is the business definition of what a single fact table record represents. Thehe grain is the description of the measurement event in the physical world that gives rise to a measurement. Kimball proposes three types: Transactional, Periodic snapshot and Accumulating snapshot.\\n\",\n \"\\n\",\n \"For example: When the grocery store scanner measures the quantity and the charged price of a product being purchased, the grain is literally the beep of the scanner. That is a great grain definition! \\n\",\n \"\\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> ...\\n\",\n \"\\n\",\n \"**TASK: What is our grain definition for the above business request?**\\n\",\n \"\\n\",\n \"<!-- \\n\",\n \"In our case we probably can work with more aggregated data - like daily snapshot or weekly . But for the purposes of this tutorial we'd proceed with transactional data. The grain would be the end of the a full trip. \\n\",\n \"\\n\",\n \"So we seem we'd need a bit of transactional data, (a single trip can be thought of as a transaction), \\n\",\n \"We need also descriptive data that goes along with these transactions (currently car temperature features but in the future all sorts of information that may impact battery life). This is a good indication that we may need both a fact and dimension.\\n\",\n \"\\n\",\n \"To remind again, we can think of a fact table as a place where we can store measurements and a dimension table where we store descriptive attributes associated with the facts measurement.\\n\",\n \"\\n\",\n \"**The grain of our data is at the transaction level** for a trip (we are going to track each trip). Possibly some time of aggregated level would do as well (snapshot grain). But this would give more flexibility to our ML model.\\n\",\n \"-->\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"ea47ca4c\",\n \"metadata\": {},\n \"source\": [\n \"### Step 3: Identify the dimensions\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"1f70291c\",\n \"metadata\": {},\n \"source\": [\n \" Once the grain has been properly declared, the dimensions typically can easily be identified as they represent the \u201cwho, what, where, when, why, and how\u201d associated with the event. A robust set of dimensions representing all possible descriptions should be identified. In our case we'd need data about the vehicle information (manufacturer, model, battery type etc.) \\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> ...\\n\",\n \"\\n\",\n \"**TASK: What dimensions are relevant to the above business request?**\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"2f7a66ca\",\n \"metadata\": {},\n \"source\": [\n \"### Step 4: Identify the facts\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"1cad88e5\",\n \"metadata\": {},\n \"source\": [\n \"Facts are determined by answering the question, \u201cWhat is the process measuring? In other words the facts are the metrics that business users are concerned about. These must be appropriately defined in accordance with the declared grain. If not, they should be placed in a different fact table. Usually, facts are numerical data, such as total cost or order quantity. \\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> ...\\n\",\n \"\\n\",\n \"**TASK: What is are fact table(s) relevant to the above business request?**\\n\",\n \"\\n\",\n \"<!--\\n\",\n \"\\n\",\n \"We have identified that our main fact table is \\\"fact_trips\\\" at transaction grain. -->\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"8f73a553\",\n \"metadata\": {},\n \"source\": [\n \"### Data transformation: Create a Data Job\\n\",\n \"Now that we have explored VDK's capabilities, and followed the dimensiton business process, let's create our transformation data jobs. \\n\",\n \" \\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"b142837f\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"#!vdk create -n build-dimensional-model -t team-awesome -p /home/jovyan\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"18a57e2d\",\n \"metadata\": {},\n \"source\": [\n \"When you create a data job, VDK automatically downloads some template scripts and files, so that you can get accustomed to the data job's structure. They are super helpful in getting you ready to run your own data jobs. However, let's go ahead and delete these for our example, since we won't be starting from scratch, but please check them out! Alternatively, you can explore the 'vdk create --no-template' option, if you do not want these templates downloaded. Let's go ahead and delete the following files:\\n\",\n \"* The SQL script: our example does not do anything with SQL.\\n\",\n \"* The sample Python script: we already have moved four sample Python scripts, so we won't be needing this.\\n\",\n \"* README.md: We already have a README for the entire example, so we can get rid of this.\\n\",\n \"* requirements.txt: Each data job would need this file if the data job relies on external libraries that VDK does not have. In our case, MyBinder installed those upon startup, so we won't be needing this either.\\n\",\n \"\\n\",\n \"As such, please run the code below to delete them:\\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> Please change 'build-dimensional-model' to the name of your data job.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"b4051888\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"! rm \\\"build-dimensional-model/10_sql_step.sql\\\"\\n\",\n \"! rm \\\"build-dimensional-model/20_python_step.py\\\"\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"95527b59\",\n \"metadata\": {},\n \"source\": [\n \"Great! Now you're all set up with the data job:\\n\",\n \"* You have created a data job.\\n\",\n \"* You have deleted the template files that you do not need.\\n\",\n \"* You have moved the sample scripts we provided to the data job sub-folder.\\n\",\n \"* You have moved the raw CSV file to the data job sub-folder for a neater environment!\\n\",\n \"\\n\",\n \"The next step is to begin working on each script in the data job! Let's do it!\\n\",\n \"\\n\",\n \"We have 2 files (we can see them in samples/build-dimensional-model). Feel free to copy it.\\n\",\n \"\\n\",\n \"* 10_fact_trips_create_table.sql - we define the schema of our fact table \\n\",\n \"* 20_fact_trips_update.py - this will load the data into our fact table. \\n\",\n \"\\n\",\n \"The code looks something like this \\n\",\n \"```\\n\",\n \"job_input.execute_template(\\n\",\n \" template_name='periodic_snapshot',\\n\",\n \" template_args={\\n\",\n \" 'source_view': 'staging_area_trips',\\n\",\n \" 'target_table': 'fact_trips',\\n\",\n \" 'last_arrival_ts': 'date'\\n\",\n \" },\\n\",\n \" )\\n\",\n \"```\\n\",\n \"\\n\",\n \"We are using period_snapshot (called also append). <br>\\n\",\n \"Append strategy appends a snapshot of records observed between time t1 and t2 from the source table to the target table, truncating all present target table records observed after t1. <br>\\n\",\n \"The strategy can be used for updating Periodic Snapshot Fact Tables or transaction fact table in data warehousing ETL jobs. <br>\\n\",\n \"It suitable to update records where late arrival data is expected. \\n\",\n \"\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"54d9bc2d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"!vdk run samples/build-dimensional-model\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"4079981a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"! vdk trino-query -q \\\"select * from fact_trips\\\"\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"e95e3d0c\",\n \"metadata\": {},\n \"source\": [\n \"<font color='blue'>**NOTICE:**</font> <br>\\n\",\n \"For other type of Kimball templates you can checkout [example documentation](https://github.com/vmware/versatile-data-kit/wiki/SQL-Data-Processing-templates-examples) . <br>\\n\",\n \"Template is pretty much a \\\"reusable data job\\\". Anyone that writes a data job, can create their own template. See [Tempalate registry documentation](https://github.com/vmware/versatile-data-kit/blob/main/projects/vdk-core/src/vdk/api/plugin/plugin_input.py#L87)\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"fac52510\",\n \"metadata\": {},\n \"source\": [\n \"### Build the ML Model\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"7804db6d\",\n \"metadata\": {},\n \"source\": [\n \"It's time to build the model. We focus on build-ml-model data job\\n\",\n \"\\n\",\n \"It has two steps. The first one would process the data so it is suitable for our ML model (linear regression)\\n\",\n \"The second will build the actual ML Model. \"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"fa21ab96\",\n \"metadata\": {},\n \"source\": [\n \"After we are done building the model let's try to run our job\\n\",\n \"\\n\",\n \"<font color='red'>**ATTENTION!**</font> Please change to the name of your data job if necessary\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"03b0b1c1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"! vdk run samples/build-ml-model\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"cacb70ac\",\n \"metadata\": {},\n \"source\": [\n \"### Build a Streamlit Visualization\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"3e3512ca\",\n \"metadata\": {},\n \"source\": [\n \"Now that we have finished with the data job, let's use that hard-earned model to make a cool dashboard!\\n\",\n \"\\n\",\n \"When you run below command, you will get an output, but the kernel will be stuck. That's okay! Just open a new tab in your browser,\\n\",\n \"copy the link of the MyBinder environment, delete everything after \\\"user/blah blah blah\\\" and paste \\\"/proxy/8501/\\\"\\n\",\n \"So, something like this: \\n\",\n \"```\\n\",\n \"https://hub.gke2.mybinder.org/user/alexanderavramo-n-example-empty-zkd8q00p/proxy/8501/\\n\",\n \"```\\n\",\n \"\\n\",\n \"The Streamlit dashboard will now show up!\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"57b19f0c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"! streamlit run samples/build_streamlit_dashboard.py\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"a673786e\",\n \"metadata\": {},\n \"source\": [\n \"### Bonus: Deploy\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"c2d25b9d\",\n \"metadata\": {},\n \"source\": [\n \"Since the analysis that we perform is on a regular basis, it makes sense to schedule our data job to run once per week. VDK allows the **automatic execution of data jobs by deploying them on a cloud server** which handles the regular execution as per schedule that the user defines. The deployment configurations are entered in the **\\\"config.ini\\\"** file that is required for deployment. \\n\",\n \"Let's open it up and examine the contents.\\n\",\n \"\\n\",\n \"In the first section [owner], we have specified the **team owning the data job**. In the second section [job] we defined the schedule of execution. It is in cron format (you can use [this website](https://crontab.guru/#*/20_*_*_*_*) to translate the cron schedule into a human-readable form). In this case, we want the schedule to run on the Monday of each week at 00:01am US time. Since VDK uses UTC time for schedule execution, the cron schedule indicates 05:01am UTC time. \\n\",\n \"\\n\",\n \"The config file could also include a [contacts] section which specifies whether any **notifications** are sent to specific emails upon job execution success, failure or deployment. In our case, we have left those empty.\\n\",\n \"\\n\",\n \"The last part of the config file contains the **VDK configuration settings** - the type of DB to which we will be ingesting, the DB location, schema and catalogue. \\n\",\n \"\\n\",\n \"For a full list and explanations of the configuration settings you could enter into the \\\"config.ini\\\" file of a data job, you can run the following command:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"771474d6-3ab8-4a9d-94d6-45627bc0ece7\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"!vdk config-help\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"00a59f72-f774-4bfe-8eed-9ad0fd13a2eb\",\n \"metadata\": {},\n \"source\": [\n \"\\n\",\n \"Let's now deploy the data job. We would need to install vdk-server. \\n\",\n \"\\n\",\n \"The below commands are illusatrative and won't owrk in myBinder. See https://github.com/vmware/versatile-data-kit/wiki/Scheduling-a-Data-Job-for-automatic-execution for more information.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"1e54eb2d-7a7a-4259-b491-074ef9e38925\",\n \"metadata\": {\n \"trusted\": true\n },\n \"outputs\": [],\n \"source\": [\n \"!vdk deploy -n <job-name> -t team-awesome -r \\\"Initial deploy\\\" -p /home/jovyan/<job-name>\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"030de733-89ce-4d27-aaba-eb6c89d6a575\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"! vdk deploy --show -n <job-name> -t team-awesome\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"9cd1d0a4-dd3f-42fe-8339-6fdf3193575d\",\n \"metadata\": {},\n \"source\": [\n \"\\n\",\n \"And if there's an issue revert: \"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"627fbb2b-37cf-4a90-811a-ee2372951470\",\n \"metadata\": {\n \"trusted\": true\n },\n \"outputs\": [],\n \"source\": [\n \"! vdk deploy --update --job-version <old-version> -n ingest-<unique-suffix> -t team_awesome\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"4bef347d\",\n \"metadata\": {},\n \"source\": [\n \"**Please share your feedback** : https://bit.ly/vdk-dsc\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"fc17f9b7\",\n \"metadata\": {},\n \"source\": []\n }\n ],\n \"metadata\": {\n \"kernelspec\": {\n \"display_name\": \"Python 3.9.1 64-bit ('vdk-oss-39')\",\n \"language\": \"python\",\n \"name\": \"python3\"\n },\n \"language_info\": {\n \"codemirror_mode\": {\n \"name\": \"ipython\",\n \"version\": 3\n },\n \"file_extension\": \".py\",\n \"mimetype\": \"text/x-python\",\n \"name\": \"python\",\n \"nbconvert_exporter\": \"python\",\n \"pygments_lexer\": \"ipython3\",\n \"version\": \"3.9.1\"\n },\n \"vscode\": {\n \"interpreter\": {\n \"hash\": \"e00b8106e488857b585e3c18b5cbcd89c05e8998087dfa37a307556692e1465b\"\n }\n }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 5\n}\n"}, {"content": "# enable nbserverproxy\njupyter serverextension enable --sys-prefix nbserverproxy"}, {"content": "numpy\nquickstart-vdk\nvdk-trino\nvdk-notebook\nvdk-ipython\nvdk-jupyterlab-extension\n\n\n# necessary for sql in jupyter\nipython-sql\njupyterlab_sql\n\nstreamlit\njupyter-server-proxy\nnbserverproxy\n\npyarrow==7.0.0\nseaborn\nmatplotlib\nscikit-learn\nxlsxwriter\n"}, {"content": "python-3.9"}, {"content": "create table if not exists fact_trips(\ntrip INTEGER,\ndate VARCHAR,\nlocation VARCHAR,\ntyres VARCHAR,\ntemperature_start_c REAL,\ntemperature_end_c REAL,\ndistance_km INTEGER,\nduration_minutes INTEGER,\naverage_speed_kmh INTEGER,\naverage_consumption_kwhkm REAL,\ncharge_level_start REAL,\ncharge_level_end REAL,\nac_c VARCHAR,\nheated_front_seats_level INTEGER,\nmode VARCHAR\n )"}, {"content": "import logging\nimport os\n\nfrom vdk.api.job_input import IJobInput\n\nlog = logging.getLogger(__name__)\n\ndef run(job_input: IJobInput) -> None:\n \"\"\"\n The following aspects are automatically handled by the template.\n\n 1. Late arrival updates are generally supported.\n 2. It overwrites the overlap between the new data (the source) and target\n\n See https://github.com/vmware/versatile-data-kit/wiki/SQL-Data-Processing-templates-examples#append-strategy-fact\n\n\n \"\"\"\n job_input.execute_template(\n template_name='periodic_snapshot',\n template_args={\n 'source_schema': os.environ.get(\"VDK_TRINO_SCHEMA\"),\n 'source_view': 'staging_area_trips',\n 'target_schema': os.environ.get(\"VDK_TRINO_SCHEMA\"),\n 'target_table': 'fact_trips',\n 'last_arrival_ts': 'date'\n },\n )\n"}, {"content": "import pandas as pd\nimport numpy as np\nimport logging\nimport pathlib\nimport os\nfrom vdk.api.job_input import IJobInput\n\nlogger = logging.getLogger(__name__)\nos.chdir(pathlib.Path(__file__).parent.absolute())\n\ndef run(job_input: IJobInput):\n logger.info('executing program: ' + os.path.basename(__file__))\n\n # some definitions...\n filename_to_export = 'VW ID. 3 Pro Max EV Consumption_Model_Data.csv'\n\n # reading in the data...\n conn = job_input.get_managed_connection().connect()\n df = pd.read_sql(\"select * from fact_trips\", conn)\n\n # Let's drop the rows with missing values.\n # There are many ways to deal with missing values\n # (estimating them through taking the mean or median, or even performing a linear regression just for them),\n # but let's stick with the simple choice of dropping them, as the loss of data is not that great.\n df_no_nulls = df.copy().dropna()\n\n # encoding the categorical variables....\n # Linear regression only works with numeric variables.\n # As such, if we want to use the categorical variables, we will need to turn them into numerics.\n df_no_nulls['ac_use'] = np.where(\n df_no_nulls['ac_c'] == 'OFF', 0, 1\n )\n df_no_nulls['heated_seats'] = np.where(\n df_no_nulls['heated_front_seats_level'] == 0, 0, 1\n )\n df_no_nulls['eco_mode'] = np.where(\n df_no_nulls['mode'] == 'ECO', 1, 0\n )\n df_no_nulls[\"is_summer\"] = np.where(\n (df_no_nulls['date'] >= '2021-06-21') & (df_no_nulls['date'] <= '2021-09-22'), 1, 0\n )\n df_no_nulls['is_bridgestone_tyre'] = np.where(\n df_no_nulls['tyres'] == 'Bridgestone 215/45 R20 LM32', 1, 0\n )\n\n # Here create our dependent variable - the variable we will be trying to estimate: battery drainage\n df_no_nulls['battery_drain'] = \\\n -(df_no_nulls['charge_level_end'] - df_no_nulls['charge_level_start'])\n # create one more variable: temperature change. Who knows - it may have explanatory power!\n df_no_nulls['temperature_increase'] = \\\n df_no_nulls['temperature_end_c'] - df_no_nulls['temperature_start_c']\n\n # Let's now limit the data set to the variables we want. This helps declutter.\n # clearing the dataset of all the clutter...\n df_no_nulls_limited = df_no_nulls.copy()[\n [\n 'battery_drain',\n 'charge_level_start',\n 'is_bridgestone_tyre',\n 'temperature_start_c',\n 'temperature_increase',\n 'distance_km',\n 'average_speed_kmh',\n 'average_consumption_kwhkm',\n 'ac_use',\n 'heated_seats',\n 'eco_mode',\n 'is_summer'\n ]\n ]\n\n # observing the processed data and making corrections, as needed...\n #logger.info(df_no_nulls_limited.describe()) # we see a possible data error\n\n logger.info(df_no_nulls_limited.loc[df_no_nulls_limited['battery_drain'] < 0]) # this is an error we have to remove\n df_no_nulls_limited_final = df_no_nulls_limited.copy().loc[\n df_no_nulls_limited['battery_drain'] >= 0]\n\n #logger.info(df_no_nulls_limited_final.describe()) # looks good now\n\n # saving the processed data...\n df_no_nulls_limited_final.to_csv(\n path_or_buf=filename_to_export,\n index=False\n )\n"}, {"content": "import pandas as pd\nimport os\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport logging\nimport pickle\nimport pathlib\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LinearRegression, LassoCV\nfrom sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\nfrom vdk.api.job_input import IJobInput\n\nlogger = logging.getLogger(__name__)\nos.chdir(pathlib.Path(__file__).parent.absolute())\n\ndef run(job_input: IJobInput):\n logger.info('executing program: ' + os.path.basename(__file__))\n\n # some definitions...\n filename_to_import = 'VW ID. 3 Pro Max EV Consumption_Model_Data.csv'\n\n # creating a sub-folder to house the model and model related things...\n if not os.path.exists('model'):\n os.makedirs('model')\n\n # reading in the data created from our processing program...\n df = pd.read_csv(filepath_or_buffer=filename_to_import)\n\n # splitting the data into a training dataset and a testing dataset...\n y = df.copy()[['battery_drain']]\n x = df.copy().drop('battery_drain', axis=1)\n x_train, x_test, y_train, y_test = train_test_split(\n x,\n y,\n test_size=0.2,\n random_state=22\n )\n\n # explore the split data\n data_sets = {\n \"x_train\": x_train,\n \"x_test\": x_test,\n \"y_train\": y_train,\n \"y_test\": y_test\n }\n for name, data_set in data_sets.items():\n logger.info(f\"The shape of the {name} dataset is: {data_set.shape}\")\n\n # # checking for multicollinearity...\n # sns.set(\n # style='ticks',\n # rc={'figure.figsize': (18, 14)}\n # )\n # sns.heatmap(\n # x_train.corr(),\n # annot=True,\n # cmap=sns.diverging_palette(10, 250, n=240)\n # )\n # drop the heavily correlated variables from both the training and testing data sets...\n predictive_data_sets = [x_train, x_test]\n for data_set in predictive_data_sets:\n data_set.drop(['is_bridgestone_tyre', 'is_summer', 'ac_use'], axis=1, inplace=True)\n\n # using Lasso regularization to delete less important features...\n lasso = LassoCV(normalize=True, random_state=22)\n lasso.fit(\n x_train,\n y_train\n )\n lasso = pd.Series(lasso.coef_, index=x_train.columns)\n\n # deleting the less important features from the train and test data sets...\n features_to_delete = list(lasso[lasso == 0].index)\n for data_set in predictive_data_sets:\n data_set.drop(features_to_delete, axis=1, inplace=True)\n\n # fitting the model on the training data...\n linreg = LinearRegression()\n linreg.fit(x_train, y_train)\n\n # testing the model on testing data and extracting predictions...\n y_pred = linreg.predict(x_test)\n y_pred = pd.DataFrame(y_pred, columns=['battery_drain_prediction'])\n actual_vs_predicted = pd.concat(\n [y_test.copy().reset_index(drop=True), y_pred.copy().reset_index(drop=True)],\n axis=1\n )\n actual_vs_predicted.to_csv('model/actual_vs_model_predicted_battery_drain_test.csv')\n\n # obtaining model accuracy...\n # Now that we have the true values of battery drain from y_test and the predicted battery drain from y_pred,\n # we can get some measures of model quality, like the mean squared error, mean absolute error, and R2!\n measurements = {\n 'mean squared error': mean_squared_error,\n 'mean absolute error': mean_absolute_error,\n 'R2': r2_score}\n for measure, func in measurements.items():\n logger.info(f\"The {measure} is: {func(y_pred, y_test)}\")\n\n # extracting the coefficients...\n # We can also extract the coefficients in a neat table.\n # This isn't super necessary in every single case, but it could prove useful in model manipulation and exploration.\n # Plus, it doesn't hurt, right?\n coeff = pd.DataFrame(linreg.coef_).transpose()\n inter = pd.DataFrame(linreg.intercept_).transpose()\n inter_and_coeff = pd.concat(\n [inter, coeff],\n ignore_index=True\n )\n inter_and_coeff.columns = ['coefficients']\n intercept = ['intercept']\n intercept.extend(x_train.columns.to_list())\n feature_names = pd.DataFrame(\n intercept,\n columns=['feature']\n )\n model_coeffs = pd.concat(\n [inter_and_coeff, feature_names],\n axis=1,\n join='outer'\n )\n model_coeffs.to_csv('model/model_coefficients.csv')\n\n # saving the model...\n # Lastly, we save the model and we're done! Well... not quite.\n # We still have to run the data job and make sure that it doesn't fail!\n\n filename = 'model/demo_linear_regression_model.sav'\n pickle.dump(linreg, open(filename, 'wb'))\n"}, {"content": "; Supported format: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure\n\n; This is the only file required to deploy a Data Job.\n; Read more to understand what each option means:\n\n; Information about the owner of the Data Job\n[owner]\n\n; Team is a way to group Data Jobs that belonged to the same team.\nteam = team-awesome\n\n; Configuration related to running data jobs\n[job]\n; For format see https://en.wikipedia.org/wiki/Cron\n; The cron expression is evaluated in UTC time.\n; If it is time for a new job run and the previous job run hasn\u2019t finished yet,\n; the cron job waits until the previous execution has finished.\nschedule_cron = 11 23 5 8 1\n\n; Who will be contacted and on what occasion\n[contacts]\n\n; Specifies the time interval (in minutes) that a job execution is allowed to be delayed\n; from its scheduled time before a notification email is sent. The default is 240.\n; notification_delay_period_minutes=240\n\n; Specifies whether to enable or disable the email notifications for each data job run attempt.\n; The default value is true.\n; enable_attempt_notifications=true\n\n; Specifies whether to enable or disable email notifications per data job execution and execution delays.\n; The default value is true.\n;enable_execution_notifications=true\n\n; The [contacts] properties below use semicolon-separated list of email addresses that will be notified with email message on a given condition.\n; You can also provide email address linked to your Slack account in order to receive Slack messages.\n; To generate Slack linked email address follow the steps here:\n; https://get.slack.help/hc/en-us/articles/206819278-Send-emails-to-Slack#connect-the-email-app-to-your-workspace\n\n; Semicolon-separated list of email addresses to be notified on job execution failure caused by user code or user configuration why.\n; For example: if the job contains an SQL script with syntax error.\n; [email protected]\nnotified_on_job_failure_user_error=\n\n; Semicolon-separated list of email addresses to be notified on job execution failure caused by a platform why.\n; [email protected]; [email protected]\nnotified_on_job_failure_platform_error=\n\n; Semicolon-separated list of email addresses to be notified on job execution success.\nnotified_on_job_success=\n\n; Semicolon-separated list of email addresses to be notified of job deployment outcome.\n; Notice that if this file is malformed (file structure is not as per https://docs.python.org/3/library/configparser.html#supported-ini-file-structure),\n; then an email notification will NOT be sent to the recipients specified here.\nnotified_on_job_deploy=\n\n[vdk]\n; Key value pairs of any configuration options that can be passed to vdk.\n; For possible options in your vdk installation execute command vdk config-help\n\n"}, {"content": "seaborn\nmatplotlib\nscikit-learn"}, {"content": "import os\nimport pandas as pd\nimport pickle\nfrom sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\nimport pathlib\nimport streamlit as st\nfrom parameters import parameters\n\n# setting up the title of the page...\nst.title('Electric Car Battery Drain Calculator')\n\n\n# some definitions...\nos.chdir(pathlib.Path(__file__).parent.absolute())\nactual_vs_pred_loc = 'build-ml-model/model/actual_vs_model_predicted_battery_drain_test.csv'\nmodel_loc = 'build-ml-model/model/demo_linear_regression_model.sav'\n\n\n\n\n# setting up the sub-headers for the 1st part of the page...\nst.header('How Much Will Your Electric Car Battery Drain? You May Be Surprised!')\nst.write(\"Enter Your Custom Values in the SideBar - Please Enter Sensible Values Only!\")\n\n# selecting the user inputs...\nresults = {}\nfor measurement, params in parameters.items():\n output = st.sidebar.number_input(**params)\n results[measurement] = output\nresults_df = pd.DataFrame(results, index=[0])\n\n# reading in the model...\npickled_model = pickle.load(open(model_loc, 'rb'))\n\n# obtaining model prediction...\nestimate = pickled_model.predict(results_df)\n\n# printing model prediction...\nif estimate > results['charge_level_start']:\n estimate = results['charge_level_start']\n st.metric(\"Your Estimated Battery Drainage (in Percent) Is:\", estimate)\n st.write(\"Note: The Model's Estimate Exceeds the Starting Level Charge; Thus Estimate is Capped\")\nelif estimate < 0:\n estimate = 0\n st.metric(\"Your Estimated Battery Drainage (in Percent) Is:\", estimate)\nelse:\n st.metric(\"Your Estimated Battery Drainage (in Percent) Is:\", estimate)\n\n\n\n\n\n# setting up the sub-header for the second part of the page...\nst.header(\"Stats for nerds\")\nst.write(\" How Did Our Model Perform?\")\n\n# reading in the actual versus predicted data set...\nactual_vs_pred = pd.read_csv(actual_vs_pred_loc, usecols=range(1, 3))\nactual_vs_pred['absolute_difference'] = abs(\n actual_vs_pred['battery_drain'] - actual_vs_pred['battery_drain_prediction']\n)\nst.dataframe(actual_vs_pred)\nbattery_drain = actual_vs_pred[['battery_drain']]\nbattery_drain_prediction = actual_vs_pred[['battery_drain_prediction']]\n\n# outputting some performance metrics...\nmse = round(mean_squared_error(battery_drain, battery_drain_prediction), 2)\nmae = round(mean_absolute_error(battery_drain, battery_drain_prediction), 2)\nr2 = round(r2_score(battery_drain, battery_drain_prediction), 2)\n\nst.metric(\"The Mean Squared Error of This Model On This Testing Data Is:\", mse)\nst.metric(\"The Mean Absolute Error of This Model On This Testing Data Is:\", mae)\nst.metric(\"The R2 is:\", r2)\n"}, {"content": "parameters = {\n 'charge_level_start': dict(\n label=\"Select Value for the Starting Charge Level\",\n value=80,\n max_value=100,\n min_value=1\n ),\n 'temperature_start_c': dict(\n label=\"What's the Temperature Outside? In Celsius Please!\",\n value=20,\n max_value=50,\n min_value=-50\n ),\n 'distance_km': dict(\n label=\"How Many Kilometers Are We Going to Drive?\",\n value=50,\n max_value=1000,\n min_value=1\n ),\n 'average_speed_kmh': dict(\n label=\"What's the Average Speed We Expect (in Kilometers per Hour)?\",\n value=60,\n max_value=300,\n min_value=1\n ),\n 'average_consumption_kwhkm': dict(\n label=\"Any Guesses on the Average Consumption (in kwhkm)?\",\n value=15,\n max_value=50,\n min_value=1\n ),\n 'heated_seats': dict(\n label=\"Do We Plan on Using the Heated Seats? (1 = Yes, 0 = No)\",\n value=1,\n max_value=1,\n min_value=0\n ),\n 'eco_mode': dict(\n label=\"Do We Plan on Using the Eco Mode? (1 = Yes, 0 = No)\",\n value=1,\n max_value=1,\n min_value=0\n )\n}\n"}, {"content": "#!/bin/bash\n\nexport VDK_API_TOKEN=FQue3EehGQUKIwMJ5hlxwjrYL0j9BfigV87R2QbQXzrpEba1dOwbbrHax11Q3O98\nexport VDK_CONTROL_SERVICE_REST_API_URL=https://iaclqhm5xk.execute-api.us-west-1.amazonaws.com\nexport VDK_API_TOKEN_AUTHORIZATION_URL=https://console-stg.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize\n\nexport DATABASE_URL=trino://user@a34e9e7b62427467ca722321ac046193-2067995295.us-west-1.elb.amazonaws.com:1094/mysql\nexport VDK_TRINO_HOST=a34e9e7b62427467ca722321ac046193-2067995295.us-west-1.elb.amazonaws.com\nexport VDK_TRINO_PORT=1094\nexport VDK_TRINO_USE_SSL=False\n\nexport VDK_DB_DEFAULT_TYPE=TRINO\nexport VDK_INGEST_METHOD_DEFAULT=trino\nexport VDK_TRINO_CATALOG=mysql\nexport VDK_TRINO_SCHEMA=default\nexport VDK_INGEST_TARGET_DEFAULT=trino://user@a34e9e7b62427467ca722321ac046193-2067995295.us-west-1.elb.amazonaws.com:1094/mysql\n\nexec \"$@\""}]