Skip to content

Feat/acronym search 02 redis cache - #5

Open
borkarsaish65 wants to merge 7 commits into
ELEVATE-Project:release-2.1.0from
borkarsaish65:feat/acronym-search-02-redis-cache
Open

Feat/acronym search 02 redis cache#5
borkarsaish65 wants to merge 7 commits into
ELEVATE-Project:release-2.1.0from
borkarsaish65:feat/acronym-search-02-redis-cache

Conversation

@borkarsaish65

Copy link
Copy Markdown

No description provided.

Adds Alembic with a no-op baseline revision for the pre-existing
unmanaged translations table, plus a migration that creates
acronym_mapping (id PK, expansions as JSONB array, description,
composite index on acronym+is_active) and seeds it from
data/acronyms.csv, now the real 599-acronym dataset.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 09180670-785d-4058-9c0e-86b22284d458

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@borkarsaish65
borkarsaish65 force-pushed the feat/acronym-search-02-redis-cache branch from 57ea05e to f160cd7 Compare August 14, 2026 07:36
Comment thread app/core/clients/redis_client.py Outdated
Comment thread app/main.py Outdated
Comment thread app/services/acronym_service.py Outdated
borkarsaish65 and others added 4 commits August 24, 2026 11:13
…migration

Adds created_by/updated_by audit columns (default SYSTEM) to the model
and migration, validates the seed CSV exists/has expected columns/isn't
empty before running any DDL, adds DEO/BEO/SPD/CDPO/DC role acronyms
plus a second DM expansion (District Magistrate), and clarifies that
alembic.ini's sqlalchemy.url placeholder is overridden by env.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
get_expansion() checks Redis first, falls back to Postgres on miss,
writes through to cache; warm_cache() pre-populates every active
acronym at startup. Redis pieces (cache_client.py, redis_client.py)
stay acronym-agnostic; only acronym_service.py knows about acronyms,
JSON-encoding the expansions array for the string-only cache layer.
get_expansion() only handled a cache miss (Redis says "not found"),
not a cache error (Redis unreachable/timing out) — the latter raised
straight out of the function before Postgres was ever tried, so a
Redis outage broke every acronym-detected search instead of just
degrading it. Now both the cache read and the write-through are
guarded: any Redis error logs a warning and falls back to Postgres,
matching the fallback behavior main.py's startup path already
assumes exists.
Makes the Redis logical DB configurable via REDIS_DB (was hardcoded to
0), renames warm_cache to load_acronym_cache to match its call site,
and moves the acronym cache-key prefix into a new app/constants.py
instead of a module-local constant.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@borkarsaish65
borkarsaish65 force-pushed the feat/acronym-search-02-redis-cache branch from f670964 to 667cf44 Compare August 24, 2026 06:34
borkarsaish65 and others added 2 commits August 24, 2026 12:06
Missed when REDIS_DB was added to app/config.py for PR ELEVATE-Project#5's review
comment (Redis DB index was hardcoded, now env-driven).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Review comment on fork PR #1: "row" didn't say what it held. Renamed
to "mapping" to match the AcronymMapping model it comes from.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants