Skip to main content

coreason-codex

The Terminology Server for Bio-Pharma AI

coreason-codex acts as the "Universal Translator" for the platform. It bridges the "Semantic Precision Gap" in Bio-Pharma AI by enforcing the use of Standardized Vocabularies (OMOP CDM).

CI/CD codecov Python License Ruff pre-commit Poetry Checked with mypy

Executive Summary

While Large Language Models are fluent, they can be imprecise. coreason-codex ensures that when an Agent reads "Heart Attack", it records it as ConceptID: 312327 (Data), enabling precise retrieval, graph grounding, and regulatory reporting.

It provides tools for Agents to lookup, validate, and translate medical concepts using a "Frozen Lake" pattern for GxP compliance.

For detailed requirements, see the Product Requirements Document.

Getting Started

Prerequisites

  • Python 3.12+
  • Poetry

Installation

  1. Clone the repository:
    git clone https://github.com/CoReason-AI/coreason-codex.git
    cd coreason-codex
    
  2. Install dependencies:
    poetry install
    

Usage

Here is a quick example of how to use coreason-codex to normalize text to a standard concept.

from pathlib import Path
from coreason_codex.loader import CodexLoader
from coreason_codex.normalizer import CodexNormalizer
from coreason_codex.embedders import SapBertEmbedder

# 1. Initialize Loader with path to your Codex Pack
# Ensure you have a valid Codex Pack at this location
pack_path = Path("./codex_pack_v1")
loader = CodexLoader(pack_path)
duckdb_conn, lancedb_conn = loader.load_codex()

# 2. Initialize Embedder and Normalizer
embedder = SapBertEmbedder() # Uses cambridgeltl/SapBERT-from-PubMedBERT-fulltext
normalizer = CodexNormalizer(embedder, duckdb_conn, lancedb_conn)

# 3. Normalize Text
matches = normalizer.normalize("Heart Attack")

for match in matches:
    print(f"Concept: {match.match_concept.concept_name} (ID: {match.match_concept.concept_id})")
    print(f"Score: {match.similarity_score}")

Documentation

Detailed documentation is available in the docs/ directory:

  • Setup & Deployment: Step-by-step guide to installing, building, and running the service.
  • Architecture: Overview of the system design, including the Frozen Lake pattern and Zero-Copy architecture.
  • Usage Guide: Detailed instructions on using the Loader, Normalizer, Hierarchy, and CrossWalker components.
  • Vignettes: Walkthroughs of key user stories (Semantic Tagging, Lateral Logic, Audit Replay).

Development

  • Run the linter:
    poetry run pre-commit run --all-files
    
  • Run the tests:
    poetry run pytest
    

Metadata

Release files for coreason-codex 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coreason-codex 0.4.1
File Size Uploaded
coreason_codex-0.4.1.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coreason-codex 0.4.1
File Interpreter ABI Platform
coreason_codex-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 45.4 kB

Release files / coreason_codex-0.4.1.tar.gz

Download URL coreason_codex-0.4.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e41e26fec5e1cda2c873e86d8506ce833cc16252e4709614a3ca09aaf57f4fd9
BLAKE2b-256 checksum
How to use checksums
703f9463c3813b5bc2a01715197f4f9b77a2fc6aee3e05aff9ae5a9db0540680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release files / coreason_codex-0.4.1-py3-none-any.whl

Download URL coreason_codex-0.4.1-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5760f38d5b584fa4437428b7539662028bf98042cbdebc68a4f2af6e001bfc50
BLAKE2b-256 checksum
How to use checksums
e7da371622f1e4f0b40f2dfde10752440bd0ba01497642b0d598eb49b9807acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page