Skip to main content

Cannabis data science and analytics.

https://cannlytics.com

🔥Cannlytics is a set of useful tools to wrangle, curate, augment, analyze, archive, and market cannabis data. The mission of Cannlytics is to help cannabis data and analytics be accessible. From seed to sale and beyond, Cannlytics can help you organize, analyze, and profit from your cannabis data. The cannlytics package is extensive and you are welcome to use any and all of the components that you find useful.

🚀 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.git

You can get the nightly development build by cloning the app-dev branch of the repository. The app-dev branch is not stable for production, but has the latest and greatest tools that we're working tirelessly to deliver to you shortly.

git clone -b app-dev https://github.com/cannlytics/cannlytics.git

🗝️ Authentication

Cannlytics leverages 🔥Firebase for data storage, file storage, and authentication. Use of Firebase is entirely optional and you are welcome to use your favorite database and backend services. If you choose to use Firebase, then you will need to provide credentials for your application. This is typically done by setting a GOOGLE_APPLICATION_CREDENTIALS environment variable that points to your service account credentials. For more information on adding authentication to your app, see the cannlytics.firebase documentation.

📡 Data

The cannlytics.data module is a toolbox for accessing, collecting, cleaning, augmenting, standardizing, saving, and analyzing cannabis data. See the cannlytics.data documentation for nifty tools to get, standardize, and archive your cannabis data.

📜 COAs

Certificates of analysis (COAs) are abundant for cultivators, processors, retailers, and consumers too, but the data is often locked away. Rich, valuable laboratory data so close, yet so far away! CoADoc puts these vital data points in your hands by parsing PDFs and URLs, finding all the data, standardizing the data, and cleanly returning the data to you. You can read more about using CoADoc in the cannlytics.data.coas documentation.

🔥 Firebase

The cannlytics.firebase module is a wrapper of the firebase_admin package to make interacting with Firebase services, such as Firestore databases and Firebase Storage buckets, even easier. For more information, see the cannlytics.firebase documentation.

🔰 Metrc

Cannlytics integrates with Metrc. You can use the cannlytics.metrc module to securely interface with the Metrc API and perform all operations needed for compliance. Simply plug in your vendor and user API keys, specify your state of operations, 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='ok',
)

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.
sale = track.get_receipts(uid='420')
sale.total_price = 25
sale.update()

See the cannlytics.metrc documentation for more information and examples on how you can interface with the Metrc API.

Release files for cannlytics 0.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cannlytics 0.0.17
File Size Uploaded
cannlytics-0.0.17.tar.gz 228.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cannlytics 0.0.17
File Interpreter ABI Platform
cannlytics-0.0.17-py3-none-any.whl Python 3 none any Details

Total release size: 520.7 kB

Release files / cannlytics-0.0.17.tar.gz

Download URL cannlytics-0.0.17.tar.gz
Size 228.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e09431b028d68b306ad65aaa852dee45c6b6d996b566084350e1fbc9e9017a98
BLAKE2b-256 checksum
How to use checksums
ec3eb54ed9e5288dd5485fec1a2674421cdf69f9e66e80786a823c7d5a05a0c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / cannlytics-0.0.17-py3-none-any.whl

Download URL cannlytics-0.0.17-py3-none-any.whl
Size 292.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f63c98ea78b467e61795e4e12e253a05e4e8f6ebc37e22567415cd07ec8116a
BLAKE2b-256 checksum
How to use checksums
bce5bf3671b6e580e0236fc9daf99657fb9827c369c42cb46ee403026cdd93ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.17 This release

2 release files

0.0.16

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page