Cannlytics AI is
🌱 Installation
You can simply clone the repository to get your hands on the AI source code.
git clone https://github.com/cannlytics/cannlytics-ai.git
♀️ Quickstart
🏃You can run each data collection routine through the command line. For example:
python ai/get_cannabis_data/get_data_ma.py
🔨 Development
Please see the data collection guides for information on how public data is collected.
🦾 Automation
Now for the fun part, automation.
Note that you will need to enable billing for your project, enable the Cloud Scheduler API, and enable the Pub/Sub API.
-
Create a Pub/Sub topic:
gcloud pubsub topics create get_cannabis_data_daily
-
Deploy the function:
gcloud functions deploy get_cannabis_data_daily --entry-point get_cannabis_data_daily --runtime python39 --trigger-topic get_cannabis_data_daily --memory 1024MB --timeout 300 --env-vars-file env.yaml
-
Finally, create a Cloud Scheduler cron job:
gcloud scheduler jobs create pubsub get_cannabis_data_daily --schedule "20 4 * * *" --topic get_cannabis_data_daily --message-body "success"
Your function should now run nicely everyday at 4:20am EDT. You can read the logs for your function with:
gcloud functions logs read get_cannabis_data_daily
👩🔬 Testing
You can run tests with code coverage with pytest
.
pytest --cov=ai tests/
❤️ Support
Cannlytics is made available with
🏛️ License
Copyright (c) 2021 Cannlytics and Cannlytics Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.