Skip to main content

Cannlytics provides a user-friendly interface to quickly receive samples, perform analyses, collect and review results, and publish certificates of analysis (CoAs). There are also built in logistics, CRM (client relationship management), inventory management, and invoicing tools.

Project description

Cannlytics Engine

License: GPL v3 contributions welcome Code style: black

Cannlytics

Cannlytics provides a user-friendly interface to quickly receive samples, perform analyses, collect and review results, and publish certificates of analysis (CoAs). There are also built in logistics, CRM (client relationship management), inventory management, and invoicing tools. 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

Database Usage

Cannlytics utilizes Firebase for back-end services. Firebase is initialized with firebase.initialize_firebase, which returns a Firestore database instance. A generic example of using the cannlytics package is as follows.

from cannlytics import firebase

# TODO: Set the path to your Firebase service account.
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = ""

# Initialize Firebase
database = firebase.initialize_firebase()

# Get a document.
lab = firebase.get_document("labs/cannlytics")

You will need to provide credentials for your application by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file that contains your service account key. This variable only applies to your current shell session, so if you open a new session, set the variable again.

Firestore

The Firestore functions utilize create_reference to turn a path into a document or collection reference, depending on the length of the path. Odd length paths refer to collections and even length paths refer to documents. For example, users is a collection of users, users/{uid} is a user's document, and users/{uid}/logs is a sub-collection of logs for the user. With this functionality, you can easily get documents as follows.

# Get all user documents.
users = firebase.get_collection("users")

# Get a document.
user = firebase.get_document("users/xyz")

And create or update documents as follows.

from datetime import datetime

# Create a user log.
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
firebase.update_document(f"users/xyz/logs/{timestamp}", {
  "activity": "Something happened",
  "created_at": timestamp,
  "updated_at": timestamp
})

# Update the user.
firebase.update_document(f"users/xyz", {
  "recent_activity": timestamp,
})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cannlytics-0.0.2.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cannlytics-0.0.2-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file cannlytics-0.0.2.tar.gz.

File metadata

  • Download URL: cannlytics-0.0.2.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for cannlytics-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ef12d7357652e9b4e0a6f3c37c9358e3843cc981428cf6d623a453517b490d53
MD5 9d18365b5fc5e0456ee6c6db54373255
BLAKE2b-256 0acdfa8c0415b169ec26477f796488ee12400d3352787cd32acaa8cba509061a

See more details on using hashes here.

File details

Details for the file cannlytics-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: cannlytics-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for cannlytics-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6cd3bf2d84bea85e1ec80b4cdb1b6d4850598750b7d2433ce375c57f07ec87f1
MD5 e4c8deaee5a9428299470c668ee45171
BLAKE2b-256 f7d1542167b2b2d40fba6a2e2cd28edc78bc6238a21f316fdf9ad9016b7e6b35

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page