netrias_client 0.0.2__tar.gz → 0.0.4__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.

Potentially problematic release.


This version of netrias_client might be problematic. Click here for more details.

Files changed (20) hide show
  1. {netrias_client-0.0.2 → netrias_client-0.0.4}/PKG-INFO +24 -67
  2. netrias_client-0.0.4/README.md +57 -0
  3. {netrias_client-0.0.2 → netrias_client-0.0.4}/pyproject.toml +1 -1
  4. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/__init__.py +1 -1
  5. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_client.py +14 -0
  6. netrias_client-0.0.2/README.md +0 -100
  7. {netrias_client-0.0.2 → netrias_client-0.0.4}/.gitignore +0 -0
  8. {netrias_client-0.0.2 → netrias_client-0.0.4}/LICENSE +0 -0
  9. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_adapter.py +0 -0
  10. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_config.py +0 -0
  11. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_core.py +0 -0
  12. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_discovery.py +0 -0
  13. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_errors.py +0 -0
  14. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_gateway_bypass.py +0 -0
  15. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_http.py +0 -0
  16. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_io.py +0 -0
  17. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_logging.py +0 -0
  18. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_models.py +0 -0
  19. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/_validators.py +0 -0
  20. {netrias_client-0.0.2 → netrias_client-0.0.4}/src/netrias_client/scripts.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: netrias_client
3
- Version: 0.0.2
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` once (or update): `curl -LsSf https://astral.sh/uv/install.sh | sh`
60
- - Sync dependencies for a project that consumes the client:
61
- ```bash
62
- uv add netrias_client
63
- uv add python-dotenv # optional helper for loading .env files
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
- ## Quickstart Script
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
- import asyncio
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
- load_dotenv(override=True)
94
-
95
- CSV_PATH: Final[Path] = Path("data/primary_diagnosis_1.csv")
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
- async def main() -> None:
99
- client = NetriasClient()
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
- manifest = client.discover_cde_mapping(
103
- source_csv=CSV_PATH,
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
- ## `configure()` Options
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
- | `timeout` | `float | None` | Override the default 6-hour timeout for long-running harmonization jobs. |
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
- | `confidence_threshold` | `float | None` | Minimum score (0–1) for keeping discovery recommendations; lower it to capture more tentative matches. |
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; use the async variant if you’re already in an event loop.
151
- - Call `harmonize(...)` (sync) or `harmonize_async(...)` (async) with the manifest to download a harmonized CSV. The result object reports status, description, and the output path.
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.
@@ -0,0 +1,57 @@
1
+ # Netrias Client
2
+
3
+ """Explain how to install and exercise the Netrias harmonization client."""
4
+
5
+ ## Install with `uv`
6
+ - Install `uv`: `curl -LsSf https://astral.sh/uv/install.sh | sh`
7
+ - Create, activate, and sync virtual environment:
8
+ ```
9
+ uv venv
10
+ source .venv/bin/activate
11
+ uv sync
12
+ ```
13
+
14
+ """Use the Netrias to harmonize data via the Netrias API."""
15
+
16
+ ```
17
+ import os
18
+ from pathlib import Path
19
+ from typing import Final
20
+
21
+ from dotenv import load_dotenv
22
+ from netrias_client import NetriasClient
23
+
24
+ # Create a Netrias Client and populate it with your API key
25
+ netrias_client = NetriasClient()
26
+ netrias_client.configure(api_key={Insert API key here})
27
+
28
+ # Point to the csv file to harmonize
29
+ CSV_PATH: Final[Path] = Path("data") / "primary_diagnosis_1.csv"
30
+
31
+ # Determine the data -> CDE mapping
32
+ manifest = netrias_client.discover_cde_mapping(source_csv=CSV_PATH, target_schema="ccdi")
33
+
34
+ # Harmonize the data
35
+ result = netrias_client.harmonize(source_path=CSV_PATH, manifest=manifest)
36
+ ```
37
+
38
+
39
+ ## Configuration Options
40
+ `NetriasClient.configure(...)` accepts additional tuning knobs. You can mix and match the ones you need:
41
+
42
+ | Parameter | Type | Purpose |
43
+ | --- | --- | --- |
44
+ | `api_key` | `str` | **Required.** Bearer token for authenticating with the Netrias services. |
45
+ | `confidence_threshold` | `float | None` | Minimum score (0.0–1.0) for keeping discovery recommendations; lower it to capture more tentative matches. |
46
+ | `timeout` | `float | None` | Override the default timeout for harmonization jobs. |
47
+ | `log_level` | `LogLevel | str | None` | Control verbosity (`INFO` by default). Accepts enum members or string names. |
48
+ | `discovery_use_gateway_bypass` | `bool | None` | Toggle the temporary AWS Lambda bypass path for discovery (defaults to `True`). |
49
+ | `log_directory` | `Path | str | None` | Directory for per-client log files. When omitted, logs stay on stdout. |
50
+
51
+ Configure only the options you need; unspecified values fall back to sensible defaults.
52
+
53
+ ## Usage Notes
54
+ - `discover_cde_mapping(...)` samples CSV values and returns a manifest-ready payload
55
+ - Call `harmonize(...)` or `harmonize_async(...)` (async) with the manifest to download a harmonized CSV. The result object reports status, description, and the output path.
56
+ - The package exposes `__version__` so callers can assert the installed release.
57
+ - Optional extras (`netrias_client[aws]`) add boto3 helpers for the temporary gateway bypass.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "netrias_client"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  description = "Python client for the Netrias harmonization API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -6,4 +6,4 @@ from ._client import NetriasClient
6
6
 
