wire remaining hardcoded paths, fix truncated quality measure docs refs #1
- bcda/client.py: output_dir default → conf.path("storage.bcda")
- bcda/express/flatten.py: store_path default → conf.path("storage.bcda")
- notebooks: eliminate all /home/kert/ absolute paths from
bib_explorer.py and zotero_tutorial.py
- generate_quality_measure_docs.py: complete truncated f-string at
line 561 (file was committed incomplete), add return statement
- test_client.py: update default assertion to match conf-resolved path
This commit is contained in:
@@ -560,4 +560,18 @@ def build_uamcc_passages(
|
|||||||
# ── Person time ───────────────────────────────────────────────────
|
# ── Person time ───────────────────────────────────────────────────
|
||||||
passages["uamcc_int_person_time"] = (
|
passages["uamcc_int_person_time"] = (
|
||||||
f"Calculate at-risk person-time for each UAMCC-eligible beneficiary.\n\n"
|
f"Calculate at-risk person-time for each UAMCC-eligible beneficiary.\n\n"
|
||||||
f
|
f"Source: {_cite(pdf_name, '§3.11', denom_d_page)}\n\n"
|
||||||
|
f"UAMCC §3.11 Denominator Exclusion Details:\n"
|
||||||
|
f" \"Persons are considered at risk for admission if they are alive,\n"
|
||||||
|
f" enrolled in Medicare FFS, and not admitted to an acute care\n"
|
||||||
|
f" hospital. In addition to time spent in the hospital, excluded\n"
|
||||||
|
f" from at-risk time are:\n"
|
||||||
|
f" (1) time spent in an SNF or acute rehabilitation facility;\n"
|
||||||
|
f" (2) time within 10 days following discharge from a hospital,\n"
|
||||||
|
f" SNF, or acute rehabilitation facility;\n"
|
||||||
|
f" (3) time after entering hospice care.\"\n\n"
|
||||||
|
f"Person-years = at_risk_days / 365.25\n\n"
|
||||||
|
f"Performance Year: {py_version}."
|
||||||
|
)
|
||||||
|
|
||||||
|
return passages
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ def _(ZOTERO_DB, mo, store):
|
|||||||
_msg = """
|
_msg = """
|
||||||
## 2. Migration
|
## 2. Migration
|
||||||
|
|
||||||
No Zotero database found at `/home/kert/zotero/zotero.sqlite`.
|
No Zotero database found at `{ZOTERO_DB}`.
|
||||||
Start the Zotero container first, or add items manually below.
|
Start the Zotero container first, or add items manually below.
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ def _():
|
|||||||
|
|
||||||
This notebook provides two modes of access:
|
This notebook provides two modes of access:
|
||||||
|
|
||||||
- **Local SQLite** — reads the Zotero database directly (mounted read-only at `/home/kert/zotero`)
|
- **Local SQLite** — reads the Zotero database directly from the path configured in `stack.toml`
|
||||||
- **Web API via pyzotero** — connects to `api.zotero.org` when API credentials are configured
|
- **Web API via pyzotero** — connects to `api.zotero.org` when API credentials are configured
|
||||||
|
|
||||||
The local SQLite path works immediately with the container's library.
|
The local SQLite path works immediately with the container's library.
|
||||||
@@ -30,7 +30,9 @@ def _(mo):
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pyzotero import zotero
|
from pyzotero import zotero
|
||||||
|
|
||||||
ZOTERO_DB = Path("/home/kert/zotero/zotero.sqlite")
|
from conf import path as _conf_path
|
||||||
|
|
||||||
|
ZOTERO_DB = _conf_path("db.zotero")
|
||||||
|
|
||||||
mo.md(f"""
|
mo.md(f"""
|
||||||
## 1. Local Database Connection
|
## 1. Local Database Connection
|
||||||
@@ -586,7 +588,7 @@ def _(mo):
|
|||||||
| Local SQLite | Always available, read-only, fast, no credentials needed |
|
| Local SQLite | Always available, read-only, fast, no credentials needed |
|
||||||
| Pyzotero Web API | Read/write, sync support, requires zotero.org API key |
|
| Pyzotero Web API | Read/write, sync support, requires zotero.org API key |
|
||||||
|
|
||||||
The local database is mounted read-only from the `zotero` container at `/home/kert/zotero/zotero.sqlite`.
|
The local database is mounted read-only from the `zotero` container at the path configured in `stack.toml` (`db.zotero`).
|
||||||
Changes made through the VNC desktop app are reflected here on next Zotero save.
|
Changes made through the VNC desktop app are reflected here on next Zotero save.
|
||||||
""")
|
""")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -82,12 +82,16 @@ class Client:
|
|||||||
client_secret: str,
|
client_secret: str,
|
||||||
*,
|
*,
|
||||||
base_url: str = SANDBOX,
|
base_url: str = SANDBOX,
|
||||||
output_dir: str | Path = "data/bcda",
|
output_dir: str | Path | None = None,
|
||||||
version: str = "v2",
|
version: str = "v2",
|
||||||
max_retries: int = MAX_RETRIES,
|
max_retries: int = MAX_RETRIES,
|
||||||
retry_interval: float = RETRY_INITIAL_INTERVAL,
|
retry_interval: float = RETRY_INITIAL_INTERVAL,
|
||||||
timeout: float = 120.0,
|
timeout: float = 120.0,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if output_dir is None:
|
||||||
|
from conf import path
|
||||||
|
|
||||||
|
output_dir = path("storage.bcda")
|
||||||
self.client_id = client_id
|
self.client_id = client_id
|
||||||
self.client_secret = client_secret
|
self.client_secret = client_secret
|
||||||
self.base_url = base_url.rstrip("/")
|
self.base_url = base_url.rstrip("/")
|
||||||
|
|||||||
@@ -958,7 +958,7 @@ def _write_parquet(
|
|||||||
|
|
||||||
def flatten_export(
|
def flatten_export(
|
||||||
ndjson_dir: str | Path,
|
ndjson_dir: str | Path,
|
||||||
store_path: str | Path = "data/bcda",
|
store_path: str | Path | None = None,
|
||||||
*,
|
*,
|
||||||
storage_options: dict | None = None,
|
storage_options: dict | None = None,
|
||||||
) -> dict[str, int]:
|
) -> dict[str, int]:
|
||||||
@@ -993,6 +993,10 @@ def flatten_export(
|
|||||||
|
|
||||||
from bcda.log import setup
|
from bcda.log import setup
|
||||||
|
|
||||||
|
if store_path is None:
|
||||||
|
from conf import path
|
||||||
|
|
||||||
|
store_path = path("storage.bcda")
|
||||||
setup()
|
setup()
|
||||||
ndjson_dir = Path(ndjson_dir)
|
ndjson_dir = Path(ndjson_dir)
|
||||||
root = str(store_path).rstrip("/")
|
root = str(store_path).rstrip("/")
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import gzip
|
import gzip
|
||||||
from pathlib import Path
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
@@ -849,7 +848,9 @@ class TestClientDefaults:
|
|||||||
assert c.base_url == SANDBOX
|
assert c.base_url == SANDBOX
|
||||||
assert c.version == "v2"
|
assert c.version == "v2"
|
||||||
assert c.max_retries == 3
|
assert c.max_retries == 3
|
||||||
assert c.output_dir == Path("data/bcda")
|
from conf import path
|
||||||
|
|
||||||
|
assert c.output_dir == path("storage.bcda")
|
||||||
c.close()
|
c.close()
|
||||||
|
|
||||||
def test_base_url_trailing_slash(self) -> None:
|
def test_base_url_trailing_slash(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user