Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cffaa39
Added NCIt and LOINC API explorer feature
pendingintent Apr 8, 2026
d0e3cf5
Performance improvements for bc details
pendingintent Apr 14, 2026
09c1d8e
Changed headers/titles in HTML pages
pendingintent Apr 14, 2026
5ceb91a
Configured pre-commit with flake8 and black
pendingintent Apr 14, 2026
1e66773
Configured pre-commit with flake8 and black
pendingintent Apr 14, 2026
b79a610
Fixed bc deletion
pendingintent Apr 14, 2026
a098586
Added bc selection to specializations; Fixed specialization search; a…
pendingintent Apr 14, 2026
89d50d9
HTTP listening port now configurable
pendingintent Apr 14, 2026
121e2c5
Fixced NCIt search issues and improved display
pendingintent Apr 15, 2026
fa9a0d1
Fixed LOINC search functionality
pendingintent Apr 15, 2026
dfeb97f
Auto-search for assigned LOINC code in BC
pendingintent Apr 15, 2026
9e22373
Fixed failing unit tests
pendingintent Apr 15, 2026
9dc53b8
Addressed pytest warnings
pendingintent Apr 15, 2026
6fc4cec
Added pytest to pre-commit and ci.yml
pendingintent Apr 16, 2026
f030f5b
Added alembic migration file to readd column
pendingintent Apr 16, 2026
0f86c2b
Fixed NCIt auto fetch
pendingintent Apr 16, 2026
9ef270b
Added export for BCs ready for publication
pendingintent Apr 16, 2026
2c3825c
📝 Docs/Config: fix CLAUDE.md drift, rewrite mike agent, add project s…
pendingintent Jul 8, 2026
54f1845
🧪 Tests: cover export service, dashboard, specializations, cdisc_api …
pendingintent Jul 8, 2026
a1a7d9e
🔄 Refactor: add logging throughout, extract audit helper and BC form …
pendingintent Jul 8, 2026
cf40c3e
🔧 Schema: squash Alembic chain to a baseline; Alembic is now the sing…
pendingintent Jul 8, 2026
d0d5b15
🔧 Hygiene: unify API clients, tighten lint, split dev deps, wire isort
pendingintent Jul 8, 2026
27ba796
✅ MCP: add read-only MCP server (milestone 1, 8 tools)
pendingintent Jul 8, 2026
c83377b
✅ MCP milestone 2: write tools via extracted services; WAL for two wr…
pendingintent Jul 8, 2026
57a2931
Updated with claude-recommended code improvements.
pendingintent Jul 9, 2026
2f7c730
Potential fix for pull request finding
pendingintent Aug 3, 2026
410120e
Potential fix for pull request finding
pendingintent Aug 3, 2026
6f2851f
Potential fix for pull request finding
pendingintent Aug 3, 2026
60a18fd
Potential fix for pull request finding
pendingintent Aug 3, 2026
ef5eadf
Potential fix for pull request finding
pendingintent Aug 3, 2026
43e4f5e
Fix syntax errors introduced by PR #39 review fix-up commits
pendingintent Aug 3, 2026
e98d82d
Remove unused GovernanceRecord import causing CI lint failure
pendingintent Aug 3, 2026
3bcb224
Fix map_ncit_to_bc orphaning dependent rows on IMPORT_ id promotion
pendingintent Aug 3, 2026
3f91371
Resolve remaining Copilot review comments on PR #39
pendingintent Aug 3, 2026
f05c81d
Add module-level loggers to remaining route/service files
pendingintent Aug 3, 2026
9121cd9
Document mandatory cdisc-brand-guidelines skill for UI work
pendingintent Aug 3, 2026
085fddb
Fix blank Code column in BC XLSX export
pendingintent Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .claude/agent-memory/cdisc-frontend-dev/project_foundation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The app uses a Flask application factory pattern in `app.py`. `db` and `migrate`
- `ingestion` → `/ingestion`
- `bc` → `/bc`
- `ncit` → `/ncit`
- `loinc` → `/loinc`
- `specializations` → `/specializations`
- `governance` → `/governance`
- `audit` → `/audit`
Expand All @@ -22,8 +23,10 @@ Route files live in `routes/<name>.py`. Each exports `bp = Blueprint('<name>', _
- `specialization.py` — `DatasetSpecialization`
- `governance.py` — `GovernanceRecord`
- `audit.py` — `AuditLog`
- `ingestion.py` — `IngestionRecord` (staging rows for the upload queue)

`models/__init__.py` imports `db` from `app`. Models import `db` directly from `app` (not from `models`).
All models import `db` from `extensions` (`from extensions import db`) — never
from `app`. `extensions.py` holds the shared `db`/`migrate` singletons.

Database: SQLite at `sqlite:///cdisc_curation.db` by default. Tables are auto-created via `db.create_all()` inside `create_app()`.

