{ "info": { "author": "Dillon Mabry", "author_email": "rapid.dev.solutions@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "## CMPD Traffic Helper (Traffic Analysis for Charlotte, NC)\n[![Build Status](https://travis-ci.org/dillonmabry/cmpd-traffic-helper.svg?branch=master)](https://travis-ci.org/dillonmabry/cmpd-traffic-helper)\n[![Python 3.4](https://img.shields.io/badge/python-3.4-blue.svg)](https://www.python.org/downloads/release/python-340/)\n[![Python 3.5](https://img.shields.io/badge/python-3.5-blue.svg)](https://www.python.org/downloads/release/python-350/)\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nCMPD Traffic Alerts service for persistence data and also any predictions/model analysis. Updater service as well as traditional ML model utilities.\n\n## Goals of Project\n- Identify areas of improvement in Charlotte traffic flow\n- Identify problems areas, specific roads needing attention\n- Identify least likelihood route from point A to point B of having an accident\n- Provide a web based area to allow suggested routing to minimize likelihood of an accident\n\nAPIs used:\n- Charlotte Mecklenburg Near-real time accident feeds http://maps.cmpd.org/trafficaccidents/default.aspx\n- OpenWeatherAPI weather location information https://openweathermap.org/api\n\nData used:\n- CMPD Traffic Accidents (Accident information)\n- NC-DOT ARC GIS (Road features)\n- Charlotte Open Data Portal (Traffic volumes, population, traffic signals, spatial features)\n- Live weather stats (OpenWeatherAPI)\n\n## Install Instructions\nThis project has 2 Python projects **traffic_analyzer** and **cmpd_accidents**:\n- cmpd_accidents is for persistence and storing accidents either as a callable script or through PyPI\n- traffic_analyzer is for model creation/generation\n\nInstall locally:\n```\npip install .\n```\nInstall via PyPI:\n```\npip install charlotte-traffic-analysis\n```\n\n## How to Use\nCurrent usage:\n1. Setup persistence for storing data (MongoDB or MySQL currently supported)\n2. Setup database or collections as \"accidents\"\n3. Setup OpenWeatherAPI account and API key\nThat's it! All other data is stored as reference data from the latest census information via Charlotte NC\n\nTo check for current accidents and store them in your persistence:\n```\nimport cmpd_accidents as cmpd\ncmpd.update_traffic_data(, , ) \n```\nor\n```\npython main.py \n```\nIt is preferable to setup a job-type service to run the API incrementally over time.\nUsing cron via -nix type systems:\nClone the current repo:\n```\ngit clone https://github.com/dillonmabry/cmpd-traffic-helper\n```\nSetup cron job to run every 5 minutes:\n```\ncrontab -e\n```\n```\n*/5 * * * * cd /cmpd_accidents && sudo python3 main.py mongodb://:@/ \n```\n## Note on Persistence\nIf you would rather use a relational persistence such as MySQL, the interface is already available for SQLAlchemy connect via the database module. Simply replace the \"collection\" argument with \"table\" for relational persistence. Seed scripts are available in resources/db feel free to replace with what table columns you prefer.\n\nPersistence swap example:\n\nRelational\n```\nfrom cmpd_accidents import SQLAlchemyConnect\ndb = SQLAlchemyConnect(connection_string='mysql+pymysql://:@/')\nwith self.database as db:\n exist_events = db.find_ids(table=\"accidents\", ids=current_ids, cursor_limit=500)\nwith self.database as db:\n db.insert_bulk(table=\"accidents\", items=final_data) # persist data\n```\nMongoDB\n```\nfrom cmpd_accidents import MongoDBConnect\ndb = MongoDBConnect(host='mongodb://:@/', port=27017)\nwith self.database as db:\n exist_events = db.find_ids(collection=\"accidents\", ids=current_ids, cursor_limit=500)\nwith self.database as db:\n db.insert_bulk(collection=\"accidents\", items=final_data) # persist data\n```\n\n## Tests\n```\npython setup.py test\n```\n## To-Do\n- [X] Create API to use CMPD SOAP Service for latest traffic accident data\n- [X] Setup generic persistence for use of different databases (MySQL, etc.)\n- [X] Add integration tests\n- [X] Setup Travis CI integration\n- [X] Exploratory Data Analysis\n- [X] Analyze existing traffic prediction models and develop mock model\n- [ ] Test mock model and provide detailed transparency\n- [ ] Utilize created model to provide insight for current traffic patterns and information\n- [ ] Create Python web service via hosting solution to call mock model and integrate with web portal\n- [ ] Finalize and push Python package to PyPI\n- [ ] Fix any new bugs\n- [ ] Create web based portal with interactivity\n\n## Related R Notebook\nThis project was initially created via R and converted as best as possible to Python/Sklearn after decision to use Python to support model calling would be easier via web", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dillonmabry/cmpd-traffic-helper", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "charlotte-traffic-analysis", "package_url": "https://pypi.org/project/charlotte-traffic-analysis/", "platform": "", "project_url": "https://pypi.org/project/charlotte-traffic-analysis/", "project_urls": { "Homepage": "https://github.com/dillonmabry/cmpd-traffic-helper" }, "release_url": "https://pypi.org/project/charlotte-traffic-analysis/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "Charlotte-metro traffic analysis helper including predictions, travel paths, and more", "version": "0.1.3" }, "last_serial": 5484118, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "8d28de8770ed07979c81257efbc2df5c", "sha256": "237e2d922d49f2ee8d63b64f51d3d3dd959f0f0259213f0a79268c60ef1b9e0c" }, "downloads": -1, "filename": "charlotte_traffic_analysis-0.1.2.tar.gz", "has_sig": false, "md5_digest": "8d28de8770ed07979c81257efbc2df5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5601503, "upload_time": "2019-07-04T00:08:29", "url": "https://files.pythonhosted.org/packages/0d/17/d0fc18d572d0fd40823779a6421b125317153ee5ee3a2a995aa3a978f96f/charlotte_traffic_analysis-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1dfeb315e5ca36fb428dc17297318ac1", "sha256": "a41f56cff4aee73bd1040c6732c0aef52e62fb578249382544c117dce2934129" }, "downloads": -1, "filename": "charlotte_traffic_analysis-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1dfeb315e5ca36fb428dc17297318ac1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5600248, "upload_time": "2019-07-04T00:18:23", "url": "https://files.pythonhosted.org/packages/4e/1d/1bed5955fd8b21b93a6d71c1a54d5933487512628b02d8849a56aa7888d1/charlotte_traffic_analysis-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1dfeb315e5ca36fb428dc17297318ac1", "sha256": "a41f56cff4aee73bd1040c6732c0aef52e62fb578249382544c117dce2934129" }, "downloads": -1, "filename": "charlotte_traffic_analysis-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1dfeb315e5ca36fb428dc17297318ac1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5600248, "upload_time": "2019-07-04T00:18:23", "url": "https://files.pythonhosted.org/packages/4e/1d/1bed5955fd8b21b93a6d71c1a54d5933487512628b02d8849a56aa7888d1/charlotte_traffic_analysis-0.1.3.tar.gz" } ] }