- Two deliverables share logic: an Angular UI (
src/app/) and a Node CLI autoconfig tool (autoconfig-src/). - The UI queries FHIR servers to define cohorts, then pull cohort data.
- The CLI generates server-specific
settings.json5and definitions CSV files.
- App startup:
src/app/app.module.tsusesprovideAppInitializerto loadconf/settings.json5throughSettingsServicebefore routes render. FhirBackendService.init()is called fromsrc/app/modules/home/home.component.tsso token callback routes do not run full backend initialization.- Runtime flow centers on
FhirBackendService(src/app/shared/fhir-backend/fhir-backend.service.ts), which wrapsFhirBatchQuery(src/app/shared/fhir-backend/fhir-batch-query.js). - UI workflow is a wizard in
src/app/modules/stepper/stepper.component.ts(settings -> action -> research-study/select-records/browse-public-data -> cohort -> pull data) driven by backend connection status and cohort mode. - Wizard step order is the
Stepenum insrc/app/modules/stepper/step.enum.ts;stepper.component.tsre-exports it for existing imports. - Auth paths are route-based: SMART launch in
src/app/modules/launch/, OAuth2 callback insrc/app/modules/oauth2-token-callback/, and RAS callback insrc/app/modules/ras-token-callback/. - The autoconfig CLI intentionally reuses browser query logic by importing
FhirBatchQueryfromsrc/(autoconfig-src/autoconfig.js).
- Install + dev server:
npm installnpm start(runsnpm run sync-xlsx-configbeforeng serve)npm run start:skip-xlsxwhen XLSX regeneration is unnecessary.
- Fast UI checks:
npm run unitandnpm run lint. - Unit tests run through Angular's Vitest target (
angular.json) with file parallelism disabled invitest-base.config.ts. - Full test run:
npm test(autoconfig + unit + Cypress). - Autoconfig-specific checks:
npm run test-autoconfignode autoconfig-src/autoconfig-harness.js(offline fixture validation)
- Build output:
npm run buildwrites UI topublic/and also runs build-autoconfig.npm run build-autoconfigbundles CLI intoautoconfig-build/.
- Do not edit generated artifacts in
public/,autoconfig-build/,src/app/shared/definitions/generated-index.json, orsrc/app/shared/app-version.ts; generated CSV files insrc/conf/csv/should come fromsrc/conf/xlsx/. - Avoid reading or searching within
.idea/unless the user explicitly asks for it. - Focus discovery and edits on
src/,autoconfig-src/,bin/, andtest/by default. src/query-builder/is a vendored copy of ngx-angular-query-builder; avoid selector/style churn there unless changing that library copy intentionally.- Definitions pipeline: XLSX -> CSV/settings happens in
bin/sync-xlsx-config.jsbefore serve/build/test/analyze scripts. - XLSX files in
src/conf/xlsx/are source-of-truth for definitions;npm run sync-xlsx-configgeneratessrc/conf/csv/and updatesdefinitionsFileentries insrc/conf/settings.json5. bin/sync-generated-assets.jsbuildssrc/app/shared/definitions/generated-index.jsonfromsrc/app/shared/definitions/index.json,src/app/shared/definitions/webpack-options.json, and the R4/R5 definition JSON files, and writessrc/app/shared/app-version.ts.- Autoconfig copies generated CSV templates into
autoconfig-build/conf/csv/for a relocatable bundle. autoconfig-src/build-autoconfig.jsalso stagesautoconfig-build/conf/settings-initial.json5andautoconfig-build/conf/build-info.json;autoconfig-src/autoconfig.jsprefers these bundled files at runtime.- Autoconfig filtering is dual-source by design: capability support plus live
data checks (
generateDefinitionsCsvinautoconfig-src/autoconfig.js). - Preserve combined params (e.g.
code,medication) and polymorphic[x]column handling (autoconfig-src/definitions-generator.js). - Save generated planning prompts under
plans/usingplan-<camelCaseName>.prompt.mdfilenames. - Angular code intentionally stays NgModule-based (
standalone: false) with constructor DI; ESLint disablesprefer-standalone,prefer-inject, and templateprefer-control-flow, so avoid incidental migrations. - Ensure that all added or updated JavaScript/TypeScript functions are accompanied by correct JSDoc comments.
- Keep edits narrow and style-consistent (quote style, import style, async patterns, line lengths near 80 where practical).
- Blank lines: keep two between declarations; for JSDoc, keep two above the block and none between the block and its declaration.
- In test files (e.g.
*.spec.tsand*.cy.ts), keep two blank lines before and afterdescribe(...)blocks and betweenit(...)blocks; inside eachdescribe(...), keep one blank line before the firstit(...)and after the lastit(...).
- URL query params (
server,isSmart,prev-version,ras) alter behavior; many components read them via shared utils. ToastrInterceptor(src/app/shared/http-interceptors/toastr-interceptor.ts) displays HTTP errors unless request context setsHIDE_ERRORS.npm run autoconfigruns the built bundle withNODE_TLS_REJECT_UNAUTHORIZED=0; this is intentional for some FHIR endpoints.- If terminal
node/npmis missing, source repobashrcthen rerun command:source ./bashrc.