Skip to content

Commit ea3e32a

Browse files
committed
feat: upgrade to MedCAT 2.2 and update dependencies
1 parent 57a6ab6 commit ea3e32a

File tree

15 files changed

+180
-89
lines changed

15 files changed

+180
-89
lines changed

.github/workflows/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
- name: Install uv and set Python to ${{ matrix.python-version }}
2525
uses: astral-sh/setup-uv@v6
2626
with:
27-
version: "0.7.20"
27+
version: "0.8.10"
2828
python-version: ${{ matrix.python-version }}
2929
- name: Install dependencies
3030
run: |
31-
uv sync --group dev --group docs --group vllm
31+
uv sync --extra dev --extra docs --extra vllm
3232
uv run python -m ensurepip
3333
- name: Check types
3434
run: |

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
- name: Install uv
1818
uses: astral-sh/setup-uv@v5
1919
with:
20-
version: "0.6.10"
20+
version: "0.8.10"
2121
python-version: "3.10"
2222
- name: Install dependencies
2323
run: |
24-
uv sync --group dev --group docs --group vllm
24+
uv sync --extra dev --extra docs --extra vllm
2525
- name: Run unit tests
2626
run: |
2727
uv run pytest -v tests/app --cov --cov-report=html:coverage_reports #--random-order

app/model_services/medcat_model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ def batch_annotate(self, texts: List[str]) -> List[List[Annotation]]:
192192
texts,
193193
batch_size_chars=batch_size_chars,
194194
n_process=max(int(cpu_count() / 2), 1),
195-
# addl_info=["cui2icd10", "cui2ontologies", "cui2snomed", "cui2athena_ids"],
196195
))}
197196
docs = dict(sorted(docs.items(), key=lambda x: x[0]))
198197
annotations_list = []

app/model_services/medcat_model_opcs4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ def info(self) -> ModelCard:
5858
ModelCard: A card containing information about the MedCAT OPCS-4 model.
5959
"""
6060

61+
assert self.model is not None, "Model is not initialised"
6162
return ModelCard(
6263
model_description=self.model_name,
6364
model_type=ModelType.MEDCAT_OPCS4,
6465
api_version=self.api_version,
65-
model_card=self.model.get_model_card(as_dict=True),
66+
model_card=dict(self.model.get_model_card(as_dict=True)),
6667
)
6768

6869
def get_records_from_doc(self, doc: Dict) -> List[Dict]:

docker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ RUN addgroup --gid $CMS_GID cms || true && \
3030
COPY app /app
3131
COPY pyproject.toml /pyproject.toml
3232
COPY uv.lock /uv.lock
33+
COPY uv-requirements.txt /uv-requirements.txt
3334
COPY docker/entrypoint/serve.sh /app/entrypoint.sh
3435
RUN mkdir -p /app/model/model && \
3536
mkdir -p /app/model/retrained && \
3637
chown -R $CMS_UID:$CMS_GID /app
37-
RUN pip install --no-cache-dir uv==0.7.20 && \
38+
RUN pip install --require-hashes -r /uv-requirements.txt --no-cache-dir && \
39+
uv run --no-project python -m ensurepip && \
3840
uv sync --locked && \
3941
chown -R $CMS_UID:$CMS_GID /.venv && \
4042
chmod +x /app/entrypoint.sh
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
medcat~=1.14.1
2-
transformers~=4.43.0
3-
blis<1.0.0
4-
fastapi~=0.102.0
1+
medcat[spacy,meta-cat,deid,rel-cat]~=2.2.0
2+
datasets>=2.21.0
3+
fastapi~=0.115.0
54
uvicorn~=0.29.0
6-
python-multipart~=0.0.5
5+
python-multipart~=0.0.7
76
ijson~=3.1.4
87
python-dotenv~=0.20.0
98
mlflow~=2.16.2
109
psycopg2-binary~=2.9.4
1110
boto3~=1.28.84
12-
typer~=0.7.0
13-
prometheus-fastapi-instrumentator~=5.11.2
11+
click<8.2.0
12+
typer~=0.15.1
13+
prometheus-fastapi-instrumentator~=7.0.0
1414
sentencepiece~=0.2.0
15-
slowapi~=0.1.7
15+
slowapi~=0.1.
1616
graypy~=2.1.0
17-
fastapi-users~=11.0.0
17+
fastapi-users~=13.0.0
1818
fastapi-users-db-sqlalchemy~=5.0.0
1919
asyncpg~=0.27.0
2020
aiosqlite~=0.19.0
@@ -23,5 +23,6 @@ websockets~=12.0
2323
pynvml~=11.5.3
2424
toml~=0.10.2
2525
peft<0.14.0
26+
huggingface-hub~=0.33.0
2627
setuptools
2728
wheel
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
medcat~=1.14.1
2-
transformers~=4.43.0
3-
blis<1.0.0
4-
fastapi~=0.102.0
1+
medcat[spacy,meta-cat,deid,rel-cat]~=2.2.0
2+
datasets>=2.21.0
3+
fastapi~=0.115.0
54
uvicorn~=0.29.0
6-
python-multipart~=0.0.5
5+
python-multipart~=0.0.7
76
ijson~=3.1.4
87
python-dotenv~=0.20.0
98
mlflow~=2.16.2
109
psycopg2-binary~=2.9.4
1110
boto3~=1.28.84
12-
typer~=0.7.0
13-
prometheus-fastapi-instrumentator~=5.11.2
11+
click<8.2.0
12+
typer~=0.15.1
13+
prometheus-fastapi-instrumentator~=7.0.0
1414
sentencepiece~=0.2.0
15-
slowapi~=0.1.7
15+
slowapi~=0.1.
1616
graypy~=2.1.0
17-
fastapi-users~=11.0.0
17+
fastapi-users~=13.0.0
1818
fastapi-users-db-sqlalchemy~=5.0.0
1919
asyncpg~=0.27.0
2020
aiosqlite~=0.19.0
@@ -23,5 +23,6 @@ websockets~=12.0
2323
pynvml~=11.5.3
2424
toml~=0.10.2
2525
peft<0.14.0
26+
huggingface-hub~=0.33.0
2627
setuptools
2728
wheel
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
medcat~=1.14.1
2-
transformers~=4.43.0
3-
blis<1.0.0
4-
fastapi~=0.102.0
1+
medcat[spacy,meta-cat,deid,rel-cat]~=2.2.0
2+
datasets>=2.21.0
3+
fastapi~=0.115.0
54
uvicorn~=0.29.0
6-
python-multipart~=0.0.5
5+
python-multipart~=0.0.7
76
ijson~=3.1.4
87
python-dotenv~=0.20.0
98
mlflow~=2.16.2
109
psycopg2-binary~=2.9.4
1110
boto3~=1.28.84
12-
typer~=0.7.0
13-
prometheus-fastapi-instrumentator~=5.11.2
11+
click<8.2.0
12+
typer~=0.15.1
13+
prometheus-fastapi-instrumentator~=7.0.0
1414
sentencepiece~=0.2.0
15-
slowapi~=0.1.7
15+
slowapi~=0.1.
1616
graypy~=2.1.0
17-
fastapi-users~=11.0.0
17+
fastapi-users~=13.0.0
1818
fastapi-users-db-sqlalchemy~=5.0.0
1919
asyncpg~=0.27.0
2020
aiosqlite~=0.19.0
@@ -23,5 +23,6 @@ websockets~=12.0
2323
pynvml~=11.5.3
2424
toml~=0.10.2
2525
peft<0.14.0
26+
huggingface-hub~=0.33.0
2627
setuptools
2728
wheel
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
medcat~=1.14.1
2-
transformers~=4.43.0
3-
blis<1.0.0
4-
fastapi~=0.102.0
1+
medcat[spacy,meta-cat,deid,rel-cat]~=2.2.0
2+
datasets>=2.21.0
3+
fastapi~=0.115.0
54
uvicorn~=0.29.0
6-
python-multipart~=0.0.5
5+
python-multipart~=0.0.7
76
ijson~=3.1.4
87
python-dotenv~=0.20.0
98
mlflow~=2.16.2
109
psycopg2-binary~=2.9.4
1110
boto3~=1.28.84
12-
typer~=0.7.0
13-
prometheus-fastapi-instrumentator~=5.11.2
11+
click<8.2.0
12+
typer~=0.15.1
13+
prometheus-fastapi-instrumentator~=7.0.0
1414
sentencepiece~=0.2.0
15-
slowapi~=0.1.7
15+
slowapi~=0.1.
1616
graypy~=2.1.0
17-
fastapi-users~=11.0.0
17+
fastapi-users~=13.0.0
1818
fastapi-users-db-sqlalchemy~=5.0.0
1919
asyncpg~=0.27.0
2020
aiosqlite~=0.19.0
@@ -23,5 +23,6 @@ websockets~=12.0
2323
pynvml~=11.5.3
2424
toml~=0.10.2
2525
peft<0.14.0
26+
huggingface-hub~=0.33.0
2627
setuptools
2728
wheel
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
medcat~=1.14.1
2-
transformers~=4.43.0
3-
blis<1.0.0
4-
fastapi~=0.102.0
1+
medcat[spacy,meta-cat,deid,rel-cat]~=2.2.0
2+
datasets>=2.21.0
3+
fastapi~=0.115.0
54
uvicorn~=0.29.0
6-
python-multipart~=0.0.5
5+
python-multipart~=0.0.7
76
ijson~=3.1.4
87
python-dotenv~=0.20.0
98
mlflow~=2.16.2
109
psycopg2-binary~=2.9.4
1110
boto3~=1.28.84
12-
typer~=0.7.0
13-
prometheus-fastapi-instrumentator~=5.11.2
11+
click<8.2.0
12+
typer~=0.15.1
13+
prometheus-fastapi-instrumentator~=7.0.0
1414
sentencepiece~=0.2.0
15-
slowapi~=0.1.7
15+
slowapi~=0.1.
1616
graypy~=2.1.0
17-
fastapi-users~=11.0.0
17+
fastapi-users~=13.0.0
1818
fastapi-users-db-sqlalchemy~=5.0.0
1919
asyncpg~=0.27.0
2020
aiosqlite~=0.19.0
@@ -23,5 +23,6 @@ websockets~=12.0
2323
pynvml~=11.5.3
2424
toml~=0.10.2
2525
peft<0.14.0
26+
huggingface-hub~=0.33.0
2627
setuptools
2728
wheel

0 commit comments

Comments
 (0)