diff --git a/.gitignore b/.gitignore index f8bcd86..7b3356b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,30 @@ ``` -# Python cache +# Compiled Python files __pycache__/ *.pyc *.pyo -*.pyd -# Logs and temp files +# Dependencies +.venv/ +venv/ +node_modules/ + +# Logs and temporary files *.log *.tmp +*.swp + +# Environment files +.env +.env.local +*.env.* + +# Editors +.vscode/ +.idea/ + +# Build artifacts +dist/ +build/ +target/ ``` \ No newline at end of file diff --git a/scripts/__pycache__/fetch_icd11.cpython-312.pyc b/scripts/__pycache__/fetch_icd11.cpython-312.pyc index ae313af..8a2a008 100644 Binary files a/scripts/__pycache__/fetch_icd11.cpython-312.pyc and b/scripts/__pycache__/fetch_icd11.cpython-312.pyc differ diff --git a/scripts/fetch_icd11.py b/scripts/fetch_icd11.py index 5a965ef..66ae47a 100644 --- a/scripts/fetch_icd11.py +++ b/scripts/fetch_icd11.py @@ -204,8 +204,18 @@ def should_sync(data_dir: Path, release_date: str | None, force: bool = False) - return True return True # No metadata file yet - # If release_date is None/empty but data exists, skip sync - # (WHO API doesn't provide reliable update info) + # If release_date couldn't be fetched, still allow sync + # This handles cases where WHO API endpoint is temporarily unavailable + # Check if we have any existing data + mms_dir = data_dir / "mms" + foundation_dir = data_dir / "foundation" + + # If no data exists at all, we should sync + if not mms_dir.exists() or not foundation_dir.exists(): + return True + + # If data exists but release_date is unavailable, skip only if not forced + # (manual intervention may be needed) return False @@ -515,10 +525,18 @@ def main(data_dir: Path, force: bool = False) -> int: token = get_token(session, client_id, client_secret) console.print("[green]Token obtained.[/green]") - # Fetch release date - with console.status("[bold green]Fetching release date..."): - release_date = fetch_release_date(session, token, start_time, client_id, client_secret) - console.print(f"[green]Release date: {release_date}[/green]") + # Fetch release date (non-blocking - sync proceeds even if unavailable) + release_date: str | None = None + try: + with console.status("[bold green]Fetching release date..."): + release_date = fetch_release_date(session, token, start_time, client_id, client_secret) + if release_date: + console.print(f"[green]Release date: {release_date}[/green]") + else: + console.print("[yellow]Release date not available from API. Proceeding with sync...[/yellow]") + except Exception as e: + console.print(f"[yellow]Could not fetch release date: {e}. Proceeding with sync...[/yellow]") + release_date = None # Check if sync needed if not should_sync(data_dir, release_date, force):