NuGet version

CDES .NET SDK

Type-safe C# library for cannabis data — strains, terpenes, cannabinoids, COA validation, and profile analysis. Built for .NET 8+.

dotnet add package Cdes

What's Included

Everything you need to work with cannabis data in .NET — models, reference data, analysis, and serialization.

🧬

Models

Strongly-typed records for Batch, Product, Strain, Cannabinoid, Terpene, COA, Weight, and Price.

Batch, Product, Strain, COA
🌿

Terpene Library

30 terpene definitions with CAS numbers, boiling points, categories, and aromas.

TerpeneLibrary, TerpeneUtilities
💊

Cannabinoid Registry

9 cannabinoid definitions with chemical formulas, molecular weights, and FDA scheduling.

CannabinoidLibrary, CannabinoidUtilities
📊

Profile Analysis

Compare profiles, find similar strains, score completeness, and classify strains by THC/CBD ratio.

CdesAnalyzer
🔄

JSON Serialization

System.Text.Json options with camelCase naming and enum string conversion out of the box.

CdesJsonOptions
✅

148 Unit Tests

Comprehensive xUnit test suite covering all models, reference data, utilities, and analysis.

xUnit + coverlet

Quick Examples

Reference Data Lookup

// Look up terpene by name
using Cdes.Reference;

var myrcene = TerpeneLibrary.GetByName("myrcene");
Console.WriteLine($"{myrcene!.DisplayName}: {myrcene.Category}");
// Output: Myrcene: Monoterpene

// Search terpenes
var results = TerpeneUtilities.SearchByName("lim");
// Returns: [Limonene, D-Limonene, ...]

// Look up cannabinoid + normalize names
var thc = CannabinoidLibrary.GetByName("THC");
var normalized = CannabinoidUtilities.NormalizeName("Δ9-THC");
// normalized == "Δ9THC"

Profile Comparison & Analysis

using Cdes.Analysis;
using Cdes.Models;

var analyzer = new CdesAnalyzer();

// Create cannabinoid profiles
var profile1 = new CannabinoidProfile
{
    BatchId = "BATCH-001",
    BatchName = "Blue Dream #1",
    Cannabinoids = new Dictionary<string, double>
    {
        ["THC"] = 22.5,
        ["CBD"] = 0.8,
        ["CBG"] = 1.2
    },
    TotalCannabinoids = 24.5
};

// Classify strain by THC/CBD ratio
var classification = analyzer.ClassifyStrain(profile1);
// classification.Type == "THC-Dominant"
// classification.ThcContent == "High"

// Score data completeness
var completeness = analyzer.ScoreCompleteness(profile1);
// completeness.Score, completeness.Coverage, completeness.Message

// Compare two profiles
var result = analyzer.CompareProfiles(profile1, profile2);
// result.Similarity (0-100), result.Differences

JSON Serialization

using System.Text.Json;
using Cdes.Models;
using Cdes.Serialization;

var product = new Product
{
    Id = "SKU-001",
    Name = "Blue Dream Flower",
    Category = ProductCategory.Flower,
    Strain = new Strain
    {
        Name = "Blue Dream",
        Classification = StrainClassification.Hybrid
    }
};

// Serialize with CDES conventions (camelCase)
var json = JsonSerializer.Serialize(product, CdesJsonOptions.Default);
// {"id":"SKU-001","name":"Blue Dream Flower","category":"Flower",...}

Python vs .NET SDK

Same CDES data models and reference data, native to your technology stack.

FeaturePython SDK.NET SDK
Packagepip install cdesdotnet add package Cdes
RuntimePython 3.9+.NET 8+
Terpenes30 definitions ✅30 definitions ✅
Cannabinoids9 definitions ✅9 definitions ✅
Profile Analysis✅✅
JSON SerializationPydanticSystem.Text.Json
Standard Colors✅Coming soon
Therapeutic Data✅Coming soon
LicenseMITMIT

Built For .NET Developers

🖥️

Blazor Apps

Cannabis dashboards and dispensary portals

⚡

Azure Functions

Serverless COA processing and data pipelines

🌐

ASP.NET APIs

REST and GraphQL endpoints for cannabis data

📦

NuGet Package

Drop into any .NET 8+ project

Start Building Today

Install the .NET SDK and start working with standardized cannabis data in minutes.