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
Metadata
Release files for cdes-m 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cdes_m-1.0.0.tar.gz | 15.5 kB | Without provenance | Details for cdes_m-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cdes_m-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cdes_m-1.0.0-py3-none-any.whl |
Total release size: 27.9 kB
Release files / cdes_m-1.0.0.tar.gz
| Download URL | cdes_m-1.0.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b14c8eb15d52e9ca1527149a08a0628c02ab3b517d64d03d443aed340647efc
|
|
BLAKE2b-256 checksum How to use checksums |
b59e807b62bbab0c31c0d4d5e0b8e84ebe2e301f61cf2cc7931b79f3571d2db7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / cdes_m-1.0.0-py3-none-any.whl
| Download URL | cdes_m-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6713231ad86e9eb0cce65a934fa964d7fe66b25750c25ae58b6961e82f84ac40
|
|
BLAKE2b-256 checksum How to use checksums |
746b8ef80c48879259285162e2a83bd6805be225b83e7b8100966e32006403bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for cdes-m 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.