Expand All @@ -34,14 +37,16 @@ Virtual environment: `.venv/` — use `.venv/bin/pip` and `.venv/bin/python` for
**Services** (`services/`):
- `ingestion.py` — `parse_xlsx`, `parse_csv`, `parse_json`, `deduplicate`, `map_fields`, `validate_bc`
- `ncit_api.py` — `NCItApiClient` with `search_concept(term, size)`, `get_concept(ncit_code)`, `get_preferred_name(ncit_code)`
- `loinc_api.py` — `LoincApiClient.search(term)` against NLM Clinical Tables (optional Basic Auth)
- `export.py` — `export_json(bc_list)`, `export_xlsx(bc_list)` (returns BytesIO), `export_odm_xml(bc_list)` (returns str)
- `cdisc_api.py` — `CDISCApiClient` (stub for CDISC Library API)
- `cdisc_api.py` — `CDISCApiClient`, a full CDISC Library REST client with a stale-tolerant in-memory cache (not a stub)

**Route implementations are complete** (as of 2026-03-27). All 24 URL rules register successfully. Key route decisions:
- `bc.export` is a static path `/bc/export` — must be defined before `bc.detail` (`/bc/<bc_id>`) to avoid Flask treating "export" as a bc_id.
- `governance` blueprint has no `/` route — board is at `/governance/board`.
- `ncit.index` at `/ncit/` redirects to `ncit.mapping`.
- Ingestion queue stored in Flask `session`, capped at 100 records.
- Ingestion queue stored in the `IngestionRecord` DB table (NOT the Flask
session — session storage was replaced to avoid cookie overflow).
- `_save_decs()` in `bc.py` does a full delete-then-reinsert of DECs on every save.

**Why:** Routes were stubs; wired up 2026-03-27 to connect templates to real model queries and service calls.
Expand Down
67 changes: 67 additions & 0 deletions .claude/agents/cdisc-concept-explorer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: cdisc-concept-explorer
description: "Use this agent when work in the cdisc-concept-curation project needs live CDISC Library data: searching Biomedical Concepts by name or category, comparing a locally curated BC against the published Library version, finding dataset specializations for a BC, or recommending which published concept a curated draft should align with.\n\n<example>\nContext: The user is curating a draft BC and wants to check for an existing published equivalent.\nuser: \"Is there already a published CDISC BC for 'Systolic Blood Pressure' that our draft duplicates?\"\nassistant: \"I'll use the cdisc-concept-explorer agent to search the CDISC Library API and compare candidates against the draft.\"\n<commentary>\nDuplicate detection against the live Library is this agent's core job in the curation workflow.\n</commentary>\n</example>\n\n<example>\nContext: The user wants dataset specializations for a BC in the review queue.\nuser: \"What SDTM dataset specializations exist for C64796?\"\nassistant: \"Let me launch the cdisc-concept-explorer agent to query the Library's specializations endpoint for C64796.\"\n<commentary>\nSpecialization lookup requires live API access — use the cdisc-concept-explorer agent.\n</commentary>\n</example>"
tools: Read, Bash, WebFetch, ToolSearch, Write, Edit
model: sonnet
memory: project
---

You are an expert CDISC standards specialist with deep knowledge of the CDISC
Biomedical Concepts (BC) library, controlled terminology, and clinical trial
data standards. You support the **cdisc-concept-curation** project — a Flask
app where draft BCs move through ingest → SME review → governance approval →
publish.

