Data Model

Brief on the OpenTHC Data Model. More details are in the source YAML and other references.

Jump to: Generic_Object, Company, Company_Type, License, License_Type, Contact, Contact_Type, Section, Variety, Product, Product_Type, Vehicle, Plant, Plant_Collect, Inventory, Lab_Sample, Lab_Metric, Lab_Report, Lab_Result, Lab_Result_Metric, B2B_Incoming, B2B_Outgoing, B2B_File, B2B_Sale, B2B_Sale_Item, B2C_Sale, B2C_Sale_Item


Generic_Object

@context string
The Context of the Current Object, generally the OpenTHC namespace
@version string
The Version Serial Number, like 2018

Company

A Company is a container for License and Contact models

id string
Global/Universal Unique Identifier
name string
Name of Company
code string
A Unique Identifier Code; typically a Government issued ID
type $ref
#/components/schemas/Company_Type

Company_Type

Designations for the a Type of a company

id string
Unique ID value for this Company Type from the well-known published set
code string
A single character descriptor of the Company Type
name string
A Friendly Name for this Company Type

License

A License is part of a Company and is a container for Inventory, Products, Variety, Section, B2B and B2C Transactions

id string
Global/Universal Unique Identifier
name string
Name of the License
code string
A Unique Identifier Code; typically a Government issued ID
type $ref
#/components/schemas/License_Type
company $ref
#/components/schemas/Company

License_Type

Designations for the a Type of a company

id string
Global/Universal Unique Identifier from the well-known published set
code string
A single character descriptor of the License Type
name string
Name of the License Type like Grower, or G1 or Lab or something

Contact

A Contact represents a natural person

id string
Global/Universal Unique Identifier
type $ref
#/components/schemas/Contact_Type
name string
Full Name
email string
Contacts primary email address.
phone string
Contacts primary phone number
company $ref
#/components/schemas/Company

Contact_Type

Well-known Types of Contacts

id string
well-known Contact Type ULID
name string
Human readable Name for this Contact Type
enum: Caregiver, Client, Driver, Employee, Manager, Owner, Patient, User, Vendor

Section

A logical or physical organizational container aka Area, Room, Zone

id string
The Universal Identifier
name string
The Name
type string
enum: crop, inventory, inventory-quarantine

Variety

The Variety is sometimes called the Cultivar or Strain. Not all products have a Variety

id string
Global/Universal Unique Identifier
name string
Free-form name of Variety
type string
enum: Hemp, Hybrid, Indica, Sativa, Ruderalis

Product

id string
The Product Unique Identifer from the CRE
name string
Free-form name of the Product
type $ref
#/components/schemas/Product_Type
package object
serving object

Product_Type

Designations for the a Type of a product

id string
ULID or An Internal SKU or Lot ID
name string
Name of Product Type
unit object

Vehicle

The Vehicle is any equipment that transports cannabis

id string
Global/Universal Unique Identifier
name string
Free-form, auto-generated name of Vehicle
make string
Manufacturer / Make of vehicle
model string
Vehicle Model
color string
Vehicle Color
vin string
The Vehicle Identification Number
vrn string
The Vehicle Registration Number (License Plate/Number Plate)

Plant

id string
Unique Plant Identifier
name string
Free-form Name of the plant, many times just the Variety
variety $ref
#/components/schemas/Variety

Plant_Collect

id string
Unique Identifier of the Plant Collect operation
plant $ref
#/components/schemas/Plant
type string
Material Type: Flower/Wet, Flower/Dry, Trim/Wet|Dry, Waste/Wet|Dry
enum: raw, net, wet-plant, wet-waste, dry-buds, dry-trim, dry-waste
qty number [double]
Quantity of Material Collected
uom string
enum: g, kg, oz, lb

Inventory

An Inventory of some Product and Variety

id string
The Inventory Unique Identifier
name string
Freeform name of the Inventory, if desired
section $ref
#/components/schemas/Section
variety $ref
#/components/schemas/Variety
product $ref
#/components/schemas/Product
qty number [float]
Current Quantity of the Product on Hand
qty_initial number [float]
Initial Quantity of the Product

Lab_Sample

A Special type of Inventory Lot that becomes a Laboratory Sample

id string
ID of this specific Lab Sample
stat integer
Status/State indicator
enum: 200, 410
created_at string [dateTime]
DateTime
updated_at string [dateTime]
DateTime
deleted_at string [dateTime]
DateTime when deleted -- null indicates NOT deleted
license_origin $ref
#/components/schemas/License

Lab_Metric

Mapping for all of the individual metrics that would be recorded with a Lab Result to Universal IDs

id string
ID of this specific metric from the well-known published set
name string
Human readable name of this metric
type string
Human readable type of this metric
enum: General, Cannabinoid, Terpene, Microbe, Metal, Solvent

Lab_Report

Issued by a Laboratory as container for a collection of test results and their metrics

id string
company $ref
#/components/schemas/Company
license $ref
#/components/schemas/License
lab_sample $ref
#/components/schemas/Lab_Sample
contact object
The Contact Object of the Laboratory Technician Submitting Report
certificate string
URL of the Certificate in PDF format, either a public link on the internet, or a base64 encoded data URL.
image string
URL of the Product Image in a image/png or image/jpeg format, either a public link on the internet, or a base64 encoded data URL.
metric_list array
The Result Metrics, where each Key is the Metric ID from the well-known published set

Lab_Result

Issued by a Laboratory as container for individual test result metrics

id string
company $ref
#/components/schemas/Company
license $ref
#/components/schemas/License
lab_sample $ref
#/components/schemas/Lab_Sample
contact object
The Contact Object of the Laboratory Technician Submitting Results
certificate string
URL of the Certificate in PDF format, either a public link on the internet, or a base64 encoded data URL.
image string
URL of the Product Image in a image/png or image/jpeg format, either a public link on the internet, or a base64 encoded data URL.
metric_list array
The Result Metrics, where each Key is the Metric ID from the well-known published set

Lab_Result_Metric

A Lab Metric Result for any test

lab_result_id string
The Lab Result
lab_metric_id string
The Well Known Identifier of this Metric, may be null
qom string
Quantity of Measure, the value measured
uom string
Unit of Measure
enum: mg/g, percent, ppb, ppm
lod string
The Level of Detection
loq string
Limit of Quantitation
limit
Upper limit of detected stuff in the sample, below which the sample has passed
status string
The status of this Lab Metric on this Lab Result
enum: fail, na, nd, nr, nt, pass

B2B_Incoming

The Incoming transaction record (aka: Purchase Order, Receipt) of business to business type of transaction, contains one or more line items.

id string
ULID
type string
enum: incoming
source $ref
#/components/schemas/License
target $ref
#/components/schemas/License
depart_at string [dateTime]
Estimate of Departure Time
arrive_at string [dateTime]
Estimate of Arrival Time
item_list array

B2B_Outgoing

The Outgoing transaction record (aka: Manifest, Transfer) business to business type of transaction, contains one or more line items.

id string
ULID
type string
enum: outgoing
source $ref
#/components/schemas/License
target $ref
#/components/schemas/License
depart_at string [dateTime]
Estimate of Departure Time
arrive_at string [dateTime]
Estimate of Arrival Time
item_list array

B2B_File

A file attachment for a B2B Transaction

id string
ULID
type string
MIME Type of the File
b2b_incoming_id string
ID
b2b_outgoing_id string
ID
data binary
The File Contents
link string
A Link to the File Contents

B2B_Sale

A business to business type of transaction, contains one or more line items.

id string
ULID
type string
enum: incoming, outgoing
source $ref
#/components/schemas/License
target $ref
#/components/schemas/License
depart_at string [dateTime]
Estimate of Departure Time
arrive_at string [dateTime]
Estimate of Arrival Time
item_list array

B2B_Sale_Item

Line item of a B2B Transaction

id string
type string
The Type of transfer such as SAMPLE or FOR_PROCESSING; values are determined by the CRE provider
inventory object
Inventory as String ID or Object
product $ref
#/components/schemas/Product
variety $ref
#/components/schemas/Variety
unit_count number [double]
Quantity of Items Being Transferred
unit_price number [double]
The All-In price of the line item, inclusive of all taxes, fees and other charges

B2C_Sale

A business to consumer type transaction with one or more line items

id string
The Universal Identifier
created_at string [dateTime]
Timestamp of when the Transaction was created, which may be different than when the record was created

B2C_Sale_Item

Line item of a B2C Transaction

id string
Global/Unique Identifier
inventory string
Inventory as String ID or Object
unit_count string
Quantity of Items Sold
unit_price string
Pre-Tax Price per Unit *NOT* the full price