Skip to main content

nexcore_drug/
lib.rs

1//! # nexcore-drug
2//!
3//! Drug entity domain models — identity, classification, indications,
4//! safety signals, label status, and cross-drug analysis.
5//!
6//! ## T1 Primitive Grounding
7//!
8//! | Concept | Primitive | Symbol | Role |
9//! |---------|-----------|--------|------|
10//! | Drug struct | State | ς | Central mutable domain aggregate |
11//! | DrugClass / SignalVerdict / LineOfTherapy / ComparisonResult | Sum | Σ | Variant classification |
12//! | DrugAnalysis trait methods | Mapping | μ | Transform aggregate → view |
13//! | Option fields (rxcui, owner, approval_year, …) | Void | ∅ | Strategic absence |
14//! | ContingencyTable cells (a, b, c, d) | Quantity | N | Disproportionality magnitudes |
15//! | on_label / off_label filter | Comparison | κ | Predicate selection |
16//! | Serialize / Deserialize | Persistence | π | Cross-boundary transport |
17//! | ::new() constructors | Existence | ∃ | Aggregate instantiation |
18//! | Trait method chains | Causality | → | Query → result pipelines |
19//!
20//! ## Peer Architecture
21//!
22//! Drug and Company are **peer aggregates**. `nexcore-drug` does NOT
23//! depend on `nexcore-pharma`. The owning manufacturer is stored as
24//! `Option<String>`. A strategy crate composes the two peers when
25//! cross-aggregate analysis is required.
26//!
27//! ## Modules
28//!
29//! - [`id`]: `DrugId` newtype (type-safe string identity)
30//! - [`class`]: `DrugClass` enum (16 variants + `Other`)
31//! - [`indication`]: `Indication`, `LineOfTherapy`
32//! - [`signal`]: `SignalEntry`, `ContingencyTable`, `SignalVerdict`
33//! - [`label`]: `LabelStatus`
34//! - [`drug`]: `Drug` aggregate
35//! - [`analysis`]: `DrugAnalysis` trait + `DefaultDrugAnalysis` implementation
36
37#![forbid(unsafe_code)]
38#![warn(missing_docs)]
39#![cfg_attr(
40    not(test),
41    deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)
42)]
43
44pub mod analysis;
45pub mod class;
46pub mod drug;
47pub mod id;
48pub mod indication;
49pub mod label;
50pub mod signal;
51
52pub use analysis::{DefaultDrugAnalysis, DrugAnalysis, SignalComparison};
53pub use class::DrugClass;
54pub use drug::Drug;
55pub use id::DrugId;
56pub use indication::{Indication, LineOfTherapy};
57pub use label::LabelStatus;
58pub use signal::{ContingencyTable, SignalEntry, SignalVerdict};