Project: doctolib-worktrees · Branch: HEAD · Mode: ` · **Model:**claude-haiku-4-5-20251001`
Stats: 1 user messages, 2 tool calls, tools used: Bash.
Conversation
Turn 1 — User
Fetch PR #239184 from doctolib/doctolib and return a detailed summary.
Run:
1. gh pr view 239184 --repo doctolib/doctolib --json title,body,files,baseRefName,headRefName,headRefOid
2. gh pr diff 239184 --repo doctolib/doctolib
Return: - PR title and description summary - List of all changed files with their change type (added/modified/deleted) - The head commit SHA (full) - The branch name - A summary of what the PR does (based on description and diff)
Turn 1 — Assistant
I'll fetch the PR details and diff for you.
Tools used:
Bash:gh pr view 239184 --repo doctolib/doctolib --json title,body,files,baseRefName,headRefName,headRefOid
Tools used:
Bash:gh pr diff 239184 --repo doctolib/doctolib
Tool results:
→ result (ok): {"baseRefName":"master","body":"## Why\r\n\r\nhttps://doctolib.atlassian.net/browse/FHIR-2181\r\n\r\nAfter FHIR-2089 was merged, filtering on the NHR document list appeared to do nothing. Four bugs were identified as the root cause.\r\n\r\n## How\r\n\r\nFixed each bug at its source in the filter mapper, mock generator, and hook:\r\n\r\n1. Status filter baseline — mapStatusFilter was always including DOCUMENT_STATUS.validated in the bitmask even when no checkboxes were checked, causing `i
…(truncated, 3535 more chars)
Tool results:
→ result (ok): <persisted-output> Output too large (41.9KB). Full output saved to: /Users/USER/.claude/projects/-Users-clertonra-workspace-doctolib-worktrees/c49d00a1-5b2b-48f2-9df6-7cdab509907c/tool-results/b7vq312e8.txt
Preview (first 2KB): diff --git a/packages/@doctolib/national-health-records/src/hooks/useSearchDocuments.test.ts b/packages/@doctolib/national-health-records/src/hooks/useSearchDocuments.test.ts index c43d23517926e..c587d51fa1366 100644 --- a/packages/@doctolib/national-health-records/src/h …(truncated, 1713 more chars)
PR Summary
Title: fix(FHIR-2181): fix document list filters not applying on NHR document list
Base Branch: master
Head Branch: fhir-2181-fix-filtering
Head Commit SHA: 3affc72b3fed042d4589a040d638483a237d90c3
Description
This PR fixes four critical bugs in the NHR document list filtering that were introduced in a prior FHIR-2089 merge. The filtering was completely non-functional—toggles had no effect on the document list.
Root Causes Fixed:
-
Status filter baseline bug —
mapStatusFilterwas always includingDOCUMENT_STATUS.validatedin the bitmask even when no checkboxes were checked, defaulting to validated-only. Fixed to returnundefinedwhen no filters selected, letting DMP apply its own default. -
Procedure date filter type mismatch —
createNhrDateSelectionFilterConfigemitsdateTypeasstring[](e.g.,['procedureDate']), butmapDateFilterscompared it as a scalar string, always falling through tosubmissionDate. AddedresolveDateType()helper to normalize both array and scalar forms. -
Mock mode ignored filters —
useSearchDocumentscalledgenerateNhrDocuments()without passingappliedFilters, making all filter toggles invisible in mock mode. Fixed by callingfilterMockNhrDocuments(allDocs, appliedFilters). -
Mock document type column empty — Mock documents used
system: 'LOINC'butgetTypeCode()expectssystem: 'dmp:classCode'. Updated all mock document fixtures to use the correct system value.
Changed Files
| File | Changes |
|---|---|
packages/@doctolib/national-health-records/src/hooks/useSearchDocuments.test.ts |
+37 / -6 (updated mocks, added filtered document test data) |
packages/@doctolib/national-health-records/src/hooks/useSearchDocuments.ts |
+4 / -2 (mock path now calls filterMockNhrDocuments) |
packages/@doctolib/national-health-records/src/mocks/filterMockedDocuments.test.ts |
+194 / -0 (new test file for mock filtering) |
packages/@doctolib/national-health-records/src/mocks/filterMockedDocuments.ts |
+74 / -0 (new filter implementation for mocks) |
packages/@doctolib/national-health-records/src/mocks/generateNhrDocuments.ts |
+3 / -1 (fixed system code in buildRandomDocument) |
packages/@doctolib/national-health-records/src/mocks/nhrMockedDocuments.ts |
+38 / -38 (updated all LOINC to dmp:classCode) |
packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.test.ts |
+13 / -2 (added test for dateType as string[]) |
packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.ts |
+16 / -3 (added resolveDateType helper, fixed status filter logic) |
What the PR Does
Restores full filtering functionality to the NHR document list by fixing type mismatches in filter mappers, correcting mock document system codes, ensuring applied filters reach mock documents, and proper handling of empty filter selections. All 19 unit tests pass and the fixes have been validated through dev testing with a video demonstration.