Skip to content

A Python 🐍 package that implements the logic of πŸ”₯ Cannlytics.

License

Notifications You must be signed in to change notification settings

cannlytics/cannlytics-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Simple, easy, cannabis analytics.

https://cannlytics.com

License: MIT Version

πŸ”₯ Cannlytics is simple, easy-to-use, end-to-end cannabis analytics software designed to make your data and information accessible. We believe that everyone in the cannabis industry should be able to access their rich, valuable data quickly and easily and that everyone will be better off for it. The Cannlytics Engine comes with batteries included, but you are always welcome to supercharge your setup with modifications and custom components.

πŸš€ Installation

You can install the Cannlytics engine from PyPI.

pip install cannlytics

You can also simply clone the repository to get your hands on the Cannlytics source code.

git clone https://github.com/cannlytics/cannlytics-engine.git

πŸ‘©β€πŸ« Documentation

Please refer to the Cannlytics developer documentation for detailed information about the module and various use cases.

πŸ—οΈ Authentication, Data, and File Management

Cannlytics leverages Firebase by default for a database, file storage, and authentication. You can refer to the documentation for instructions on how to setup your Firebase project for use with Cannlytics.

🧐 Traceability

Cannlytics supports Metrc out-of-the-box. Simply plug in your API keys and you're off to the races.

from cannlytics import metrc

# Initialize a Metrc API client.
track = metrc.authorize(
    'your-vendor-api-key',
    'your-user-api-key',
    primary_license='your-user-license-number',
    state='ma',
)

Producer / processor workflow:

# Get a plant by it's ID.
plant = track.get_plants(uid='123')

# Change the growth phase from vegetative to flowering.
plant.flower(tag='your-plant-tag')

# Move the flowering plant to a new room.
plant.move(location_name='The Flower Room')

# Manicure useable cannabis from the flowering plant.
plant.manicure(harvest_name='Old-Time Moonshine', weight=4.20)

# Harvest the flowering plant.
plant.harvest(harvest_name='Old-Time Moonshine', weight=420)

Lab workflow:

# Post lab results.
track.post_lab_results([{...}, {...}])

# Get a tested package.
test_package = track.get_packages(label='abc')

# Get the tested package's lab result.
lab_results = track.get_lab_results(uid=test_package.id)

Retail workflow:

# Get a retail package.
package = track.get_packages(label='abc')

# Create a sales receipts.
track.create_receipts([{...}, {...}])

# Get recent receipts.
sales = track.get_receipts(action='active', start='2021-04-20')

# Update the sales receipt using.
sale = track.get_receipts(uid='420')
sale.total_price = 25
sale.update()

πŸ‘©β€πŸ”¬ Testing

You can run tests with code coverage with pytest.

pytest --cov=cannlytics tests/

🀝 Contributing

Contributions are always welcome! You are encouraged to submit issues, functionality, and features that you want to be addressed. You can also develop your own new features, fix known issues, and add documentation, tests, and examples. Anyone is welcome to contribute anything. Please see the contributing guide for more information.

❀️ Support

Cannlytics is made available with ❀️ and your good will. Please consider making a contribution to keep the good work coming. Thank you πŸ™

πŸ₯ž Bitcoin donation address: 34CoUcAFprRnLnDTHt6FKMjZyvKvQHb6c6

πŸ›οΈ License

Copyright (c) 2021-2022 Cannlytics

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.