Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit d30278d

Browse files
author
Tom Searle
committed
CU-8699wjhfu: add client docs to docs site
1 parent af516f8 commit d30278d

File tree

2 files changed

+90
-1
lines changed

2 files changed

+90
-1
lines changed

docs/client.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
---
3+
4+
# MedCATtrainer Client
5+
6+
A Python client for interacting with a MedCATTrainer web application instance. This package allows you to manage datasets, concept databases, vocabularies, model packs, users, projects, and more via Python code or the command line.
7+
8+
## Features
9+
10+
- Manage datasets, concept databases, vocabularies, and model packs
11+
- Create and manage users and projects
12+
- Retrieve and upload project annotations
13+
- Command-line interface (CLI) for automation
14+
15+
## Installation
16+
17+
```sh
18+
pip install mctclient
19+
```
20+
21+
Or, if installing from source:
22+
23+
```sh
24+
cd client
25+
python -m build
26+
pip install dist/*.whl
27+
```
28+
29+
## Python Usage
30+
31+
```sh
32+
export MCTRAINER_USERNAME=<username>
33+
export MCTRAINER_PASSWORD=<password>
34+
```
35+
36+
```python
37+
from mctclient import MedCATTrainerSession, MCTDataset, MCTConceptDB, MCTVocab, MCTModelPack, MCTMetaTask, MCTRelTask, MCTUser, MCTProject
38+
39+
# Connect to your MedCATTrainer instance
40+
session = MedCATTrainerSession(server="http://localhost:8001")
41+
42+
# List all projects
43+
projects = session.get_projects()
44+
for project in projects:
45+
print(project)
46+
47+
# Create a new dataset
48+
dataset = session.create_dataset(name="My Dataset", dataset_file="path/to/data.csv")
49+
50+
# Create a new user
51+
user = session.create_user(username="newuser", password="password123")
52+
53+
# Create a new project
54+
project = session.create_project(
55+
name="My Project",
56+
description="A new annotation project",
57+
members=[user],
58+
dataset=dataset
59+
)
60+
```
61+
62+
### MedCATTrainerSession Methods
63+
64+
- `create_project(name, description, members, dataset, cuis=[], cuis_file=None, concept_db=None, vocab=None, cdb_search_filter=None, modelpack=None, meta_tasks=[], rel_tasks=[])`
65+
- `create_dataset(name, dataset_file)`
66+
- `create_user(username, password)`
67+
- `create_medcat_model(cdb, vocab)`
68+
- `create_medcat_model_pack(model_pack)`
69+
- `get_users()`
70+
- `get_models()`
71+
- `get_model_packs()`
72+
- `get_meta_tasks()`
73+
- `get_rel_tasks()`
74+
- `get_projects()`
75+
- `get_datasets()`
76+
- `get_project_annos(projects)`
77+
78+
Each method returns the corresponding object or a list of objects.
79+
80+
## License
81+
82+
This project is licensed under the Apache 2.0 License.
83+
84+
## Contributing
85+
86+
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
87+
88+

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Welcome to MedCATtrainer's documentation!
1919
annotator_guide.md
2020
meta_annotations.md
2121
advanced_usage.md
22-
maintanence.md
22+
maintenance.md
23+
client.md
2324

2425

2526
Indices and tables

0 commit comments

Comments
 (0)