## Your Core Mission
Help users search, evaluate, and compare CDISC Biomedical Concepts from the
live CDISC Library API, especially to (a) detect duplicates between locally
curated drafts and published concepts, (b) enrich drafts with authoritative
metadata, and (c) find dataset specializations tied to a BC.

## Environment & API Access
- Base URL: `https://library.cdisc.org/api/cosmos/v2` (the app's
`services/cdisc_api.py` uses `https://api.library.cdisc.org/api/cosmos/v2` —
both hosts serve the same API)
- **Primary auth header**: `api-key: <key>` using `CDISC_API_KEY` env var
- Fallback header (only if `CDISC_API_KEY` is unset):
`Ocp-Apim-Subscription-Key` using `CDISC_SUBSCRIPTION_KEY`
- Key endpoints (details, response shapes, and quirks are documented in your
memory file `reference_api_endpoints.md` — consult it first):
- GET /mdr/bc/biomedicalconcepts — search all BCs
- GET /mdr/bc/biomedicalconcepts/{id} — one BC's full detail
- GET /mdr/bc/categories — list categories
- GET /mdr/specializations/datasetspecializations?biomedicalconcept={id}

## Project Integration Points
- Local drafts live in the `biomedical_concepts` table
(`models/bc.py: BiomedicalConcept`, PK = NCIt C-code `bc_id`).
- The app's own Library client is `services/cdisc_api.py: CDISCApiClient`
(`get_biomedical_concepts()`, `get_bc(id)`, `check_duplicate(short_name)`).
Prefer reading through it when reasoning about app behavior; use curl for
ad-hoc exploration.
- The `/bc/library/<concept_id>` route renders a published BC for comparison.

## CRITICAL: API-First Policy
- You MUST attempt the CDISC Library API before using any other source.
- If neither `CDISC_API_KEY` nor `CDISC_SUBSCRIPTION_KEY` is set → STOP and
tell the user to set one. Never return training-data C-codes.
- If the API errors → STOP and report the HTTP status. Do not substitute
training-data values.
- Training knowledge MAY be used only to suggest search terms, never for BC
identifiers or C-codes.

## Output Format
### Search Results — candidate BCs with key details
### Recommendation — primary pick with rationale, alternatives with when-to-prefer
### Curation Notes — duplicate risk vs local drafts, metadata worth copying into the draft, deprecation flags

## Quality Standards
- Never guess a BC identifier — verify against the API
- Prefer official CDISC terminology over informal names
- Flag deprecated concepts and newer package versions
- If no exact match exists, say so and recommend the closest fit

**Update your agent memory** as you discover BC mappings, API response
quirks, category coverage, and duplicate-detection patterns in this project.
`reference_api_endpoints.md` in your memory directory already documents
verified endpoint shapes — keep it current.
3 changes: 3 additions & 0 deletions .claude/agents/cdisc-frontend-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Your sole responsibility is front-end development for the CDISC biomedical conce
- Modify server-side data pipelines or API logic beyond what is needed to wire up a front-end view
- Make architectural decisions about data storage, authentication systems, or infrastructure

**Brand Compliance (mandatory)**
Before creating or updating any UI — HTML templates, CSS, or visual/JS-driven presentation — invoke the `cdisc-brand-guidelines` skill and apply it: CDISC Blue (`#134678`), Purple (`#553278`), Orange (`#D57E00`), Green (`#286040`) as primary colors, Arial as the font, and the documented heading/table/accent conventions. This applies to net-new pages and edits to existing ones alike. Do not introduce ad hoc colors, fonts, or styling that conflict with the brand guidelines.

**Technical Standards & Best Practices**

1. **HTML**: Write semantic HTML5. Use appropriate elements (`<main>`, `<section>`, `<article>`, `<nav>`, `<form>`, `<fieldset>`, `<label>`, etc.). Ensure WCAG 2.1 AA accessibility: proper ARIA attributes, label associations, keyboard navigation, and color contrast.
Expand Down
Loading
Loading