medcheck 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- medcheck-0.1.0/.dockerignore +12 -0
- medcheck-0.1.0/.env.example +14 -0
- medcheck-0.1.0/.github/CODEOWNERS +1 -0
- medcheck-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
- medcheck-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +64 -0
- medcheck-0.1.0/.github/dependabot.yml +10 -0
- medcheck-0.1.0/.github/pull_request_template.md +28 -0
- medcheck-0.1.0/.github/workflows/ci.yml +57 -0
- medcheck-0.1.0/.github/workflows/codeql.yml +19 -0
- medcheck-0.1.0/.gitignore +67 -0
- medcheck-0.1.0/.pre-commit-config.yaml +32 -0
- medcheck-0.1.0/.python-version +1 -0
- medcheck-0.1.0/CHANGELOG.md +29 -0
- medcheck-0.1.0/CODE_OF_CONDUCT.md +15 -0
- medcheck-0.1.0/CONTRIBUTING.md +265 -0
- medcheck-0.1.0/Dockerfile +26 -0
- medcheck-0.1.0/LICENSE +195 -0
- medcheck-0.1.0/PKG-INFO +275 -0
- medcheck-0.1.0/README.md +230 -0
- medcheck-0.1.0/SECURITY.md +50 -0
- medcheck-0.1.0/docker-compose.yml +11 -0
- medcheck-0.1.0/docs/models.md +74 -0
- medcheck-0.1.0/docs/providers.md +82 -0
- medcheck-0.1.0/docs/quickstart.md +67 -0
- medcheck-0.1.0/docs/workflows.md +140 -0
- medcheck-0.1.0/pyproject.toml +105 -0
- medcheck-0.1.0/src/medcheck/__init__.py +3 -0
- medcheck-0.1.0/src/medcheck/core/__init__.py +1 -0
- medcheck-0.1.0/src/medcheck/core/config.py +28 -0
- medcheck-0.1.0/src/medcheck/core/context.py +90 -0
- medcheck-0.1.0/src/medcheck/core/step.py +17 -0
- medcheck-0.1.0/src/medcheck/core/workflow.py +117 -0
- medcheck-0.1.0/src/medcheck/llm/__init__.py +1 -0
- medcheck-0.1.0/src/medcheck/llm/base.py +74 -0
- medcheck-0.1.0/src/medcheck/llm/claude.py +61 -0
- medcheck-0.1.0/src/medcheck/llm/gemini.py +46 -0
- medcheck-0.1.0/src/medcheck/llm/openai_provider.py +57 -0
- medcheck-0.1.0/src/medcheck/llm/router.py +43 -0
- medcheck-0.1.0/src/medcheck/main.py +173 -0
- medcheck-0.1.0/src/medcheck/models/__init__.py +1 -0
- medcheck-0.1.0/src/medcheck/pipeline/__init__.py +1 -0
- medcheck-0.1.0/src/medcheck/pipeline/ingest.py +66 -0
- medcheck-0.1.0/src/medcheck/pipeline/ml_analysis.py +143 -0
- medcheck-0.1.0/src/medcheck/pipeline/preprocess.py +129 -0
- medcheck-0.1.0/src/medcheck/pipeline/report.py +325 -0
- medcheck-0.1.0/src/medcheck/pipeline/vision_analysis.py +225 -0
- medcheck-0.1.0/src/medcheck/prompts/anatomy/knee.txt +44 -0
- medcheck-0.1.0/src/medcheck/prompts/anatomy/shoulder.txt +9 -0
- medcheck-0.1.0/src/medcheck/prompts/anatomy/spine.txt +9 -0
- medcheck-0.1.0/src/medcheck/prompts/report_schema.json +39 -0
- medcheck-0.1.0/src/medcheck/prompts/system.txt +19 -0
- medcheck-0.1.0/src/medcheck/providers/__init__.py +1 -0
- medcheck-0.1.0/src/medcheck/providers/base.py +17 -0
- medcheck-0.1.0/src/medcheck/providers/easyradiology.py +116 -0
- medcheck-0.1.0/src/medcheck/providers/local.py +96 -0
- medcheck-0.1.0/src/medcheck/providers/registry.py +46 -0
- medcheck-0.1.0/src/medcheck/py.typed +0 -0
- medcheck-0.1.0/src/medcheck/web/app.py +39 -0
- medcheck-0.1.0/src/medcheck/web/static/.gitkeep +0 -0
- medcheck-0.1.0/src/medcheck/web/templates/index.html +726 -0
- medcheck-0.1.0/tests/__init__.py +1 -0
- medcheck-0.1.0/tests/conftest.py +21 -0
- medcheck-0.1.0/tests/integration/__init__.py +1 -0
- medcheck-0.1.0/tests/unit/__init__.py +1 -0
- medcheck-0.1.0/tests/unit/test_cli.py +18 -0
- medcheck-0.1.0/tests/unit/test_core/__init__.py +0 -0
- medcheck-0.1.0/tests/unit/test_core/test_config.py +35 -0
- medcheck-0.1.0/tests/unit/test_core/test_context.py +34 -0
- medcheck-0.1.0/tests/unit/test_core/test_step.py +23 -0
- medcheck-0.1.0/tests/unit/test_core/test_workflow.py +57 -0
- medcheck-0.1.0/tests/unit/test_llm/__init__.py +0 -0
- medcheck-0.1.0/tests/unit/test_llm/test_router.py +53 -0
- medcheck-0.1.0/tests/unit/test_pipeline/__init__.py +0 -0
- medcheck-0.1.0/tests/unit/test_pipeline/test_ingest.py +67 -0
- medcheck-0.1.0/tests/unit/test_pipeline/test_ml_analysis.py +59 -0
- medcheck-0.1.0/tests/unit/test_pipeline/test_preprocess.py +77 -0
- medcheck-0.1.0/tests/unit/test_pipeline/test_report.py +70 -0
- medcheck-0.1.0/tests/unit/test_pipeline/test_vision_analysis.py +72 -0
- medcheck-0.1.0/tests/unit/test_providers/__init__.py +0 -0
- medcheck-0.1.0/tests/unit/test_providers/test_easyradiology.py +57 -0
- medcheck-0.1.0/tests/unit/test_providers/test_local.py +73 -0
- medcheck-0.1.0/tests/unit/test_providers/test_registry.py +31 -0
- medcheck-0.1.0/tests/unit/test_web.py +19 -0
- medcheck-0.1.0/workflows/default.yml +9 -0
- medcheck-0.1.0/workflows/quick.yml +8 -0
- medcheck-0.1.0/workflows/vision_only.yml +8 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# AI Provider API Keys
|
|
2
|
+
ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
|
3
|
+
OPENAI_API_KEY=your_openai_api_key_here
|
|
4
|
+
GOOGLE_API_KEY=your_google_api_key_here
|
|
5
|
+
|
|
6
|
+
# Server Configuration
|
|
7
|
+
MEDCHECK_HOST=127.0.0.1
|
|
8
|
+
MEDCHECK_PORT=8000
|
|
9
|
+
|
|
10
|
+
# LLM Provider Selection (anthropic | openai | google)
|
|
11
|
+
MEDCHECK_LLM_PROVIDER=anthropic
|
|
12
|
+
|
|
13
|
+
# Language / Locale
|
|
14
|
+
MEDCHECK_LANGUAGE=en
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @Liohtml
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug or unexpected behavior in MedCheck
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["bug", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to fill out this bug report! Please provide as much detail as possible.
|
|
10
|
+
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: description
|
|
13
|
+
attributes:
|
|
14
|
+
label: Description
|
|
15
|
+
description: A clear and concise description of what the bug is.
|
|
16
|
+
placeholder: What happened? What did you expect to happen?
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: steps
|
|
22
|
+
attributes:
|
|
23
|
+
label: Steps to Reproduce
|
|
24
|
+
description: Step-by-step instructions to reproduce the issue.
|
|
25
|
+
placeholder: |
|
|
26
|
+
1. Run `medcheck ...`
|
|
27
|
+
2. Provide input `...`
|
|
28
|
+
3. Observe error `...`
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
|
|
32
|
+
- type: input
|
|
33
|
+
id: version
|
|
34
|
+
attributes:
|
|
35
|
+
label: Version
|
|
36
|
+
description: What version of MedCheck are you using? Run `medcheck --version` or check `pyproject.toml`.
|
|
37
|
+
placeholder: "e.g., 0.1.0"
|
|
38
|
+
validations:
|
|
39
|
+
required: true
|
|
40
|
+
|
|
41
|
+
- type: dropdown
|
|
42
|
+
id: installation
|
|
43
|
+
attributes:
|
|
44
|
+
label: Installation Method
|
|
45
|
+
description: How did you install MedCheck?
|
|
46
|
+
options:
|
|
47
|
+
- pip install medcheck
|
|
48
|
+
- uv add medcheck
|
|
49
|
+
- uv sync (from source)
|
|
50
|
+
- poetry add medcheck
|
|
51
|
+
- Other (describe in logs section)
|
|
52
|
+
validations:
|
|
53
|
+
required: true
|
|
54
|
+
|
|
55
|
+
- type: textarea
|
|
56
|
+
id: logs
|
|
57
|
+
attributes:
|
|
58
|
+
label: Relevant Logs / Stack Trace
|
|
59
|
+
description: Paste any error messages, stack traces, or log output here.
|
|
60
|
+
render: shell
|
|
61
|
+
placeholder: |
|
|
62
|
+
Traceback (most recent call last):
|
|
63
|
+
...
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or enhancement for MedCheck
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for suggesting an improvement! Please describe your idea clearly so we can evaluate it.
|
|
10
|
+
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: problem
|
|
13
|
+
attributes:
|
|
14
|
+
label: Problem Statement
|
|
15
|
+
description: What problem does this feature solve? Is your request related to a specific frustration?
|
|
16
|
+
placeholder: "I'm always frustrated when... / I can't currently do..."
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: solution
|
|
22
|
+
attributes:
|
|
23
|
+
label: Proposed Solution
|
|
24
|
+
description: Describe the feature you'd like to see. Include any relevant API design ideas or examples.
|
|
25
|
+
placeholder: |
|
|
26
|
+
I would like MedCheck to support...
|
|
27
|
+
|
|
28
|
+
Example usage:
|
|
29
|
+
```python
|
|
30
|
+
medcheck.add_provider(...)
|
|
31
|
+
```
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
34
|
+
|
|
35
|
+
- type: dropdown
|
|
36
|
+
id: area
|
|
37
|
+
attributes:
|
|
38
|
+
label: Area
|
|
39
|
+
description: Which part of MedCheck does this feature relate to?
|
|
40
|
+
options:
|
|
41
|
+
- Data Provider (new source integration)
|
|
42
|
+
- LLM Provider (new model integration)
|
|
43
|
+
- Pipeline / Orchestration
|
|
44
|
+
- CLI / Interface
|
|
45
|
+
- Output / Formatting
|
|
46
|
+
- Configuration
|
|
47
|
+
- Documentation
|
|
48
|
+
- Testing / CI
|
|
49
|
+
- Other
|
|
50
|
+
validations:
|
|
51
|
+
required: true
|
|
52
|
+
|
|
53
|
+
- type: textarea
|
|
54
|
+
id: alternatives
|
|
55
|
+
attributes:
|
|
56
|
+
label: Alternatives Considered
|
|
57
|
+
description: Have you considered any workarounds or alternative approaches?
|
|
58
|
+
placeholder: I tried... but it doesn't work because...
|
|
59
|
+
|
|
60
|
+
- type: textarea
|
|
61
|
+
id: context
|
|
62
|
+
attributes:
|
|
63
|
+
label: Additional Context
|
|
64
|
+
description: Any other context, screenshots, or references that might be helpful.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- Briefly describe what this PR does and why. Link the related issue: "Fixes #123" or "Closes #456" -->
|
|
4
|
+
|
|
5
|
+
Fixes #
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
|
|
9
|
+
<!-- List the key changes made in this PR -->
|
|
10
|
+
|
|
11
|
+
-
|
|
12
|
+
-
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
## Testing
|
|
16
|
+
|
|
17
|
+
<!-- Describe how you tested your changes -->
|
|
18
|
+
|
|
19
|
+
- [ ] Existing tests pass (`uv run pytest`)
|
|
20
|
+
- [ ] New tests added for new functionality
|
|
21
|
+
- [ ] Coverage does not decrease (`uv run pytest --cov-fail-under=85`)
|
|
22
|
+
- [ ] Linting passes (`uv run ruff check .`)
|
|
23
|
+
- [ ] Type checking passes (`uv run mypy src/medcheck --strict`)
|
|
24
|
+
- [ ] Pre-commit hooks pass (`pre-commit run --all-files`)
|
|
25
|
+
|
|
26
|
+
## Additional Notes
|
|
27
|
+
|
|
28
|
+
<!-- Anything else reviewers should know? Breaking changes? Deployment considerations? -->
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
lint:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
- uses: astral-sh/setup-uv@v7
|
|
19
|
+
- run: uv sync --all-extras
|
|
20
|
+
- run: uv run ruff check src/ tests/
|
|
21
|
+
- run: uv run ruff format --check src/ tests/
|
|
22
|
+
|
|
23
|
+
type-check:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v6
|
|
27
|
+
- uses: astral-sh/setup-uv@v7
|
|
28
|
+
- run: uv sync --all-extras
|
|
29
|
+
- run: uv run mypy src/medcheck
|
|
30
|
+
|
|
31
|
+
security:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v6
|
|
35
|
+
- uses: astral-sh/setup-uv@v7
|
|
36
|
+
- run: uv sync --all-extras
|
|
37
|
+
- run: uv run bandit -r src/medcheck -ll -q
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
runs-on: ${{ matrix.os }}
|
|
41
|
+
strategy:
|
|
42
|
+
fail-fast: false
|
|
43
|
+
matrix:
|
|
44
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
45
|
+
python-version: ["3.10", "3.12", "3.13"]
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v6
|
|
48
|
+
- uses: astral-sh/setup-uv@v7
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ matrix.python-version }}
|
|
51
|
+
- run: uv sync --all-extras
|
|
52
|
+
- run: uv run pytest tests/ --cov=medcheck --cov-report=xml --cov-fail-under=55
|
|
53
|
+
- uses: codecov/codecov-action@v6
|
|
54
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
|
|
55
|
+
with:
|
|
56
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
57
|
+
file: ./coverage.xml
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: "0 2 * * 1"
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
analyze:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
security-events: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
- uses: github/codeql-action/init@v4
|
|
17
|
+
with:
|
|
18
|
+
languages: python
|
|
19
|
+
- uses: github/codeql-action/analyze@v4
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
eggs/
|
|
11
|
+
.eggs/
|
|
12
|
+
|
|
13
|
+
# Virtual environments
|
|
14
|
+
.venv/
|
|
15
|
+
venv/
|
|
16
|
+
env/
|
|
17
|
+
ENV/
|
|
18
|
+
|
|
19
|
+
# Environment variables
|
|
20
|
+
.env
|
|
21
|
+
.env.*
|
|
22
|
+
!.env.example
|
|
23
|
+
|
|
24
|
+
# Type checking
|
|
25
|
+
.mypy_cache/
|
|
26
|
+
.dmypy.json
|
|
27
|
+
dmypy.json
|
|
28
|
+
|
|
29
|
+
# Testing
|
|
30
|
+
.pytest_cache/
|
|
31
|
+
.coverage
|
|
32
|
+
coverage.xml
|
|
33
|
+
htmlcov/
|
|
34
|
+
.tox/
|
|
35
|
+
|
|
36
|
+
# DICOM and medical imaging files
|
|
37
|
+
*.dcm
|
|
38
|
+
*.dicom
|
|
39
|
+
*.zip
|
|
40
|
+
*.npy
|
|
41
|
+
*.pt
|
|
42
|
+
*.pth
|
|
43
|
+
|
|
44
|
+
# Model cache
|
|
45
|
+
models_cache/
|
|
46
|
+
.cache/
|
|
47
|
+
|
|
48
|
+
# Distribution / packaging
|
|
49
|
+
*.tar.gz
|
|
50
|
+
*.whl
|
|
51
|
+
MANIFEST
|
|
52
|
+
|
|
53
|
+
# IDE
|
|
54
|
+
.vscode/
|
|
55
|
+
.idea/
|
|
56
|
+
*.swp
|
|
57
|
+
*.swo
|
|
58
|
+
.DS_Store
|
|
59
|
+
Thumbs.db
|
|
60
|
+
|
|
61
|
+
# Logs
|
|
62
|
+
*.log
|
|
63
|
+
logs/
|
|
64
|
+
|
|
65
|
+
# uv
|
|
66
|
+
.uv/
|
|
67
|
+
uv.lock
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-yaml
|
|
6
|
+
- id: check-toml
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
- id: no-commit-to-branch
|
|
10
|
+
args: [--branch, main]
|
|
11
|
+
- id: check-added-large-files
|
|
12
|
+
args: [--maxkb=500]
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/codespell-project/codespell
|
|
15
|
+
rev: v2.4.1
|
|
16
|
+
hooks:
|
|
17
|
+
- id: codespell
|
|
18
|
+
exclude: "(uv.lock)"
|
|
19
|
+
|
|
20
|
+
- repo: local
|
|
21
|
+
hooks:
|
|
22
|
+
- id: ruff-format
|
|
23
|
+
name: ruff format
|
|
24
|
+
language: system
|
|
25
|
+
entry: uv run ruff format
|
|
26
|
+
types: [python]
|
|
27
|
+
|
|
28
|
+
- id: ruff-lint
|
|
29
|
+
name: ruff lint
|
|
30
|
+
language: system
|
|
31
|
+
entry: uv run ruff check --fix
|
|
32
|
+
types: [python]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial project scaffold with `src/medcheck` package structure
|
|
12
|
+
- Core provider abstraction (`DataProvider` base class)
|
|
13
|
+
- Core LLM provider abstraction (`LLMProvider` base class)
|
|
14
|
+
- `pyproject.toml` with uv-managed dependencies
|
|
15
|
+
- Pre-commit hooks (ruff, mypy)
|
|
16
|
+
- GitHub Actions CI workflow
|
|
17
|
+
- Community files: CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, issue templates
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
### Deprecated
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
### Security
|
|
28
|
+
|
|
29
|
+
[Unreleased]: https://github.com/Liohtml/MedCheck/compare/HEAD...HEAD
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This project follows the [Contributor Covenant v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
4
|
+
|
|
5
|
+
## Our Pledge
|
|
6
|
+
|
|
7
|
+
We are committed to providing a friendly, safe and welcoming environment for all contributors regardless of background or identity.
|
|
8
|
+
|
|
9
|
+
## Enforcement
|
|
10
|
+
|
|
11
|
+
Instances of unacceptable behavior may be reported via [GitHub Issues](https://github.com/Liohtml/MedCheck/issues) or by contacting the maintainers directly.
|
|
12
|
+
|
|
13
|
+
## Attribution
|
|
14
|
+
|
|
15
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org).
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Contributing to MedCheck
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to MedCheck! We welcome contributions of all kinds, from bug reports and feature requests to code changes and documentation improvements.
|
|
4
|
+
|
|
5
|
+
## Ways to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Bugs
|
|
8
|
+
Found a bug? We appreciate detailed bug reports. Please use our bug report template when opening an issue.
|
|
9
|
+
|
|
10
|
+
### Requesting Features
|
|
11
|
+
Have an idea for a new feature? Share it with us using the feature request template. We especially encourage:
|
|
12
|
+
- Requests for new data providers
|
|
13
|
+
- Suggestions for new LLM providers
|
|
14
|
+
- Pipeline improvements and enhancements
|
|
15
|
+
|
|
16
|
+
### Submitting Pull Requests
|
|
17
|
+
Code contributions are welcome! Whether it's a bug fix, feature implementation, or documentation update, we're happy to review your work.
|
|
18
|
+
|
|
19
|
+
### Improving Documentation
|
|
20
|
+
Help us make MedCheck better documented. You can:
|
|
21
|
+
- Fix typos or clarify existing documentation
|
|
22
|
+
- Add examples and usage guides
|
|
23
|
+
- Improve API documentation
|
|
24
|
+
|
|
25
|
+
## Before You Start
|
|
26
|
+
|
|
27
|
+
**Please open an issue first** to discuss your proposed changes with the maintainers. This helps us avoid duplicate work and ensures your changes align with the project's direction.
|
|
28
|
+
|
|
29
|
+
For small changes (typo fixes, minor documentation updates), you can skip this and go straight to a PR.
|
|
30
|
+
|
|
31
|
+
## Development Setup
|
|
32
|
+
|
|
33
|
+
### Prerequisites
|
|
34
|
+
- Python 3.11+
|
|
35
|
+
- Git
|
|
36
|
+
- [uv](https://github.com/astral-sh/uv) package manager
|
|
37
|
+
|
|
38
|
+
### Getting Started
|
|
39
|
+
|
|
40
|
+
1. Fork the repository on GitHub
|
|
41
|
+
2. Clone your fork:
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/YOUR_USERNAME/MedCheck.git
|
|
44
|
+
cd MedCheck
|
|
45
|
+
```
|
|
46
|
+
3. Install dependencies:
|
|
47
|
+
```bash
|
|
48
|
+
uv sync --all-extras
|
|
49
|
+
```
|
|
50
|
+
4. Install pre-commit hooks:
|
|
51
|
+
```bash
|
|
52
|
+
pre-commit install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Code Standards
|
|
56
|
+
|
|
57
|
+
We maintain high code quality standards to ensure maintainability and reliability.
|
|
58
|
+
|
|
59
|
+
### Line Length
|
|
60
|
+
- Maximum 120 characters per line (enforced by Ruff)
|
|
61
|
+
|
|
62
|
+
### Type Hints
|
|
63
|
+
- Type hints are **required** for all public functions and methods
|
|
64
|
+
- Use `from typing import ...` or `from collections.abc import ...` for type annotations
|
|
65
|
+
- Return types must be specified
|
|
66
|
+
|
|
67
|
+
### Docstrings
|
|
68
|
+
- Google-style docstrings are required for all public functions, classes, and modules
|
|
69
|
+
- Include brief description, Args, Returns, and Raises sections
|
|
70
|
+
- Example:
|
|
71
|
+
```python
|
|
72
|
+
def fetch_data(provider: str, query: str) -> dict:
|
|
73
|
+
"""Fetch medical data from the specified provider.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
provider: Name of the data provider
|
|
77
|
+
query: Search query for the data
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Dictionary containing the fetched data
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
ValueError: If provider is not supported
|
|
84
|
+
"""
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Linting and Type Checking
|
|
88
|
+
- Ruff is used for code formatting and linting:
|
|
89
|
+
```bash
|
|
90
|
+
uv run ruff check .
|
|
91
|
+
uv run ruff format .
|
|
92
|
+
```
|
|
93
|
+
- MyPy is used for static type checking in strict mode:
|
|
94
|
+
```bash
|
|
95
|
+
uv run mypy src/medcheck --strict
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Testing
|
|
99
|
+
|
|
100
|
+
Tests are required for all new features and bug fixes.
|
|
101
|
+
|
|
102
|
+
### Running Tests
|
|
103
|
+
```bash
|
|
104
|
+
# Run all tests
|
|
105
|
+
uv run pytest
|
|
106
|
+
|
|
107
|
+
# Run with coverage
|
|
108
|
+
uv run pytest --cov=src/medcheck --cov-report=html
|
|
109
|
+
|
|
110
|
+
# Run specific test file
|
|
111
|
+
uv run pytest tests/test_providers.py
|
|
112
|
+
|
|
113
|
+
# Run tests matching a pattern
|
|
114
|
+
uv run pytest -k "test_llm"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Coverage Requirements
|
|
118
|
+
- Minimum coverage is 85% (`--cov-fail-under=85`)
|
|
119
|
+
- All new code must be covered by tests
|
|
120
|
+
- Aim for meaningful tests, not just coverage targets
|
|
121
|
+
|
|
122
|
+
## PR Process
|
|
123
|
+
|
|
124
|
+
### Before Submitting
|
|
125
|
+
1. Create a feature branch from `main`:
|
|
126
|
+
```bash
|
|
127
|
+
git checkout -b feat/my-feature
|
|
128
|
+
```
|
|
129
|
+
2. Make your changes and commit them (see commit message format below)
|
|
130
|
+
3. Ensure all tests pass:
|
|
131
|
+
```bash
|
|
132
|
+
uv run pytest
|
|
133
|
+
```
|
|
134
|
+
4. Ensure linting passes:
|
|
135
|
+
```bash
|
|
136
|
+
uv run ruff check .
|
|
137
|
+
```
|
|
138
|
+
5. Ensure type checking passes:
|
|
139
|
+
```bash
|
|
140
|
+
uv run mypy src/medcheck --strict
|
|
141
|
+
```
|
|
142
|
+
6. Push to your fork and open a pull request
|
|
143
|
+
|
|
144
|
+
### Commit Message Format
|
|
145
|
+
Use conventional commit format:
|
|
146
|
+
- `feat:` - A new feature
|
|
147
|
+
- `fix:` - A bug fix
|
|
148
|
+
- `docs:` - Documentation changes
|
|
149
|
+
- `refactor:` - Code refactoring without behavior changes
|
|
150
|
+
- `test:` - Adding or updating tests
|
|
151
|
+
- `chore:` - Build, CI, or dependency updates
|
|
152
|
+
|
|
153
|
+
Example: `feat: add support for FHIR data provider`
|
|
154
|
+
|
|
155
|
+
### Pull Request Requirements
|
|
156
|
+
- Link related issues: "Fixes #123" or "Closes #456"
|
|
157
|
+
- Clear description of changes
|
|
158
|
+
- At least one maintainer review is required
|
|
159
|
+
- All CI checks must pass
|
|
160
|
+
- Code coverage must not decrease
|
|
161
|
+
|
|
162
|
+
## Adding a New Data Provider
|
|
163
|
+
|
|
164
|
+
To add a new data provider for medical data sources:
|
|
165
|
+
|
|
166
|
+
1. Create a new file in `src/medcheck/providers/`:
|
|
167
|
+
```python
|
|
168
|
+
# src/medcheck/providers/my_provider.py
|
|
169
|
+
from medcheck.providers.base import DataProvider
|
|
170
|
+
|
|
171
|
+
class MyDataProvider(DataProvider):
|
|
172
|
+
"""Provider for my medical data source."""
|
|
173
|
+
|
|
174
|
+
name = "my_provider"
|
|
175
|
+
|
|
176
|
+
async def fetch(self, query: str) -> dict:
|
|
177
|
+
"""Fetch data from the provider."""
|
|
178
|
+
pass
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
2. Implement the `DataProvider` interface:
|
|
182
|
+
- Implement required abstract methods
|
|
183
|
+
- Add proper error handling
|
|
184
|
+
- Include rate limiting if needed
|
|
185
|
+
|
|
186
|
+
3. Register URL patterns in the router:
|
|
187
|
+
```python
|
|
188
|
+
# src/medcheck/providers/__init__.py
|
|
189
|
+
url_patterns = [
|
|
190
|
+
# ... existing patterns
|
|
191
|
+
("my-provider", MyDataProvider),
|
|
192
|
+
]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
4. Add comprehensive tests:
|
|
196
|
+
```python
|
|
197
|
+
# tests/test_providers/test_my_provider.py
|
|
198
|
+
import pytest
|
|
199
|
+
from medcheck.providers.my_provider import MyDataProvider
|
|
200
|
+
|
|
201
|
+
@pytest.mark.asyncio
|
|
202
|
+
async def test_fetch():
|
|
203
|
+
provider = MyDataProvider()
|
|
204
|
+
result = await provider.fetch("test query")
|
|
205
|
+
assert result is not None
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Adding a New LLM Provider
|
|
209
|
+
|
|
210
|
+
To add a new LLM provider for language model integration:
|
|
211
|
+
|
|
212
|
+
1. Create a new file in `src/medcheck/llm/`:
|
|
213
|
+
```python
|
|
214
|
+
# src/medcheck/llm/my_llm.py
|
|
215
|
+
from medcheck.llm.base import LLMProvider
|
|
216
|
+
|
|
217
|
+
class MyLLMProvider(LLMProvider):
|
|
218
|
+
"""LLM provider for my model."""
|
|
219
|
+
|
|
220
|
+
name = "my_llm"
|
|
221
|
+
|
|
222
|
+
async def generate(self, prompt: str) -> str:
|
|
223
|
+
"""Generate response from the LLM."""
|
|
224
|
+
pass
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
2. Implement the `LLMProvider` interface:
|
|
228
|
+
- Implement required abstract methods
|
|
229
|
+
- Add proper error handling and retries
|
|
230
|
+
- Implement streaming if supported
|
|
231
|
+
|
|
232
|
+
3. Add environment variable for API key:
|
|
233
|
+
```python
|
|
234
|
+
import os
|
|
235
|
+
api_key = os.getenv("MY_LLM_API_KEY")
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
4. Register the provider:
|
|
239
|
+
```python
|
|
240
|
+
# src/medcheck/llm/__init__.py
|
|
241
|
+
from medcheck.llm.my_llm import MyLLMProvider
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
5. Add comprehensive tests:
|
|
245
|
+
```python
|
|
246
|
+
# tests/test_llm/test_my_llm.py
|
|
247
|
+
import pytest
|
|
248
|
+
from medcheck.llm.my_llm import MyLLMProvider
|
|
249
|
+
|
|
250
|
+
@pytest.mark.asyncio
|
|
251
|
+
async def test_generate():
|
|
252
|
+
provider = MyLLMProvider()
|
|
253
|
+
response = await provider.generate("test prompt")
|
|
254
|
+
assert response is not None
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
By contributing to MedCheck, you agree that your contributions will be licensed under the Apache License 2.0. See the LICENSE file for details.
|
|
260
|
+
|
|
261
|
+
## Questions?
|
|
262
|
+
|
|
263
|
+
If you have questions about contributing, feel free to open an issue or reach out to the maintainers. We're here to help!
|
|
264
|
+
|
|
265
|
+
Happy coding!
|