Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
b63efa7
added cohort modifier utility functions
azimov Feb 24, 2026
eb5a4eb
refined cohort modifier utility functions
azimov Feb 25, 2026
2e2651f
default object settings
azimov Feb 25, 2026
aab8440
code formatting
azimov Feb 25, 2026
5339ac9
code formatting
azimov Feb 25, 2026
dd3baec
Release stuff
azimov Feb 25, 2026
f6d81c4
Feature/ibis execution api (#13)
egillax Mar 13, 2026
67cbb8d
Installed ruff and added github workflow for it
azimov Mar 16, 2026
ab7228c
Removal of support for python 3.8
azimov Mar 16, 2026
3e4822f
Ruff reformat
azimov Mar 16, 2026
230d3e0
more ruff reformatting and checks
azimov Mar 16, 2026
e3423ff
more ruff reformatting and checks
azimov Mar 16, 2026
4dfbbc8
Actions fix
azimov Mar 16, 2026
4492374
Actions fix - again
azimov Mar 16, 2026
20bb89f
remove if statement for actions
azimov Mar 16, 2026
0c489cb
most ruff problems resovled
azimov Mar 16, 2026
d4c43ba
Ignoring line length errors for now
azimov Mar 16, 2026
7da7dd1
Install fixes for github actions
azimov Mar 16, 2026
be3cf26
Format
azimov Mar 16, 2026
b45a2ef
Cdm extension registration (#2)
azimov Mar 16, 2026
71738f9
Merge branch 'develop' into issue-8-ruff
azimov Mar 17, 2026
99fe359
ruff check and format
azimov Mar 17, 2026
00d2f66
chore: line lenghts to 110
egillax Mar 17, 2026
2e9c866
chore: add pre-commit hooks for ruff
egillax Mar 17, 2026
c89c11b
chore: add uv-lock file
egillax Mar 17, 2026
37acab0
docs: align docs with uv and ruff workflow
egillax Mar 18, 2026
bf44187
docs: fix sphinx build warnings
egillax Mar 17, 2026
714145c
Fixes for waveform models
azimov Mar 17, 2026
5f32c93
test: align docs and extension tests
egillax Mar 18, 2026
1b1e1cf
fix: avoid pydantic deprecation warnings
egillax Mar 18, 2026
1ec9af9
test: filter duckdb ibis deprecation warning
egillax Mar 18, 2026
fa4e9c5
Merge pull request #17 from OHDSI/issue-8-ruff
egillax Mar 18, 2026
bf396c2
refactor(execution): replace builder-based ibis engine
egillax Mar 17, 2026
0294744
refactor(execution): remove polars compatibility surface
egillax Mar 17, 2026
c18348b
fix(execution): tighten compatibility typing
egillax Mar 17, 2026
d8cf632
refactor(execution): remove legacy compatibility surface
egillax Mar 17, 2026
eff7a35
docs(execution): remove legacy alias note
egillax Mar 17, 2026
bba65e7
chore: remove polars
egillax Mar 18, 2026
2cc58e3
fix(execution): satisfy ruff import rules
egillax Mar 18, 2026
2b7b7b6
style(execution): format ibis operations
egillax Mar 18, 2026
9990db1
test(execution): expand coverage and document strategy
egillax Mar 18, 2026
90b9b03
docs(execution): add architecture overview
egillax Mar 18, 2026
f2bb0a4
docs: refresh root readme package status
egillax Mar 19, 2026
99780d3
test(execution): cover remaining helper branches
egillax Mar 19, 2026
aca1f1a
test(execution): make keep-first helper test py39-stable
egillax Mar 19, 2026
810b77b
fix(execution): apply nested correlated criteria in groups
egillax Mar 19, 2026
579ed22
test(execution): expand nested correlated coverage
egillax Mar 19, 2026
ffe153c
fix(execution): restore era filter semantics
egillax Mar 19, 2026
95386c6
fix(execution): align collapse tie handling with circe
egillax Mar 19, 2026
0db6e37
docs(execution): move developer docs into sphinx guide
egillax Mar 20, 2026
39bed84
Merge pull request #20 from OHDSI/features/ibis-new-design-develop
egillax Mar 20, 2026
252e68c
fix: keep base package importable without ibis (#30)
egillax Mar 20, 2026
c12ae6d
Implementation of backwards compatable concept set support for TAB se…
azimov Mar 24, 2026
9c1a56a
Workaround for broken databricks tests
azimov Apr 24, 2026
b29c26a
* reduce boilerplate in circe/execution/lower/* and normalize (#31)
azimov Apr 27, 2026
da6bf2c
Cleanup/mypy cleanup (#34)
azimov May 1, 2026
c737e18
Added support for snake case only yaml cohort definitions (#35)
azimov May 1, 2026
76466c5
Added functions for persistent caching of concept sets in IBIS execut…
azimov May 5, 2026
b4d9419
fix(execution): make ERA collapse ordering deterministic
egillax May 6, 2026
c2e7067
Merge pull request #36 from OHDSI/fix/era-collapse-deterministic
egillax May 6, 2026
72799aa
Added sqlrender functionality
azimov May 28, 2026
3cc306e
Basic sql glot builder classes and parity tests
azimov May 28, 2026
12189bf
Revert "Basic sql glot builder classes and parity tests"
azimov May 28, 2026
7aac88c
Revert "Added sqlrender functionality"
azimov May 28, 2026
f8d990a
merge with main
azimov Jul 10, 2026
9cd893c
Updated version number and changelog for new version
azimov Jul 10, 2026
19fac51
Features/ibis custom eras (#37)
azimov Jul 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/basic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,34 @@ jobs:
run: tox

- name: Upload coverage to Codecov
if: secrets.CODECOV_TOKEN != ''
continue-on-error: true
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

wheel-smoke:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel setuptools

- name: Build wheel
run: python -m build

- name: Smoke test installed wheel
run: |
python -m venv /tmp/circe-wheel-smoke
/tmp/circe-wheel-smoke/bin/pip install dist/*.whl
/tmp/circe-wheel-smoke/bin/circe --help
/tmp/circe-wheel-smoke/bin/python -c "import circe; print(circe.__version__)"
29 changes: 29 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Ruff

on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Ruff
run: pip install ruff

- name: Run Ruff linter
run: ruff check . --output-format=github

- name: Run Ruff formatter check
run: ruff format --check .

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,6 @@ examples/*.json
debug_app/.gemini_cache/
debug_app/user_overrides.json
debug_app/test_results.json

.test_baseline.json
.test_final.json
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.6
hooks:
- id: ruff-check
args: [--fix]
- id: ruff-format
2 changes: 0 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ formats:

python:
install:
- requirements: requirements.txt
- method: pip
path: .
extra_requirements:
- docs

74 changes: 22 additions & 52 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## [0.3.0] - 2026-07-10

### Added
- Experimental Ibis execution engine for building and writing cohorts as relational expressions (`build_cohort()`, `write_cohort()`)
- Support for snake_case YAML cohort definitions via `cohort_expression_from_yaml()`
- Persistent caching of concept set resolution in the IBIS execution layer
- `load_expression()` helper for loading cohort expressions from JSON, YAML, dict, or file paths

### Fixed
- ERA collapse ordering made deterministic across repeated executions
- Collapse tie handling aligned with Java CIRCE-BE semantics
- Era filter semantics restored with correct observation filtering
- Nested correlated criteria now correctly applied within criteria groups
- Package now importable without ibis installed
- Pydantic deprecation warnings resolved

### Changed
- Dropped Python 3.8 support (minimum version is now 3.9)
- Added PyYAML as a core dependency
- Added `ibis`, `ibis-duckdb`, `ibis-postgres`, and `ibis-databricks` optional dependency groups

## [0.2.0] - 2026-02-25

### Added
Expand All @@ -17,58 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.1.0] - 2026-01-23

### Added

- Initial Alpha Release of the CIRCE Python implementation.
- Full parity with OHDSI CIRCE-BE Java library for cohort definition and SQL generation.
- Expanded test suite with 3,400+ tests including parity checks.
- Comprehensive documentation and GitHub Actions release workflows.

## [Unreleased]

### Planned
- Performance optimizations for large cohort definitions
- Additional output formats (JSON schema, XML)
- Integration examples with common OMOP tools
---

### Features

- Support for Python 3.8, 3.9, 3.10, 3.11, and 3.12
- Full OMOP CDM v5.x compatibility
- Type hints throughout the codebase
- Concept set expression handling with include/exclude logic
- Window criteria for temporal relationships
- Correlated criteria for complex cohort logic
- Date adjustment strategies (DateOffsetStrategy)
- Custom era strategies for drug exposures
- Observation period and demographic criteria
- Inclusion rules and censoring criteria
- Result limits and ordinal expressions
- Comprehensive error messages and validation warnings
- Builder pattern for SQL generation
- Pydantic models for data validation and serialization

### Documentation

- Complete README with installation instructions
- Comprehensive CLI usage documentation
- Python API examples and quick start guide
- Contributing guidelines with development setup
- Java class mapping reference for interoperability
- Package structure documentation
- Troubleshooting and FAQ sections

### Technical Details

- Built with Pydantic v2.0+ for robust validation
- Uses typing-extensions for backward compatibility
- Modular architecture matching Java CIRCE-BE structure
- Extensive test coverage across all modules
- Black, isort, flake8, and mypy for code quality
- pytest with coverage reporting

### Known Limitations

- Negative control cohort classes yet implemented
- Documentation website under development
- Performance not yet optimized for extremely large cohorts (1000+ criteria)
- Comprehensive documentation and GitHub Actions release workflows.
37 changes: 37 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Claude Instructions for circepy

## Python Environment
- Always use virtualenv for Python operations (don't rely on system Python or unauthenticated pip installs)
- Activate the virtual environment before running Python commands or installing packages

## Starting tasks - record testing state

At the start of any task, record the state of tests as a baseline. It is not your job to fix pre-existing issues unless otherwise specified.

Run tests with multiprocess for speed and store the state:
```bash
pytest -n auto --tb=short -v --json-report --json-report-file=.test_baseline.json
```

If the test state file is not created, check that pytest-xdist and pytest-json-report are installed in the virtualenv.

## Pre-completion Checklist
Before completing any task:

1. Re-run pytest to verify no regressions:
```bash
pytest -n auto --tb=short -v --json-report --json-report-file=.test_final.json
```

Compare `.test_baseline.json` with `.test_final.json` — the final state should not show new failures.

2. Run git pre-commit checks:
```bash
git pre-commit run --all-files
```

If pre-commit checks fail, fix the issues and re-run until they pass.

## Git Workflow
- Do not run `git commit` — the user will handle commits
- Run pre-commit checks to validate code quality before marking tasks complete
39 changes: 23 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project follows the [OHDSI Code of Conduct](https://www.ohdsi.org/web/wiki/

### Prerequisites

- Python 3.8 or higher
- Python 3.9 or higher
- Git
- Basic understanding of the OMOP Common Data Model
- Familiarity with the Java CIRCE-BE implementation (recommended)
Expand All @@ -19,21 +19,27 @@ This project follows the [OHDSI Code of Conduct](https://www.ohdsi.org/web/wiki/

> [!NOTE]
> This is a private development repository. Ensure you have access before attempting to clone.
> The recommended contributor workflow uses `uv` and the checked-in `uv.lock` for a reproducible environment.

1. Clone the repository
```bash
git clone https://github.com/OHDSI/Circepy.git
cd Circepy
```

2. Install the package in development mode:
2. Create the development environment:
```bash
pip install -e ".[dev]"
uv sync --extra dev
```

3. Run tests to ensure everything is working:
3. Install Git hooks:
```bash
pytest
uv run pre-commit install
```

4. Run tests to ensure everything is working:
```bash
uv run pytest
```

## Development Guidelines
Expand All @@ -42,18 +48,15 @@ This project follows the [OHDSI Code of Conduct](https://www.ohdsi.org/web/wiki/

We use the following tools to maintain code quality:

- **Black** for code formatting
- **isort** for import sorting
- **flake8** for linting
- **mypy** for type checking
- **Ruff** for linting and formatting
- **pre-commit** for running repository hooks before commit

Run these tools before committing:

```bash
black circe/
isort circe/
flake8 circe/
mypy circe/
uv run ruff check .
uv run ruff format .
uv run pre-commit run --all-files
```

### Type Hints
Expand Down Expand Up @@ -95,6 +98,10 @@ class TestCohortExpression:
pass
```

## Use of AI Tools

Contributors may use AI tools to assist with development. If AI materially influenced a PR, please mention it in the PR description. Do not share secrets or sensitive data. Contributors remain responsible for correctness and license compliance.

## Pull Request Process

1. Create a feature branch from `main`:
Expand Down Expand Up @@ -217,8 +224,8 @@ We follow [Semantic Versioning](https://semver.org/):
- Update version in `pyproject.toml`
- Update version in `circe/__init__.py`
- Update `CHANGELOG.md` with release notes
- Ensure all tests pass: `pytest`
- Verify coverage is adequate: `pytest --cov`
- Ensure all tests pass: `uv run pytest`
- Verify coverage is adequate: `uv run pytest --cov`

2. **Build the Package**
```bash
Expand All @@ -238,7 +245,7 @@ We follow [Semantic Versioning](https://semver.org/):
twine upload --repository testpypi dist/*

# Test installation
pip install --index-url https://test.pypi.org/simple/ ohdsi-circepy
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ohdsi-circe-python-alpha
```

4. **Create Git Tag**
Expand Down
Loading
Loading