cynric 1.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.
- cynric-1.1.0/.gitignore +114 -0
- cynric-1.1.0/PKG-INFO +171 -0
- cynric-1.1.0/README.md +155 -0
- cynric-1.1.0/pyproject.toml +67 -0
- cynric-1.1.0/src/cynric/__init__.py +31 -0
- cynric-1.1.0/src/cynric/api/__init__.py +0 -0
- cynric-1.1.0/src/cynric/api/api_client.py +224 -0
- cynric-1.1.0/src/cynric/api/authentication.py +47 -0
- cynric-1.1.0/src/cynric/api/bc.py +142 -0
- cynric-1.1.0/src/cynric/api/endpoints.py +319 -0
- cynric-1.1.0/src/cynric/api/integrity.py +38 -0
- cynric-1.1.0/src/cynric/api/logger.py +45 -0
- cynric-1.1.0/src/cynric/api/queue.py +67 -0
- cynric-1.1.0/src/cynric/api/utilities.py +181 -0
- cynric-1.1.0/src/cynric/credentials/credentials.py +72 -0
- cynric-1.1.0/src/cynric/credentials/helpers.py +90 -0
- cynric-1.1.0/src/cynric/credentials/resolution.py +60 -0
- cynric-1.1.0/src/cynric/dataset_manager/__init__.py +0 -0
- cynric-1.1.0/src/cynric/dataset_manager/convenience.py +25 -0
- cynric-1.1.0/src/cynric/dataset_manager/mapper.py +101 -0
- cynric-1.1.0/src/cynric/dataset_manager/navigator.py +386 -0
- cynric-1.1.0/src/cynric/demo/__init__.py +6 -0
- cynric-1.1.0/src/cynric/demo/demo.py +59 -0
- cynric-1.1.0/src/cynric/exceptions.py +40 -0
- cynric-1.1.0/src/cynric/forms/__init__.py +5 -0
- cynric-1.1.0/src/cynric/forms/convert.py +244 -0
- cynric-1.1.0/src/cynric/forms/create.py +236 -0
- cynric-1.1.0/src/cynric/instantiation.py +7 -0
- cynric-1.1.0/src/cynric/py.typed +0 -0
- cynric-1.1.0/src/cynric/support/__init__.py +0 -0
- cynric-1.1.0/src/cynric/support/version_check.py +73 -0
- cynric-1.1.0/src/cynric/uploading/__init__.py +0 -0
- cynric-1.1.0/src/cynric/uploading/convenience.py +107 -0
- cynric-1.1.0/src/cynric/uploading/helpers.py +71 -0
- cynric-1.1.0/src/cynric/uploading/uploading.py +249 -0
- cynric-1.1.0/src/cynric/validation/__init__.py +0 -0
- cynric-1.1.0/src/cynric/validation/validation.py +37 -0
cynric-1.1.0/.gitignore
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
__pycache__
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
tests/outputs
|
|
7
|
+
.ruff_cache
|
|
8
|
+
.pytest_cache
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
pip-wheel-metadata/
|
|
28
|
+
share/python-wheels/
|
|
29
|
+
*.egg-info/
|
|
30
|
+
.installed.cfg
|
|
31
|
+
*.egg
|
|
32
|
+
MANIFEST
|
|
33
|
+
poetry.lock
|
|
34
|
+
uv.lock
|
|
35
|
+
.coverage
|
|
36
|
+
|
|
37
|
+
# mypy
|
|
38
|
+
.mypy_cache/
|
|
39
|
+
.dmypy.json
|
|
40
|
+
dmypy.json
|
|
41
|
+
|
|
42
|
+
# Secrets
|
|
43
|
+
*.env
|
|
44
|
+
*.yaml
|
|
45
|
+
|
|
46
|
+
# VSCode
|
|
47
|
+
*.vscode
|
|
48
|
+
*.code-workspace
|
|
49
|
+
|
|
50
|
+
# Virtual Environments
|
|
51
|
+
.venv
|
|
52
|
+
env/
|
|
53
|
+
venv/
|
|
54
|
+
ENV/
|
|
55
|
+
env.bak/
|
|
56
|
+
venv.bak/
|
|
57
|
+
|
|
58
|
+
# Documents
|
|
59
|
+
*.doc
|
|
60
|
+
*.docx
|
|
61
|
+
*.dot
|
|
62
|
+
*.dotx
|
|
63
|
+
*.rtf
|
|
64
|
+
*.odt
|
|
65
|
+
*.pdf
|
|
66
|
+
*.ppt
|
|
67
|
+
*.pptx
|
|
68
|
+
*.odp
|
|
69
|
+
*.key
|
|
70
|
+
*.pages
|
|
71
|
+
*.numbers
|
|
72
|
+
|
|
73
|
+
# Notes
|
|
74
|
+
*.txt
|
|
75
|
+
*.log
|
|
76
|
+
|
|
77
|
+
# Archives
|
|
78
|
+
*.zip
|
|
79
|
+
*.tar
|
|
80
|
+
*.gz
|
|
81
|
+
*.tgz
|
|
82
|
+
*.bz2
|
|
83
|
+
*.7z
|
|
84
|
+
*.rar
|
|
85
|
+
*.xz
|
|
86
|
+
|
|
87
|
+
# Data
|
|
88
|
+
*.xlsx
|
|
89
|
+
*.xltx
|
|
90
|
+
*.xltm
|
|
91
|
+
*.xls
|
|
92
|
+
*.xlsm
|
|
93
|
+
*.xlsb
|
|
94
|
+
*.csv
|
|
95
|
+
*.tsv
|
|
96
|
+
*.tab
|
|
97
|
+
*.ods
|
|
98
|
+
*.xml
|
|
99
|
+
*.parquet
|
|
100
|
+
*.arrow
|
|
101
|
+
|
|
102
|
+
# Other
|
|
103
|
+
*.ipynb
|
|
104
|
+
|
|
105
|
+
# Keep
|
|
106
|
+
!*.pre-commit-config.yaml
|
|
107
|
+
!*.github/workflows/*.yaml
|
|
108
|
+
|
|
109
|
+
# Project Specific
|
|
110
|
+
## project-specific folders/files/patterns to exclude
|
|
111
|
+
## do not use for personal files (use .git/exclude for personal items)
|
|
112
|
+
*.crt
|
|
113
|
+
|
|
114
|
+
# Project Keep
|
cynric-1.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cynric
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Cynric is a package for validating and uploading data to the Wessex SDE
|
|
5
|
+
Author: Ben Sale, Michael George, Cai Davis
|
|
6
|
+
License-Expression: CC-BY-NC-4.0
|
|
7
|
+
Requires-Python: <4,>=3.11
|
|
8
|
+
Requires-Dist: keyring>=25.7.0
|
|
9
|
+
Requires-Dist: keyrings-alt>=5.0.2; sys_platform == 'linux'
|
|
10
|
+
Requires-Dist: polars>=1.35.2
|
|
11
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
12
|
+
Requires-Dist: rapidfuzz>=3.14.3
|
|
13
|
+
Requires-Dist: urllib3>=2.5.0
|
|
14
|
+
Requires-Dist: valediction>=1.2.0
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="docs/images/cynric.png" alt="cynric", width=300>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
# Cynric
|
|
22
|
+
_**Wessex SDE data validation & API uploader**_
|
|
23
|
+
|
|
24
|
+
**Cynric** is a convenience package for validating research datasets against a **data dictionary** and securely uploading them into the **Wessex Secure Data Environment (SDE)**.
|
|
25
|
+
|
|
26
|
+
Under the hood, Cynric uses **[Valediction](https://github.com/SETT-Centre-Data-and-AI/Valediction)** for dictionary-driven constraint enforcement, then handles authenticated upload to targeted SDE database tables — including **chunked uploads** for large datasets and **streamed reading** to optimise local RAM usage.
|
|
27
|
+
|
|
28
|
+
Developed by the Wessex SDE, University of Southampton CIRU, and University Hospital Southampton SETT Centre for use in clinical research workflows, Cynric is designed to fit into reproducible analytical pipelines for automatic SDE validation & data upload.
|
|
29
|
+
|
|
30
|
+
**Features**:
|
|
31
|
+
- **Validates** a user's dataset against an accompanying data dictionary to enforce constraints and data integrity
|
|
32
|
+
- **Uploads** validated datasets to targeted Wessex SDE database tables
|
|
33
|
+
- **Chunking** for large datasets to support stable transfer and RAM optimisation
|
|
34
|
+
- **Secures credentials** via `keyring` to keep API keys out of repositories and retrieves for convenience
|
|
35
|
+
- **Checks table access** quickly to confirm user permissions and review table access
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# 🧭 Resources
|
|
39
|
+
- [Installation](./docs/installation-guide.md)
|
|
40
|
+
- [Valediction](https://github.com/SETT-Centre-Data-and-AI/Valediction) (_data dictionary driven validation_)
|
|
41
|
+
- [Data Dictionary Template ⬇️](./src/valediction/dictionary/template/PROJECT%20-%20Data%20Dictionary.xltx) (_download_)
|
|
42
|
+
|
|
43
|
+
# ⚡ Quickstart
|
|
44
|
+
### Demo/Test
|
|
45
|
+
1) Install: `pip install cynric` (or use your favoured package manager)
|
|
46
|
+
2) Contact the Wessex SDE team for your API key and endpoint
|
|
47
|
+
3) Request the demo tables be established in your workspace
|
|
48
|
+
4) Run the following test using Cynric's inbuilt demo data:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import cynric
|
|
52
|
+
|
|
53
|
+
## Save Credentials to OS Credential Storage (one-time)
|
|
54
|
+
cynric.save_credentials(
|
|
55
|
+
base_url = "https://YOUR_WESSEX_SDE_ENDPOINT",
|
|
56
|
+
token = "YOUR_API_KEY"
|
|
57
|
+
) # Scrub from code once saved for max security
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Identify Tables for Demo Upload
|
|
61
|
+
sde_tables = cynric.check_table_access(print=True)
|
|
62
|
+
```
|
|
63
|
+
```python
|
|
64
|
+
## Upload Demo Data
|
|
65
|
+
cynric.demo.push_demo_data(
|
|
66
|
+
target_table_map = { # enter target tables
|
|
67
|
+
"DEMOGRAPHICS": "dsXXXXXX",
|
|
68
|
+
"DIAGNOSES": "dsXXXXXX",
|
|
69
|
+
"LAB_TESTS": "dsXXXXXX",
|
|
70
|
+
"VITALS": "dsXXXXXX",
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Data Upload
|
|
76
|
+
1) Following Wessex SDE setup of workspace & tables, upload your data:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import cynric
|
|
80
|
+
from cynric import demo
|
|
81
|
+
|
|
82
|
+
# Import Data & Dictionary and Review
|
|
83
|
+
dataset = cynric.Dataset.create_from(demo.DEMO_DATA)
|
|
84
|
+
dataset.import_dictionary(demo.DEMO_DICTIONARY)
|
|
85
|
+
dataset
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
# Identify Tables
|
|
90
|
+
sde_tables = cynric.check_table_access(print=True)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
cynric.validate_and_upload(
|
|
95
|
+
dataset,
|
|
96
|
+
target_table_map={
|
|
97
|
+
"TABLE_NAME_1": "dsXXXXXX",
|
|
98
|
+
"TABLE_NAME_2": "dsXXXXXX",
|
|
99
|
+
# etc...
|
|
100
|
+
},
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Creating BC Compatible Files
|
|
105
|
+
For tables to be uploaded within the BC Insight platform within the SDE requires the creation of BC Form Files. These can be exported using the following function:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from cynric.forms import create_bc_files
|
|
109
|
+
|
|
110
|
+
create_bc_files(
|
|
111
|
+
dictionary='Project - Data Dictionary.xlsx', # Dictionary file generated by valediction or valedication Dictionary object
|
|
112
|
+
forms_output_dir='path/to/forms/output/dir',
|
|
113
|
+
export_excel_path='path/to/excel_file.xlxs' # Optionally a BC specific data dictionary can be exported as an excel file
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
# 🧠 Function Quicklist
|
|
119
|
+
### Preparation
|
|
120
|
+
- `save_credentials()` - securely store the Wessex SDE endpoint + API key in your OS's credential manager
|
|
121
|
+
- `delete_credentials()` - remove stored credentials from your OS's credential manager
|
|
122
|
+
- `check_table_access()` - confirm access/permissions to a target SDE table (useful before upload)
|
|
123
|
+
|
|
124
|
+
### Validation & Upload
|
|
125
|
+
- `Dataset.create_from()` - create a Cynric Dataset from a folder of files, or dictionary of DataFrames
|
|
126
|
+
- `validate_and_upload()` - validate the dataset and upload to the target SDE tables (supports chunked upload)
|
|
127
|
+
|
|
128
|
+
# 🤝 Contributing
|
|
129
|
+
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
|
|
130
|
+
|
|
131
|
+
# ⚖️ License
|
|
132
|
+
This work is licensed under a
|
|
133
|
+
[Creative Commons Attribution-NonCommercial 4.0 International License][cc-by-nc].
|
|
134
|
+
[![CC BY-NC 4.0][cc-by-nc-shield]][cc-by-nc]
|
|
135
|
+
|
|
136
|
+
[cc-by-nc]: https://creativecommons.org/licenses/by-nc/4.0/
|
|
137
|
+
[cc-by-nc-shield]: https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg
|
|
138
|
+
|
|
139
|
+
# 🧑🔬 Authors
|
|
140
|
+
Cynric was developed by Ben Sale, Cai Davis, and Michael George across the Wessex SDE, University Hospital Southampton NHSFT's Data & AI Research Unit (DAIR), and the University of Southampton's Clinical Informatics Research Unit (CIRU)
|
|
141
|
+
|
|
142
|
+
[CIRU]: https://www.the-ciru.com/
|
|
143
|
+
[SETT]: https://github.com/SETT-Centre-Data-and-AI
|
|
144
|
+
[WSDE]: https://wessexsde.nhs.uk/
|
|
145
|
+
|
|
146
|
+
### Collaborators
|
|
147
|
+
- [Wessex Secure Data Environment (SDE)][WSDE]
|
|
148
|
+
- [Southampton Emerging Therapies and Technology (SETT) Centre][SETT]
|
|
149
|
+
- [Clinical Informatics Research Unit (CIRU)][CIRU]
|
|
150
|
+
|
|
151
|
+
<p align="center">
|
|
152
|
+
<a href="https://github.com/SETT-Centre-Data-and-AI">
|
|
153
|
+
<img src="docs/images/SETT Header.png" alt="NHS UHS SETT Centre">
|
|
154
|
+
</a>
|
|
155
|
+
</p>
|
|
156
|
+
|
|
157
|
+
<p align="center">
|
|
158
|
+
<a href="https://wessexsde.nhs.uk/">
|
|
159
|
+
<img src="docs/images/Wessex SDE Header.png" alt="Wessex SDE">
|
|
160
|
+
</a>
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<p align="center">
|
|
164
|
+
<a href="https://www.the-ciru.com/">
|
|
165
|
+
<img
|
|
166
|
+
src="docs/images/CIRU Header.png"
|
|
167
|
+
alt="CIRU"
|
|
168
|
+
style="width: 100%; max-width: 1900px; height: auto;"
|
|
169
|
+
>
|
|
170
|
+
</a>
|
|
171
|
+
</p>
|
cynric-1.1.0/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/images/cynric.png" alt="cynric", width=300>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Cynric
|
|
6
|
+
_**Wessex SDE data validation & API uploader**_
|
|
7
|
+
|
|
8
|
+
**Cynric** is a convenience package for validating research datasets against a **data dictionary** and securely uploading them into the **Wessex Secure Data Environment (SDE)**.
|
|
9
|
+
|
|
10
|
+
Under the hood, Cynric uses **[Valediction](https://github.com/SETT-Centre-Data-and-AI/Valediction)** for dictionary-driven constraint enforcement, then handles authenticated upload to targeted SDE database tables — including **chunked uploads** for large datasets and **streamed reading** to optimise local RAM usage.
|
|
11
|
+
|
|
12
|
+
Developed by the Wessex SDE, University of Southampton CIRU, and University Hospital Southampton SETT Centre for use in clinical research workflows, Cynric is designed to fit into reproducible analytical pipelines for automatic SDE validation & data upload.
|
|
13
|
+
|
|
14
|
+
**Features**:
|
|
15
|
+
- **Validates** a user's dataset against an accompanying data dictionary to enforce constraints and data integrity
|
|
16
|
+
- **Uploads** validated datasets to targeted Wessex SDE database tables
|
|
17
|
+
- **Chunking** for large datasets to support stable transfer and RAM optimisation
|
|
18
|
+
- **Secures credentials** via `keyring` to keep API keys out of repositories and retrieves for convenience
|
|
19
|
+
- **Checks table access** quickly to confirm user permissions and review table access
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# 🧭 Resources
|
|
23
|
+
- [Installation](./docs/installation-guide.md)
|
|
24
|
+
- [Valediction](https://github.com/SETT-Centre-Data-and-AI/Valediction) (_data dictionary driven validation_)
|
|
25
|
+
- [Data Dictionary Template ⬇️](./src/valediction/dictionary/template/PROJECT%20-%20Data%20Dictionary.xltx) (_download_)
|
|
26
|
+
|
|
27
|
+
# ⚡ Quickstart
|
|
28
|
+
### Demo/Test
|
|
29
|
+
1) Install: `pip install cynric` (or use your favoured package manager)
|
|
30
|
+
2) Contact the Wessex SDE team for your API key and endpoint
|
|
31
|
+
3) Request the demo tables be established in your workspace
|
|
32
|
+
4) Run the following test using Cynric's inbuilt demo data:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import cynric
|
|
36
|
+
|
|
37
|
+
## Save Credentials to OS Credential Storage (one-time)
|
|
38
|
+
cynric.save_credentials(
|
|
39
|
+
base_url = "https://YOUR_WESSEX_SDE_ENDPOINT",
|
|
40
|
+
token = "YOUR_API_KEY"
|
|
41
|
+
) # Scrub from code once saved for max security
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Identify Tables for Demo Upload
|
|
45
|
+
sde_tables = cynric.check_table_access(print=True)
|
|
46
|
+
```
|
|
47
|
+
```python
|
|
48
|
+
## Upload Demo Data
|
|
49
|
+
cynric.demo.push_demo_data(
|
|
50
|
+
target_table_map = { # enter target tables
|
|
51
|
+
"DEMOGRAPHICS": "dsXXXXXX",
|
|
52
|
+
"DIAGNOSES": "dsXXXXXX",
|
|
53
|
+
"LAB_TESTS": "dsXXXXXX",
|
|
54
|
+
"VITALS": "dsXXXXXX",
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Data Upload
|
|
60
|
+
1) Following Wessex SDE setup of workspace & tables, upload your data:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import cynric
|
|
64
|
+
from cynric import demo
|
|
65
|
+
|
|
66
|
+
# Import Data & Dictionary and Review
|
|
67
|
+
dataset = cynric.Dataset.create_from(demo.DEMO_DATA)
|
|
68
|
+
dataset.import_dictionary(demo.DEMO_DICTIONARY)
|
|
69
|
+
dataset
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
# Identify Tables
|
|
74
|
+
sde_tables = cynric.check_table_access(print=True)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
cynric.validate_and_upload(
|
|
79
|
+
dataset,
|
|
80
|
+
target_table_map={
|
|
81
|
+
"TABLE_NAME_1": "dsXXXXXX",
|
|
82
|
+
"TABLE_NAME_2": "dsXXXXXX",
|
|
83
|
+
# etc...
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Creating BC Compatible Files
|
|
89
|
+
For tables to be uploaded within the BC Insight platform within the SDE requires the creation of BC Form Files. These can be exported using the following function:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from cynric.forms import create_bc_files
|
|
93
|
+
|
|
94
|
+
create_bc_files(
|
|
95
|
+
dictionary='Project - Data Dictionary.xlsx', # Dictionary file generated by valediction or valedication Dictionary object
|
|
96
|
+
forms_output_dir='path/to/forms/output/dir',
|
|
97
|
+
export_excel_path='path/to/excel_file.xlxs' # Optionally a BC specific data dictionary can be exported as an excel file
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
# 🧠 Function Quicklist
|
|
103
|
+
### Preparation
|
|
104
|
+
- `save_credentials()` - securely store the Wessex SDE endpoint + API key in your OS's credential manager
|
|
105
|
+
- `delete_credentials()` - remove stored credentials from your OS's credential manager
|
|
106
|
+
- `check_table_access()` - confirm access/permissions to a target SDE table (useful before upload)
|
|
107
|
+
|
|
108
|
+
### Validation & Upload
|
|
109
|
+
- `Dataset.create_from()` - create a Cynric Dataset from a folder of files, or dictionary of DataFrames
|
|
110
|
+
- `validate_and_upload()` - validate the dataset and upload to the target SDE tables (supports chunked upload)
|
|
111
|
+
|
|
112
|
+
# 🤝 Contributing
|
|
113
|
+
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
|
|
114
|
+
|
|
115
|
+
# ⚖️ License
|
|
116
|
+
This work is licensed under a
|
|
117
|
+
[Creative Commons Attribution-NonCommercial 4.0 International License][cc-by-nc].
|
|
118
|
+
[![CC BY-NC 4.0][cc-by-nc-shield]][cc-by-nc]
|
|
119
|
+
|
|
120
|
+
[cc-by-nc]: https://creativecommons.org/licenses/by-nc/4.0/
|
|
121
|
+
[cc-by-nc-shield]: https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg
|
|
122
|
+
|
|
123
|
+
# 🧑🔬 Authors
|
|
124
|
+
Cynric was developed by Ben Sale, Cai Davis, and Michael George across the Wessex SDE, University Hospital Southampton NHSFT's Data & AI Research Unit (DAIR), and the University of Southampton's Clinical Informatics Research Unit (CIRU)
|
|
125
|
+
|
|
126
|
+
[CIRU]: https://www.the-ciru.com/
|
|
127
|
+
[SETT]: https://github.com/SETT-Centre-Data-and-AI
|
|
128
|
+
[WSDE]: https://wessexsde.nhs.uk/
|
|
129
|
+
|
|
130
|
+
### Collaborators
|
|
131
|
+
- [Wessex Secure Data Environment (SDE)][WSDE]
|
|
132
|
+
- [Southampton Emerging Therapies and Technology (SETT) Centre][SETT]
|
|
133
|
+
- [Clinical Informatics Research Unit (CIRU)][CIRU]
|
|
134
|
+
|
|
135
|
+
<p align="center">
|
|
136
|
+
<a href="https://github.com/SETT-Centre-Data-and-AI">
|
|
137
|
+
<img src="docs/images/SETT Header.png" alt="NHS UHS SETT Centre">
|
|
138
|
+
</a>
|
|
139
|
+
</p>
|
|
140
|
+
|
|
141
|
+
<p align="center">
|
|
142
|
+
<a href="https://wessexsde.nhs.uk/">
|
|
143
|
+
<img src="docs/images/Wessex SDE Header.png" alt="Wessex SDE">
|
|
144
|
+
</a>
|
|
145
|
+
</p>
|
|
146
|
+
|
|
147
|
+
<p align="center">
|
|
148
|
+
<a href="https://www.the-ciru.com/">
|
|
149
|
+
<img
|
|
150
|
+
src="docs/images/CIRU Header.png"
|
|
151
|
+
alt="CIRU"
|
|
152
|
+
style="width: 100%; max-width: 1900px; height: auto;"
|
|
153
|
+
>
|
|
154
|
+
</a>
|
|
155
|
+
</p>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cynric"
|
|
3
|
+
version = "1.1.0"
|
|
4
|
+
description = "Cynric is a package for validating and uploading data to the Wessex SDE"
|
|
5
|
+
authors = [{ name = "Ben Sale"}, {name="Michael George"}, {name="Cai Davis"}]
|
|
6
|
+
license = "CC-BY-NC-4.0"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.11,<4"
|
|
9
|
+
|
|
10
|
+
# Dependencies
|
|
11
|
+
dependencies = [
|
|
12
|
+
"keyring>=25.7.0",
|
|
13
|
+
"keyrings-alt>=5.0.2 ; sys_platform == 'linux'",
|
|
14
|
+
"polars>=1.35.2",
|
|
15
|
+
"python-dotenv>=1.2.1",
|
|
16
|
+
"rapidfuzz>=3.14.3",
|
|
17
|
+
"urllib3>=2.5.0",
|
|
18
|
+
"valediction>=1.2.0",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
# Development
|
|
22
|
+
[dependency-groups]
|
|
23
|
+
dev = [
|
|
24
|
+
"pytest>=9.0.1,<10.0.0",
|
|
25
|
+
"pytest-cov>=7.0.0,<8.0.0",
|
|
26
|
+
"commitizen>=4.1.1,<5.0.0",
|
|
27
|
+
"mypy>=1.18.2,<2.0.0",
|
|
28
|
+
"ipykernel (>=7.1.0,<8.0.0)",
|
|
29
|
+
"pre-commit>=4.4.0,<5.0.0",
|
|
30
|
+
"types-requests>=2.32.4.20250913",
|
|
31
|
+
"types-urllib3>=1.26.25.14",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[tool.uv]
|
|
35
|
+
native-tls = true
|
|
36
|
+
|
|
37
|
+
# Build System
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["hatchling"]
|
|
40
|
+
build-backend = "hatchling.build"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.sdist]
|
|
43
|
+
include = [
|
|
44
|
+
"src/cynric",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[tool.hatch.build.targets.wheel]
|
|
48
|
+
include = [
|
|
49
|
+
"src/cynric",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel.sources]
|
|
53
|
+
"src/cynric" = "cynric"
|
|
54
|
+
|
|
55
|
+
[tool.poetry]
|
|
56
|
+
packages = [
|
|
57
|
+
{ include = "cynric", from = "src" },
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
# Commitizen
|
|
61
|
+
[tool.commitizen]
|
|
62
|
+
name = "cz_conventional_commits"
|
|
63
|
+
tag_format = "v$major.$minor.$patch$prerelease"
|
|
64
|
+
version_type = "pep440"
|
|
65
|
+
version_provider = "pep621"
|
|
66
|
+
update_changelog_on_bump = true
|
|
67
|
+
major_version_zero = false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from cynric.uploading.uploading import Uploader
|
|
2
|
+
from cynric.uploading.convenience import validate_and_upload
|
|
3
|
+
from cynric.credentials.credentials import (
|
|
4
|
+
save_credentials,
|
|
5
|
+
delete_credentials,
|
|
6
|
+
get_base_url,
|
|
7
|
+
get_token,
|
|
8
|
+
)
|
|
9
|
+
from valediction.datasets.datasets import Dataset
|
|
10
|
+
from cynric.validation.validation import validate
|
|
11
|
+
from cynric import demo
|
|
12
|
+
from cynric.support.version_check import check_version
|
|
13
|
+
from cynric import instantiation as _instantiation
|
|
14
|
+
from cynric.dataset_manager.convenience import check_table_access
|
|
15
|
+
|
|
16
|
+
_instantiation.inject_cynric_variables()
|
|
17
|
+
check_version()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"Uploader",
|
|
22
|
+
"validate_and_upload",
|
|
23
|
+
"save_credentials",
|
|
24
|
+
"delete_credentials",
|
|
25
|
+
"get_base_url",
|
|
26
|
+
"get_token",
|
|
27
|
+
"Dataset",
|
|
28
|
+
"validate",
|
|
29
|
+
"demo",
|
|
30
|
+
"check_table_access",
|
|
31
|
+
]
|
|
File without changes
|