7
7
  __all__ = ["NetriasClient", "__version__"]
8
8
 
9
- __version__ = "0.0.2"
9
+ __version__ = "0.0.4"
@@ -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,100 +0,0 @@
1
- # Netrias Client
2
-
3
- """Explain how to install and exercise the Netrias harmonization client."""
4
-
5
- ## Install with `uv`
6
- - Install `uv` once (or update): `curl -LsSf https://astral.sh/uv/install.sh | sh`
7
- - Sync dependencies for a project that consumes the client:
8
- ```bash
9
- uv add netrias_client
10
- uv add python-dotenv # optional helper for loading .env files
11
- ```
12
- - Prefer `uv run <command>` for executing scripts so the managed environment is reused automatically.
13
-
14
- ### Alternative: `pip`
15
- ```bash
16
- python -m pip install netrias_client
17
- python -m pip install python-dotenv # optional
18
- ```
19
-
20
- ## Quickstart Script
21
- Reference script (save as `main.py`) showing a full harmonization round-trip:
22
-
23
- ```python
24
- #!/usr/bin/env -S uv run python
25
- # /// script
26
- # requires-python = ">=3.13"
27
- # dependencies = ["netrias_client", "python-dotenv"]
28
- # ///
29
-
30
- """Exercise the packaged Netrias client against the live APIs."""
31
-
32
- import asyncio
33
- import os
34
- from pathlib import Path
35
- from typing import Final
36
-
37
- from dotenv import load_dotenv
38
- from netrias_client import NetriasClient
39
-
40
- load_dotenv(override=True)
41
-
42
- CSV_PATH: Final[Path] = Path("data/primary_diagnosis_1.csv")
43
-
44
-
45
- async def main() -> None:
46
- client = NetriasClient()
47
- client.configure(api_key=_resolve_api_key())
48
-
49
- manifest = client.discover_cde_mapping(
50
- source_csv=CSV_PATH,
51
- target_schema="ccdi",
52
- )
53
-
54
- _ = await client.harmonize_async(
55
- source_path=CSV_PATH,
56
- manifest=manifest,
57
- )
58
-
59
-
60
- def _resolve_api_key() -> str:
61
- api_key = os.getenv("NETRIAS_API_KEY")
62
- if api_key:
63
- return api_key
64
- msg = "Set NETRIAS_API_KEY in your environment or .env file"
65
- raise RuntimeError(msg)
66
-
67
-
68
- if __name__ == "__main__":
69
- asyncio.run(main())
70
- ```
71
-
72
- ### Steps
73
- 1. Install or update `uv` (see above).
74
- 2. Export `NETRIAS_API_KEY` (or add it to a local `.env`).
75
- 3. Adjust `CSV_PATH` to point at the source CSV you want to harmonize.
76
- 4. Run `uv run python main.py`.
77
-
78
- The client logs its configuration (minus secrets) during `configure(...)` and
79
- reports harmonization status plus output paths as the workflow progresses, so
80
- no extra print statements are required.
81
-
82
- ## `configure()` Options
83
- `NetriasClient.configure(...)` accepts additional tuning knobs. You can mix and match the ones you need:
84
-
85
- | Parameter | Type | Purpose |
86
- | --- | --- | --- |
87
- | `api_key` | `str` | **Required.** Bearer token for authenticating with the Netrias services. |
88
- | `timeout` | `float | None` | Override the default 6-hour timeout for long-running harmonization jobs. |
89
- | `log_level` | `LogLevel | str | None` | Control verbosity (`INFO` by default). Accepts enum members or string names. |
90
- | `confidence_threshold` | `float | None` | Minimum score (0–1) for keeping discovery recommendations; lower it to capture more tentative matches. |
91
- | `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. |
92
- | `log_directory` | `Path | str | None` | Directory for per-client log files. When omitted, logs stay on stdout. |
93
-
94
- Configure only the options you need; unspecified values fall back to sensible defaults.
95
-
96
- ## Usage Notes
97
- - `discover_cde_mapping(...)` samples CSV values and returns a manifest-ready payload; use the async variant if you’re already in an event loop.
98
- - Call `harmonize(...)` (sync) or `harmonize_async(...)` (async) with the manifest to download a harmonized CSV. The result object reports status, description, and the output path.
99
- - The package exposes `__version__` so callers can assert the installed release.
100
- - Optional extras (`netrias_client[aws]`) add boto3 helpers for the temporary gateway bypass.
File without changes