netrias_client 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl
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.
Potentially problematic release.
This version of netrias_client might be problematic. Click here for more details.
- netrias_client/__init__.py +1 -1
- netrias_client/_client.py +14 -0
- {netrias_client-0.0.2.dist-info → netrias_client-0.0.4.dist-info}/METADATA +24 -67
- {netrias_client-0.0.2.dist-info → netrias_client-0.0.4.dist-info}/RECORD +7 -7
- {netrias_client-0.0.2.dist-info → netrias_client-0.0.4.dist-info}/WHEEL +0 -0
- {netrias_client-0.0.2.dist-info → netrias_client-0.0.4.dist-info}/entry_points.txt +0 -0
- {netrias_client-0.0.2.dist-info → netrias_client-0.0.4.dist-info}/licenses/LICENSE +0 -0
netrias_client/__init__.py
CHANGED
netrias_client/_client.py
CHANGED
|
@@ -190,6 +190,20 @@ class NetriasClient:
|
|
|
190
190
|
logger=self._require_logger(),
|
|
191
191
|
)
|
|
192
192
|
|
|
193
|
+
async def discover_cde_mapping_async(
|
|
194
|
+
self,
|
|
195
|
+
source_csv: Path,
|
|
196
|
+
target_schema: str,
|
|
197
|
+
sample_limit: int = 25,
|
|
198
|
+
) -> ManifestPayload:
|
|
199
|
+
"""Async compatibility alias for :meth:`discover_mapping_from_csv_async`."""
|
|
200
|
+
|
|
201
|
+
return await self.discover_mapping_from_csv_async(
|
|
202
|
+
source_csv=source_csv,
|
|
203
|
+
target_schema=target_schema,
|
|
204
|
+
sample_limit=sample_limit,
|
|
205
|
+
)
|
|
206
|
+
|
|
193
207
|
def harmonize(
|
|
194
208
|
self,
|
|
195
209
|
source_path: Path,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netrias_client
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Python client for the Netrias harmonization API
|
|
5
5
|
Project-URL: Homepage, https://github.com/netrias/netrias_client
|
|
6
6
|
Project-URL: Repository, https://github.com/netrias/netrias_client
|
|
@@ -56,33 +56,17 @@ Description-Content-Type: text/markdown
|
|
|
56
56
|
"""Explain how to install and exercise the Netrias harmonization client."""
|
|
57
57
|
|
|
58
58
|
## Install with `uv`
|
|
59
|
-
- Install `uv
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- Prefer `uv run <command>` for executing scripts so the managed environment is reused automatically.
|
|
66
|
-
|
|
67
|
-
### Alternative: `pip`
|
|
68
|
-
```bash
|
|
69
|
-
python -m pip install netrias_client
|
|
70
|
-
python -m pip install python-dotenv # optional
|
|
59
|
+
- Install `uv`: `curl -LsSf https://astral.sh/uv/install.sh | sh`
|
|
60
|
+
- Create, activate, and sync virtual environment:
|
|
61
|
+
```
|
|
62
|
+
uv venv
|
|
63
|
+
source .venv/bin/activate
|
|
64
|
+
uv sync
|
|
71
65
|
```
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
Reference script (save as `main.py`) showing a full harmonization round-trip:
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
#!/usr/bin/env -S uv run python
|
|
78
|
-
# /// script
|
|
79
|
-
# requires-python = ">=3.13"
|
|
80
|
-
# dependencies = ["netrias_client", "python-dotenv"]
|
|
81
|
-
# ///
|
|
82
|
-
|
|
83
|
-
"""Exercise the packaged Netrias client against the live APIs."""
|
|
67
|
+
"""Use the Netrias to harmonize data via the Netrias API."""
|
|
84
68
|
|
|
85
|
-
|
|
69
|
+
```
|
|
86
70
|
import os
|
|
87
71
|
from pathlib import Path
|
|
88
72
|
from typing import Final
|
|
@@ -90,64 +74,37 @@ from typing import Final
|
|
|
90
74
|
from dotenv import load_dotenv
|
|
91
75
|
from netrias_client import NetriasClient
|
|
92
76
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
# Create a Netrias Client and populate it with your API key
|
|
78
|
+
netrias_client = NetriasClient()
|
|
79
|
+
netrias_client.configure(api_key={Insert API key here})
|
|
96
80
|
|
|
81
|
+
# Point to the csv file to harmonize
|
|
82
|
+
CSV_PATH: Final[Path] = Path("data") / "primary_diagnosis_1.csv"
|
|
97
83
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
client.configure(api_key=_resolve_api_key())
|
|
84
|
+
# Determine the data -> CDE mapping
|
|
85
|
+
manifest = netrias_client.discover_cde_mapping(source_csv=CSV_PATH, target_schema="ccdi")
|
|
101
86
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
target_schema="ccdi",
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
_ = await client.harmonize_async(
|
|
108
|
-
source_path=CSV_PATH,
|
|
109
|
-
manifest=manifest,
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def _resolve_api_key() -> str:
|
|
114
|
-
api_key = os.getenv("NETRIAS_API_KEY")
|
|
115
|
-
if api_key:
|
|
116
|
-
return api_key
|
|
117
|
-
msg = "Set NETRIAS_API_KEY in your environment or .env file"
|
|
118
|
-
raise RuntimeError(msg)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if __name__ == "__main__":
|
|
122
|
-
asyncio.run(main())
|
|
87
|
+
# Harmonize the data
|
|
88
|
+
result = netrias_client.harmonize(source_path=CSV_PATH, manifest=manifest)
|
|
123
89
|
```
|
|
124
90
|
|
|
125
|
-
### Steps
|
|
126
|
-
1. Install or update `uv` (see above).
|
|
127
|
-
2. Export `NETRIAS_API_KEY` (or add it to a local `.env`).
|
|
128
|
-
3. Adjust `CSV_PATH` to point at the source CSV you want to harmonize.
|
|
129
|
-
4. Run `uv run python main.py`.
|
|
130
|
-
|
|
131
|
-
The client logs its configuration (minus secrets) during `configure(...)` and
|
|
132
|
-
reports harmonization status plus output paths as the workflow progresses, so
|
|
133
|
-
no extra print statements are required.
|
|
134
91
|
|
|
135
|
-
##
|
|
92
|
+
## Configuration Options
|
|
136
93
|
`NetriasClient.configure(...)` accepts additional tuning knobs. You can mix and match the ones you need:
|
|
137
94
|
|
|
138
95
|
| Parameter | Type | Purpose |
|
|
139
96
|
| --- | --- | --- |
|
|
140
97
|
| `api_key` | `str` | **Required.** Bearer token for authenticating with the Netrias services. |
|
|
141
|
-
| `
|
|
98
|
+
| `confidence_threshold` | `float | None` | Minimum score (0.0–1.0) for keeping discovery recommendations; lower it to capture more tentative matches. |
|
|
99
|
+
| `timeout` | `float | None` | Override the default timeout for harmonization jobs. |
|
|
142
100
|
| `log_level` | `LogLevel | str | None` | Control verbosity (`INFO` by default). Accepts enum members or string names. |
|
|
143
|
-
| `
|
|
144
|
-
| `discovery_use_gateway_bypass` | `bool | None` | Toggle the temporary AWS Lambda bypass path for discovery (defaults to `True`). Set to `False` once API Gateway limits are sufficient. |
|
|
101
|
+
| `discovery_use_gateway_bypass` | `bool | None` | Toggle the temporary AWS Lambda bypass path for discovery (defaults to `True`). |
|
|
145
102
|
| `log_directory` | `Path | str | None` | Directory for per-client log files. When omitted, logs stay on stdout. |
|
|
146
103
|
|
|
147
104
|
Configure only the options you need; unspecified values fall back to sensible defaults.
|
|
148
105
|
|
|
149
106
|
## Usage Notes
|
|
150
|
-
- `discover_cde_mapping(...)` samples CSV values and returns a manifest-ready payload
|
|
151
|
-
- Call `harmonize(...)`
|
|
107
|
+
- `discover_cde_mapping(...)` samples CSV values and returns a manifest-ready payload
|
|
108
|
+
- Call `harmonize(...)` or `harmonize_async(...)` (async) with the manifest to download a harmonized CSV. The result object reports status, description, and the output path.
|
|
152
109
|
- The package exposes `__version__` so callers can assert the installed release.
|
|
153
110
|
- Optional extras (`netrias_client[aws]`) add boto3 helpers for the temporary gateway bypass.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
netrias_client/__init__.py,sha256=
|
|
1
|
+
netrias_client/__init__.py,sha256=RZ0Po6psf3qRgt8TU41teKOooC_7FXlgKVDRV7we1ts,200
|
|
2
2
|
netrias_client/_adapter.py,sha256=dXJqrpkaAOiZI25gZm0RzFrSFaG4VefvLiM66oI4ziU,9241
|
|
3
|
-
netrias_client/_client.py,sha256=
|
|
3
|
+
netrias_client/_client.py,sha256=A-hHSzL9RndvppxfXC-Ak1AaQ_AtWOX5g8hIjLCeZ6w,10142
|
|
4
4
|
netrias_client/_config.py,sha256=jY12kLOJ3OMn1YF7QeEq6nU2BaXCpPteoXDz7eprB8I,3098
|
|
5
5
|
netrias_client/_core.py,sha256=f77gwaHfu7lRK2eCSuwumfpU0UXQasZ9D2VVkbPQ68E,18741
|
|
6
6
|
netrias_client/_discovery.py,sha256=YVlA6dGBT4eSUBjyy82aM_Sm_4YK5ulZH_xqk5UJgZk,14380
|
|
@@ -12,8 +12,8 @@ netrias_client/_logging.py,sha256=5-lhBgp2hWp2K5ZTzz_ZwhJn_sxhSe_t__kdhuMTJnQ,13
|
|
|
12
12
|
netrias_client/_models.py,sha256=w_t-rpenLFZiBzLCdRlXaKPqgCrHCjAVoeXjPYF7wIY,1736
|
|
13
13
|
netrias_client/_validators.py,sha256=DvbaQ1Wkf4-W_H5A2PGiC-AxPN2tfpRFpH8vjETGIno,5894
|
|
14
14
|
netrias_client/scripts.py,sha256=jAdREIRbyuSvuvZt6tbRZ9ELfOzQyW9ZQcf2j2HIlsE,11113
|
|
15
|
-
netrias_client-0.0.
|
|
16
|
-
netrias_client-0.0.
|
|
17
|
-
netrias_client-0.0.
|
|
18
|
-
netrias_client-0.0.
|
|
19
|
-
netrias_client-0.0.
|
|
15
|
+
netrias_client-0.0.4.dist-info/METADATA,sha256=6InWSEcx7m-sN4FtKr7xZDpW_QUkcf13cswao47hDts,4950
|
|
16
|
+
netrias_client-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
17
|
+
netrias_client-0.0.4.dist-info/entry_points.txt,sha256=q7Uj2UATtRzlxefJNziCJQ9RXScH8MQzzWvA86Hfytc,162
|
|
18
|
+
netrias_client-0.0.4.dist-info/licenses/LICENSE,sha256=XzmWyunEynTK9hABeKX_9VEd1WcKSDQAM4IXIS-n8WU,1064
|
|
19
|
+
netrias_client-0.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|