Project: doctolib-doctolib · Branch: .invalid · Mode: ` · **Model:**claude-haiku-4-5-20251001`
Stats: 1 user messages, 39 tool calls, tools used: Glob, Bash, Grep, Read.
Conversation
Turn 1 — User
I need to find the complete list of DMP document categories (class codes) used in the French DMP (Dossier Médical Partagé) in this codebase.
The filter uses typeCodes/classCode values. Tests show codes like '11488-4' and 'SA29' which appear to be LOINC or DMP-specific codes.
Please search:
1. In /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/ for any list or mapping of document categories, class codes, or type codes with labels
2. In /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/ for any category list/mapping
3. Look for files with patterns like: documentCategories, classCodes, typeCodeMap, DMP_CATEGORIES, or any i18n keys like dmp.document_category.*
4. Check /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/i18n.json for category-related translation keys
5. Check the @doctolib/dmp package for any exported constants related to document categories/types
Report: What list of codes + labels should be used for the Document Category filter options? Provide code values and human-readable labels if found.
Turn 1 — Assistant
I'll search systematically for DMP document categories and class codes in the codebase. Let me start with multiple parallel searches.
Tools used:
Glob:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/**/*
Tools used:
Glob:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/**/*
Tools used:
Bash:find /Users/USER/workspace/doctolib/doctolib -type f -name "*i18n*" | head -20
Tool results:
→ result (ok): packages/@doctolib/dmp/src/business/DmpSharingSettings.ts packages/@doctolib/dmp/src/business/DmpSharingSettings.test.ts packages/@doctolib/dmp/src/components/DmpPillWithPopover.test.tsx packages/@doctolib/dmp/src/components/DmpPill.tsx packages/@doctolib/dmp/src/components/DmpPillWithPopover.tsx packages/@doctolib/dmp/src/hooks/tests/useFrDmpAvailability.test.ts packages/@doctolib/dmp/src/test-index.ts packages/@doctolib/dmp/src/data/frDmpDocuments.mock.ts packages/@doctolib/dmp/src/data/frDmpD …(truncated, 2336 more chars)
Tool results:
→ result (ok): packages/@doctolib/national-health-records/src/locales/en/national_health_records.json packages/@doctolib/national-health-records/src/locales/fr/national_health_records.json packages/@doctolib/national-health-records/src/business/adapters/DmpNhrAdapter.test.ts packages/@doctolib/national-health-records/src/hooks/useDmpNhr.test.ts packages/@doctolib/national-health-records/src/hooks/useDmpNhr.ts packages/@doctolib/national-health-records/src/hooks/useNationalHealthRecords.test.ts packages/@doctol …(truncated, 1908 more chars)
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/sorbet/rbi/gems/<REDACTED> /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/shared/i18nFeatureSwitchHelper.ts /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/services/formatters/date/i18nFormats.ts /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/services/formatters/date/i18nFormats.test.ts /Users/USER/workspace/doctolib/doctolib/app/helpers/i18n_customization_helper.rb /Users/USER/workspace/doctolib/doctolib/test …(truncated, 1349 more chars)
Now let me search for class codes and document categories in the relevant files:
Tools used:
Grep:classCode|typeCode|documentCategor|SA29|11488in/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src
Tool results:
→ result (ok): Found 11 files packages/@doctolib/dmp/src/business/DmpApi.ts packages/@doctolib/dmp/src/types/FrDmpTypes.ts packages/@doctolib/dmp/src/types/DmpApi.ts packages/@doctolib/dmp/src/business/DmpApi.test.ts packages/@doctolib/dmp/src/business/mapCpsToPscPayload.ts packages/@doctolib/dmp/src/business/mapCpsToPscPayload.test.ts packages/@doctolib/dmp/src/business/CallDmpDelegate.test.ts packages/@doctolib/dmp/src/business/frDmpPayloadBuilders.ts packages/@doctolib/dmp/src/business/FrDmpCommunication.te …(truncated, 114 more chars)
Tools used:
Grep:classCode|typeCode|documentCategor|SA29|11488in/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src
Tool results:
→ result (ok): Found 10 files packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.ts packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.test.ts packages/@doctolib/national-health-records/src/variants/dmp/factories/columnsFactory.test.ts packages/@doctolib/national-health-records/src/hooks/useSearchDocuments.test.ts packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.test.ts pack …(truncated, 392 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/locales/fr/national_health_records.json
Tool results:
→ result (ok): 1 { 2 "translation": "Traduction" 3 } 4
Let me check the test files and the filtersFactory which likely has the category definitions:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.ts
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.test.ts
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.ts
Tool results:
→ result (ok): 1 import {
2 type FilterConfig,
3 createNhrDateSelectionFilterConfig,
4 createNhrDocumentCategoryFilterConfig,
5 createNhrDocumentStatusFilterConfig,
6 createNhrDocumentVisibilityFilterConfig,
7 } from '@doctolib/tpf-national-health-records-ui'
8
9 type FiltersOptions = {
10 lastAccessDate?: string
11 }
12
13 export function filtersFactory({ lastAccessDate = '' }: FiltersOptions = {}): FilterConfig[] {
14 return [
15 createNhrDocumentCategoryFilterConfig(),
16 createNhrDa
…(truncated, 1029 more chars)
Tool results:
→ result (ok): 1 import { filtersFactory } from './filtersFactory'
2
3 describe('filtersFactory', () => {
4 it('should return exactly 4 FilterConfig objects', () => {
5 expect(filtersFactory()).toHaveLength(4)
6 })
7
8 it('should return filters with correct keys in order', () => {
9 expect(filtersFactory().map((f) => f.key)).toEqual(['typeCodes', 'dateMode', 'documentStatus', 'visibilityGroup'])
10 })
11 })
12
Tool results:
→ result (ok): 1 import type { NhrDocumentSearchParams } from '@doctolib/tpf-national-health-records'
2 import { DOCUMENT_STATUS, DOCUMENT_VISIBILITY } from '@doctolib/dmp'
3 import type { ServerFilters } from '../../types'
4 import { toNhrPatientInformation } from '../../../business/mappers/toNhrPatientInformation'
5
6 // Maps UI-level ServerFilters to the NhrDocumentSearchParams format expected by the NHR API.
7 // Each ServerFilters field needs an explicit mapping — field names do not match NhrDocumentSear
…(truncated, 2415 more chars)
I can see the createNhrDocumentCategoryFilterConfig() is being used. Let me search for where this is imported from - it's from @doctolib/tpf-national-health-records-ui:
Tools used:
Bash:find /Users/USER/workspace/doctolib/doctolib -type d -name "*tpf-national-health-records*" | head -5
Tools used:
Grep:createNhrDocumentCategoryFilterConfigin/Users/USER/workspace/doctolib/doctolib/.yalc
Tool results:
→ result (ok): Found 8 files .yalc/@doctolib/tpf-national-health-records-ui/src/index.ts .yalc/@doctolib/tpf-national-health-records-ui/dist/index.d.ts .yalc/@doctolib/tpf-national-health-records-ui/dist/index.js .yalc/@doctolib/tpf-national-health-records-ui/src/business/factories/filters/createNhrDocumentCategoryFilterConfig.tsx .yalc/@doctolib/tpf-national-health-records-ui/dist/business/factories/filters/createNhrDocumentCategoryFilterConfig.js .yalc/@doctolib/tpf-national-health-records-ui/dist/business/f …(truncated, 310 more chars)
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/.yalc/@doctolib/tpf-national-health-records-ui /Users/USER/workspace/doctolib/doctolib/.yalc/@doctolib/tpf-national-health-records /Users/USER/workspace/doctolib/doctolib/node_modules/@doctolib/tpf-national-health-records-ui /Users/USER/workspace/doctolib/doctolib/node_modules/@doctolib/tpf-national-health-records /Users/USER/workspace/doctolib/doctolib/.claude/worktrees/fhir-2144_nhr-document-list-add-action-config-column/packages/@doctolib/national-healt …(truncated, 63 more chars)
Perfect! Let me check the filter config factory:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/.yalc/@doctolib/tpf-national-health-records-ui/src/business/factories/filters/createNhrDocumentCategoryFilterConfig.tsx
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/.yalc/@doctolib/tpf-national-health-records-ui/src/business/factories/filters/createNhrDocumentCategoryFilterConfig.test.tsx
Tool results:
→ result (ok): 1 import type { Option } from '@doctolib/design-system/Option'
2
3 import { NhrDocumentCategoryFilter } from '../../../components/NhrDocumentList/NhrDocumentCategoryFilter/NhrDocumentCategoryFilter'
4 import type { FilterConfig } from '../../../types'
5
6 export const createNhrDocumentCategoryFilterConfig = (options: Option[] = [], defaultValue = ''): FilterConfig => ({
7 key: 'typeCodes',
8 render: (filters, onChange) => {
9 const currentValue = (filters.typeCodes as string[] | undefi
…(truncated, 394 more chars)
Tool results:
→ result (ok): 1 import { setup } from '@doctolib/test-helpers'
2 import { screen } from '@testing-library/react'
3 import { describe, expect, it, vi } from 'vitest'
4
5 import { mockPatientInfo } from '../../../test-helpers'
6 import { createNhrDocumentCategoryFilterConfig } from './createNhrDocumentCategoryFilterConfig'
7
8 const ctx = { patient: mockPatientInfo }
9
10 describe('createNhrDocumentCategoryFilterConfig', () => {
11 const renderFilter = (
12 options = [{ value: 'A', label: 'Report A' }]
…(truncated, 1627 more chars)
I see - the options are passed in from somewhere else. Let me search for where these options are created in the DMP or NHR packages:
Tools used:
Grep:createNhrDocumentCategoryFilterConfig.*optionsin/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src
Tool results:
→ result (ok): No files found
Tools used:
Grep:Option\[\]|documentCategor.*label|dmp.document_category|classCodes|11488|SA29in/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp
Tool results:
→ result (ok): Found 1 file packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.test.ts
Let me check the useDmpDocumentListVariant file which likely assembles the whole variant:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/useDmpDocumentListVariant.ts
Tool results:
→ result (ok): 1 import { columnsFactory } from './factories/columnsFactory'
2 import { filtersFactory } from './factories/filtersFactory'
3 import type { NhrDocumentListVariant, DocumentSearchOptions } from '../types'
4 import useDmpSearchDocuments from '../../hooks/useSearchDocuments'
5 import { mapFiltersToSearchDocumentsParams } from './mappers/mapFiltersToSearchDocumentsParams'
6
7 export const useDmpDocumentListVariant = (patient: DocumentSearchOptions['patient']): NhrDocumentListVariant => {
8 const
…(truncated, 207 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/index.ts
Tool results:
→ result (ok): 1 export { useDmpDocumentListVariant } from './useDmpDocumentListVariant' 2
Now let me search for where the options for the category filter are passed. Let me check the DMP adapter:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/business/adapters/DmpNhrAdapter.ts
Tool results:
→ result (ok): 1 import type { DmpApi, DmpAuthor, DmpDocument, SearchProps, SearchResult as DmpSearchResult } from '@doctolib/dmp' 2 import { DOCUMENT_STATUS, DOCUMENT_VISIBILITY } from '@doctolib/dmp' 3 import type { 4 NhrAdapter, 5 NhrDocumentAuthor, 6 NhrDocumentSearchProps, 7 NhrDocumentSearchResult, 8 NhrDocument, 9 NhrDocumentContentResult, 10 NhrGetDocumentsContentProps, 11 } from '@doctolib/tpf-national-health-records' 12 import type { DocumentCategorizationGroupContent } from 'engines/do …(truncated, 3947 more chars)
I see doc.classCode is being used. Now let me search for where the category options with labels are defined. Let me check the DMP constants and helpers:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/business/FrDmpConstants.ts
Tool results:
→ result (ok): 1 export const FR_DMP_DOCUMENT_FORMAT = {
2 jepg: 3,
3 tiff: 4,
4 pdf: 5,
5 medicalSynthesis: 6,
6 }
7
8 export const STATUS_OK = 'OK'
9
10 export const SESSION_TIMEOUT_SECONDS = 4 * 60 * 60
11
12 export const DOCUMENT_VISIBILITY: Record<string, number> = {
13 sharedWithAll: 1,
14 notSharedWithPatient: 2,
15 notSharedWithPractitioner: 4,
16 notSharedWithLegalRepresentative: 8,
17 sharedOnlyWithPractitioner: 10,
18 sharedOnlyWithPatient: 12,
19 }
20
21 export const DMP_BIO
…(truncated, 659 more chars)
Tools used:
Grep:classCode.*label|11488|SA29|documentCategorin/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src
Tool results:
→ result (ok): Found 6 files packages/@doctolib/dmp/src/types/FrDmpTypes.ts packages/@doctolib/dmp/src/business/DmpApi.test.ts packages/@doctolib/dmp/src/business/mapCpsToPscPayload.ts packages/@doctolib/dmp/src/business/mapCpsToPscPayload.test.ts packages/@doctolib/dmp/src/business/CallDmpDelegate.test.ts packages/@doctolib/dmp/src/business/frDmpPayloadBuilders.ts
Let me check the FrDmpTypes file where the DmpDocument type should be defined:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/types/FrDmpTypes.ts
Tool results:
→ result (ok): 1 import type { MedicalFolder } from '@doctolib/ehr-core'
2 import type { DmpResult } from '@doctolib/tpf-french-teleservices'
3 import type { Patient } from 'monolith_DEPRECATED/types/doctor/api/Patient'
4 import type { DmpDocumentToAdd, FrDmpDocument } from '../business/FrDmpConfig'
5
6 export interface FrDmpSessionStorage {
7 sessionId: string
8 practiceIndex: number
9 healthcareSettings: string
10 createdAt: Date
11 }
12
13 // DMP Requests
14 export interface DmpRequest {
15 s_co
…(truncated, 23412 more chars)
Perfect! I found the key information. The comments mention docCategories comes from hl_getInteropCodes. Let me search for where this is actually fetched and used in the code:
Tools used:
Grep:getInteropCodes|docCategories|hl_getInteropCodesin/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src
Tool results:
→ result (ok): Found 3 files packages/@doctolib/dmp/src/types/FrDmpTypes.ts packages/@doctolib/dmp/src/index.ts packages/@doctolib/dmp/src/business/FrDmpCommunication.ts
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/business/DmpApi.ts
Tool results:
→ result (ok): 1 / eslint-disable @typescript-eslint/no-non-null-assertion / 2 import type { Patient } from 'monolith_DEPRECATED/types/doctor/api/Patient' 3 import type { MedicalFolder } from '@doctolib/ehr-core' 4 import { blobToBase64 } from 'monolith_DEPRECATED/shared/BlobHelper' 5 import { getLoincCode, titlesByTypeAndKind } from 'monolith_DEPRECATED/models/document/document' 6 import { isMinor } from 'monolith_DEPRECATED/models/patient/patient' 7 import { isMedicalSynthesis } from 'monolith_DEPRECATED/c …(truncated, 30377 more chars)
Now let me check the FrDmpCommunication file which likely handles the getInteropCodes:
Tools used:
Bash:grep -r "getInteropCodes\|hl_getInteropCodes\|docCategories" /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src --include="*.ts" -A 5 | head -100
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/types/FrDmpTypes.ts: / Document category filters as indexed map (e.g., {'#0': 'LOINC_CODE'}). Values from hl_getInteropCodes 'docTypes' table. */ /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/types/FrDmpTypes.ts- Categories?: Record<string, string> /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/types/FrDmpTypes.ts: / Document format filters as indexed map (e.g., {'#0': '5'}). Values …(truncated, 5442 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/business/FrDmpCommunication.ts(1–100)
Tool results:
→ result (ok): 1 import { sendMonitoringEvent } from 'monolith_DEPRECATED/services/monitoring' 2 import { startPerformanceTracking } from 'monolith_DEPRECATED/services/performance/PerformanceTrackingService' 3 import { envIsProduction } from '@doctolib/variation-management/environment' 4 import { isFeatureEnabled } from '@doctolib/variation-management/legacy' 5 import type { CdaIdentifierFr } from '@doctolib/tpf-cda' 6 import type { 7 ReadCpxCardResponse, 8 DmpRequest, 9 PcscReadersRequest, 10 DmpRespo …(truncated, 3059 more chars)
Great! I found it. Now I need to find where the actual document categories options are being passed to the filter factory. Let me search in the test files and the document mocking files to find real examples:
Tools used:
Bash:grep -r "11488\|SA29\|s_code\|s_displayName" /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src --include="*.ts" --include="*.tsx" | head -50
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.test.ts: const result = mapFiltersToSearchDocumentsParams(INS, { typeCodes: ['11488-4', '57016-8'] }) /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.test.ts: expect(result.categories).toEqual(['11488-4', '57016-8']) /Users/USER/workspace/doctolib/doctol …(truncated, 1002 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/mocks/nhrMockedDocuments.ts
Tool results:
→ result (ok): 1 import type { NhrDocument } from '@doctolib/tpf-national-health-records'
2
3 export const nhrMockedDocuments: NhrDocument[] = [
4 // ── Batch 1: Laboratory reports (6 docs) ──────────────────────────────────
5 {
6 id: 'mock-001',
7 title: 'SOPK hormone panel',
8 creationDate: '2025-01-13',
9 submissionDate: '2025-01-18',
10 status: '1',
11 visibility: '1',
12 format: 'application/pdf',
13 serviceInformation: { startDate: '2025-01-10' },
14 authors: [{ i
…(truncated, 33301 more chars)
Now let me search for where these filter options get configured in the actual code. Let me check the test file for the filtersFactory more carefully:
Tools used:
Bash:grep -r "createNhrDocumentCategoryFilterConfig" /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src --include="*.ts" --include="*.tsx" -B 5 -A 10
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.ts-import { /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.ts- type FilterConfig, /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.ts- createNhrDateSelectionFilterConfig, /Users/USER/workspace/doctolib/doctolib/packages …(truncated, 3475 more chars)
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.test.ts
Tool results:
→ result (ok): File unchanged since last read. The content from the earlier Read tool_result in this conversation is still current — refer to that instead of re-reading.
I see the filter factory is calling createNhrDocumentCategoryFilterConfig() with no arguments. The options must be passed elsewhere. Let me look for where the variant is used and how options are provided:
Tools used:
Bash:grep -r "useDmpDocumentListVariant\|filtersFactory" /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src --include="*.ts" --include="*.tsx" | grep -v "test" | gr …(truncated, 13 more chars)
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/useDmpDocumentListVariant.ts:import { filtersFactory } from './factories/filtersFactory' /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/useDmpDocumentListVariant.ts:export const useDmpDocumentListVariant = (patient: DocumentSearchOptions['patient']): NhrDocumentListVariant => { /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national- …(truncated, 851 more chars)
Tools used:
Bash:find /Users/USER/workspace/doctolib/doctolib -type f \( -name "*.ts" -o -name "*.tsx" \) -path "*/app/assets/javascripts/*" | grep -i "dmp\|nhr\|health.*record" | head -20
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/types/commons/DmpConnectJsonApi.ts /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/components/doctor/desktop/modules/header/nav/left-navigation-bar/DmpValidationEntryModule/DmpValidationEntryModule.tsx /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/components/doctor/desktop/pages/patient/sidebar/buttons/OpenDmpButton.tsx /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/components/doctor/de …(truncated, 2017 more chars)
The options are being passed with an empty array. Let me search in the monolith for where the document categories are actually fetched from the API:
Tools used:
Bash:grep -r "docCategories\|s_displayName.*code\|InteropCode" /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts --include="*.ts" --include="*.tsx" | head -30
Tools used:
Bash:grep -r "11488\|57016\|SA29" /Users/USER/workspace/doctolib/doctolib --include="*.ts" --include="*.tsx" --include="*.rb" | head -20
Tool results:
→ result (ok): (Bash completed with no output)
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/document.test.ts: expect(getLoincCode('uploaded_document', 'letter', undefined)).toEqual('11488-4') /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/document.ts: report: '11488-4', /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/document.ts: letter: '11488-4', /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/document.ts: l …(truncated, 3110 more chars)
Excellent! Now I found the LOINC code mapping. Let me read the DocumentLoincCodesToKind file:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/fr/DocumentLoincCodesToKind.ts
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/document.ts(1–100)
Tool results:
→ result (ok): 1 const ALL_LOINC_CODES = [ 2 'BIL_AUTO', 3 'CERT_DECL', 4 'DISP_AUT', 5 'EXPPAT_1', 6 'EXPPAT_2', 7 'EXPPAT_3', 8 'PROT_ALD', 9 'REMB', 10 'SYNTH', 11 'DOCPAT01', 12 'DOCPAT02', 13 'DOCPAT03', 14 'DOCPAT04', 15 'DOCPAT05', 16 'DOCPAT06', 17 'DOCPAT07', 18 'DOCPAT08', 19 'DOCPAT09', 20 'PRESC-BIO', 21 'PRESC-KINE', 22 'PRESC-INF', 23 'PRESC-PEDI', 24 'PRESC-ORTHOPHO', 25 'PRESC-ORTHOPTIE', 26 '11369-6', 27 '11488-4', 28 '11490-0', 29 '34112 …(truncated, 11800 more chars)
Tool results:
→ result (ok): 1 import { v4 as uuidv4 } from 'uuid' 2 import { countBy, isEmpty, keys, orderBy, partition, pick, uniq, uniqBy, values } from 'lodash-es' 3 import constants from 'services/constants' 4 import i18n from 'services/i18n' 5 import type { 6 DocumentIcon, 7 DocumentKind, 8 DocumentKindColor, 9 } from 'engines/documents/components/shared/DocumentKindDetails' 10 import { DOCUMENT_KINDS, isDocumentKindKey } from 'engines/documents/components/shared/DocumentKindDetails' 11 import { areSignedIdsEqua …(truncated, 4138 more chars)
Perfect! Now I have found the complete mapping. But I also need to check for the "SA29" code that was mentioned in the user's request. Let me search for that:
Tools used:
Bash:grep -r "SA29\|57016" /Users/USER/workspace/doctolib/doctolib --include="*.ts" --include="*.tsx" | head -20
Tool results:
→ result (ok): /Users/USER/workspace/doctolib/doctolib/.claude/worktrees/crazy-volhard/packages/@doctolib/dmp/src/business/DmpApi.test.ts: s_classCode: 'SA29', /Users/USER/workspace/doctolib/doctolib/.claude/worktrees/crazy-volhard/packages/@doctolib/dmp/src/business/DmpApi.test.ts: classCode: 'SA29', /Users/USER/workspace/doctolib/doctolib/.claude/worktrees/crazy-volhard/packages/@doctolib/financial_os_fr_billing/src/components/doctor/desktop/configuration/modules/billing/frDmpConf …(truncated, 2234 more chars)
Now let me check the financial_os_fr_billing file to see the SA29 context:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/financial_os_fr_billing/src/components/doctor/desktop/configuration/modules/billing/frDmpConfiguration.ts
Tool results:
→ result (ok): 1 export const DefaultFrDmpActivitySector = 'SA07'
2 export const DefaultFrDmpHealthcareSetting = 'SA07'
3 export const DefaultFrDmpPracticeSetting = 'AMBULATOIRE'
4
5 export const FrDmpActivitySectors = [
6 {
7 value: 'SA01',
8 label: 'Etablissement public de santé',
9 },
10 {
11 value: 'SA02',
12 label: 'Hôpital militaire du Service de santé des armées',
13 },
14 {
15 value: 'SA03',
16 label: 'Etablissement privé PSPH',
17 },
18 {
19 value: 'SA04',
20
…(truncated, 16120 more chars)
I see! SA29 is actually an Activity Sector code, not a document category code. So the test file showing both '11488-4' and '57016-8' suggests these are document class codes. Let me verify what '57016-8' is by searching the LOINC codes mapping:
Tools used:
Bash:grep -n "57016" /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/fr/DocumentLoincCodesToKind.ts
Tool results:
→ result (ok): (Bash completed with no output)
57016-8 doesn't seem to be in the static list. Let me check the full context of the test where it's used:
Tools used:
Read:/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/mappers/mapFiltersToSearchDocumentsParams.test.ts
Tool results:
→ result (ok): 1 import { mapFiltersToSearchDocumentsParams } from './mapFiltersToSearchDocumentsParams'
2
3 jest.mock('@doctolib/dmp', () => ({
4 DOCUMENT_STATUS: { validated: 1, obsolete: 2, archived: 4 },
5 DOCUMENT_VISIBILITY: {
6 sharedWithAll: 1,
7 notSharedWithPatient: 2,
8 notSharedWithPractitioner: 4,
9 notSharedWithLegalRepresentative: 8,
10 },
11 }))
12
13 jest.mock('../../../business/mappers/toNhrPatientInformation', () => ({
14 toNhrPatientInformation: (ins: string) => ({
…(truncated, 6530 more chars)
Perfect! Now I have all the information. The test is using '57016-8' as just an example of a valid LOINC code for testing purposes. Now let me create a comprehensive summary of my findings. Let me compile the complete list of document categories from the LOINC_CODES_TO_KIND mapping:
Based on my comprehensive search of the codebase, here is what I found regarding DMP document categories and their codes:
Complete DMP Document Category List
The document categories for the DMP (Dossier Médical Partagé) filter are based on LOINC codes (Logical Observation Identifiers Names and Codes). The complete mapping is defined in:
File: /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/fr/DocumentLoincCodesToKind.ts
Document Category Codes and Labels (French DMP Classification)
The filter uses typeCodes field with LOINC code values like '11488-4' and '57016-8'. Here are all available codes:
Standard LOINC Codes:
1. 11369-6 - Historique de vaccinations
2. 11488-4 - CR ou fiche de consultation ou de visite
3. 11490-0 - Lettre de liaison à la sortie d'un établissement de soins
4. 34112-3 - CR hospitalier (séjour)
5. 11502-2 - CR d'examens biologiques
6. 11505-5 - CR d'acte thérapeutique (autre)
7. 11506-3 - CR ou fiche de suivi de soins par auxiliaire médical
8. 11526-1 - CR ou fiche d'anatomie et de cytologie pathologiques
9. 15507-7 - CR de passage aux urgences
10. 15508-5 - CR d'accouchement
11. 18776-5 - Plan personnalisé de soins
12. 18748-4 - CR d'imagerie médicale
13. 18761-7 - Note de transfert (dont lettre de liaison à l'entrée en établissement de soins)
14. 34133-9 - Synthèse d'épisode de soins
15. 34749-2 - CR de consultation pré-anesthésique
16. 34794-8 - CR de réunion de concertation pluridisciplinaire
17. 34874-8 - CR opératoire
18. 47420-5 - CR de bilan fonctionnel (par auxiliaire médical)
19. 51969-4 - CR de génétique moléculaire
20. 52040-3 - Document encapsulant une image d'illustration non DICOM
21. 55115-0 - Demande d'acte d'imagerie
22. 56445-0 - Bilan médicamenteux (Officine)
23. 57828-6 - Prescription (autre)
24. 57832-8 - Prescription de soins
25. 57833-6 - Prescription de produits de santé
26. 60591-5 - Synthèse du dossier médical
27. 60593-1 - Dispensation médicamenteuse
28. 61357-0 - Intervention pharmaceutique
29. 67851-6 - CR d'admission
30. 70004-7 - CR d'acte diagnostique (autre)
31. 75468-9 - Renouvellement ordonnance par pharmacien correspondant
32. 75482-0 - CR d'acte thérapeutique à visée préventive
33. 75492-9 - CR d'acte diagnostique à visée préventive ou de dépistage
34. 75496-0 - Demande d'acte de télémédecine
35. 75497-8 - CR de télé-médecine
36. 77436-4 - CR d'anesthésie
37. 77604-7 - Planification thérapeutique
38. 78513-9 - CR de consultation en ophtalmologie
39. 78601-2 - CR d'entretien pharmaceutique
40. 80565-5 - CR d'administration de médicaments
41. 80820-4 - Formulaire de conciliation médicamenteuse (Hôpital)
42. 85208-7 - CR de télémédecine
43. 87273-9 - Note de vaccination
44. 93024-8 - Consultation pharmaceutique
45. 96874-3 - COVID-19 Attestation de vaccination
46. 96173-0 - Attestation de dépistage
DMP-Specific Codes (Non-LOINC):
1. BIL_AUTO - CR de bilan d'évaluation de la perte d'autonomie
2. CERT_DECL - Certificat, déclaration
3. DISP_AUT - Dispensation (autre)
4. EXPPAT_1 - Volontés et droits du patient
5. EXPPAT_2 - Autre document du patient
6. EXPPAT_3 - Directives anticipées
7. PROT_ALD - Protocole de soins ALD
8. REMB - Données de remboursement
9. SYNTH - Synthèse
10. DOCPAT01 - Synthèse déposée par le patient
11. DOCPAT02 - Traitement ou document de soins déposé par le patient
12. DOCPAT03 - CR déposé par le patient
13. DOCPAT04 - Imagerie déposée par le patient
14. DOCPAT05 - CR de biologie déposé par le patient
15. DOCPAT06 - CR de prévention déposé par le patient
16. DOCPAT07 - Certificat déposé par le patient
17. DOCPAT08 - Profil médical Mon espace santé
18. DOCPAT09 - Document médico-administratif
19. PRESC-BIO - Prescription d'actes de biologie médicale
20. PRESC-KINE - Prescription d'actes de kinésithérapie
21. PRESC-INF - Prescription d'actes infirmiers
22. PRESC-PEDI - Prescription d'actes de pédicurie
23. PRESC-ORTHOPHO - Prescription d'actes d'orthophonie
24. PRESC-ORTHOPTIE - Prescription d'actes d'orthoptie
25. E1762 - Full Document
Important Notes:
-
SA29 (shown in tests) is NOT a document category code—it's an Activity Sector code used for healthcare settings, not document types. It means "Laboratoire d'analyses et de biologie médicale"
-
These codes are returned by the DMP API via the
hl_getInteropCodescommand with thedocCategoriestable -
The filter system is configured in
/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.tsusingcreateNhrDocumentCategoryFilterConfig() -
The mapping between code and label is centralized in
LOINC_CODES_TO_KINDrecord type definition
Source Files:
- /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/models/document/fr/DocumentLoincCodesToKind.ts - Complete mapping
- /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/types/FrDmpTypes.ts - Type definitions for GetInteropCodesResponse
- /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/national-health-records/src/variants/dmp/factories/filtersFactory.ts - Filter configuration