Cannabis Data Exchange Standard - Medical (CDES-M) Python SDK for healthcare interoperability
Project description
CDES-M Python SDK
Cannabis Data Exchange Standard - Medical Extension
A Python SDK implementing CDES-M, the bridge specification connecting cannabis data (CDES) to established healthcare interoperability standards.
Overview
CDES-M extends the Cannabis Data Exchange Standard (CDES) with medical-specific entities and mappings to healthcare standards:
| CDES-M Entity | FHIR R4 Resource | Healthcare Codes |
|---|---|---|
| Provider | Practitioner | NPI, State License, DEA |
| Patient | Patient | MRN, MMJ Card |
| Condition | Condition | ICD-10-CM, SNOMED CT |
| Recommendation | MedicationRequest | Custom cannabis profile |
| EfficacyReport | Observation | LOINC PRO codes |
Installation
pip install cdes-m
For FHIR conversion support:
pip install cdes-m[fhir]
Quick Start
from datetime import date, datetime
from cdes_m import (
Provider, Patient, Condition, Recommendation,
ProviderLicenseType, ConditionCategory, ConsumptionMethod
)
# Create a provider
provider = Provider(
npi="1234567890",
license_number="ME123456",
license_state="FL",
license_type=ProviderLicenseType.MD,
license_expiration=date(2026, 12, 31),
specialty=["Pulmonology"],
tos_accepted=datetime.utcnow(),
baa_signed=datetime.utcnow()
)
# Create a patient condition
copd = Condition(
icd10_code="J44.9",
snomed_code="13645005",
display_name="Chronic obstructive pulmonary disease",
category=ConditionCategory.RESPIRATORY
)
# Create a recommendation
from cdes_m import TargetProfile, DosingGuidance
recommendation = Recommendation(
patient_id=patient.id,
provider_id=provider.id,
condition_ids=[copd.id],
target_profile=TargetProfile(
terpene_profile={"myrcene": 0.8, "caryophyllene": 0.5, "limonene": 0.3},
consumption_methods=[ConsumptionMethod.VAPORIZER]
),
dosing_guidance=DosingGuidance(
route=ConsumptionMethod.VAPORIZER,
frequency="As needed, up to 3x daily",
dose_low="2.5mg THC",
dose_high="5mg THC"
),
rationale="High myrcene for anti-inflammatory, caryophyllene for bronchodilation"
)
FHIR Conversion
Convert CDES-M entities to FHIR R4 resources:
from cdes_m.fhir import (
provider_to_practitioner,
patient_to_fhir,
condition_to_fhir,
recommendation_to_medication_request,
efficacy_report_to_observation
)
# Convert provider to FHIR Practitioner
practitioner = provider_to_practitioner(provider)
print(practitioner.json(indent=2))
# Convert to FHIR MedicationRequest
med_request = recommendation_to_medication_request(
recommendation, patient.id, provider.id
)
Core Entities
Provider
Licensed healthcare provider with NPI, state license, optional DEA number, and MMJ certification.
Patient (PHI - HIPAA Protected)
Medical marijuana patient with conditions, cannabis history, terpene fingerprint, and consent preferences.
Condition
Medical condition with ICD-10-CM and SNOMED CT coding.
Recommendation
Provider recommendation including target terpene/cannabinoid profile and dosing guidance.
EfficacyReport
Patient-reported outcome tracking treatment effectiveness.
TreatmentProtocol
Evidence-based mapping of conditions to recommended cannabis profiles.
Standards Mapping
CDES-M bridges to these healthcare standards:
| Standard | Purpose | CDES-M Usage |
|---|---|---|
| FHIR R4 | Healthcare interoperability | Full resource mapping |
| ICD-10-CM | Diagnosis codes | Condition.icd10_code |
| SNOMED CT | Clinical terminology | Condition.snomed_code |
| NPI | Provider identification | Provider.npi |
| LOINC | Lab observations | EfficacyReport codes |
Licensing
Dual Licensed:
- Apache 2.0: Free for non-commercial, research, and educational use
- Commercial License: Required for commercial applications
Contact cdes@acidni.net for commercial licensing.
Resources
- Website: https://cdes.acidni.net/cdes-m
- Specification: https://github.com/Acidni-LLC/cdes-m-spec
- CDES Core: https://cdes.acidni.net
Contributing
See CONTRIBUTING.md for contribution guidelines.
Support
- GitHub Issues: Bug reports and feature requests
- Email: cdes@acidni.net
- Community: Join our working groups (see specification)
** 2025 Acidni LLC** - Advancing cannabis data interoperability
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdes_m-1.0.0.tar.gz.
File metadata
- Download URL: cdes_m-1.0.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b14c8eb15d52e9ca1527149a08a0628c02ab3b517d64d03d443aed340647efc
|
|
| MD5 |
ad09e8c3beb1712f7554b7317e0cb120
|
|
| BLAKE2b-256 |
b59e807b62bbab0c31c0d4d5e0b8e84ebe2e301f61cf2cc7931b79f3571d2db7
|
File details
Details for the file cdes_m-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cdes_m-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6713231ad86e9eb0cce65a934fa964d7fe66b25750c25ae58b6961e82f84ac40
|
|
| MD5 |
49512b75ec2f38aed7efd398ac7c4d3e
|
|
| BLAKE2b-256 |
746b8ef80c48879259285162e2a83bd6805be225b83e7b8100966e32006403bd
|