How smart-on-fhir/patient-browser works
Project type and purpose
• This is a standalone, static single-page application (“patient-browser”) implemented with React and Redux, bundled by Vite, and served as HTML/CSS/JS.
• Its purpose is to allow a host web application (in a popup or iframe on a different domain) to let users browse and select FHIR patients from a remote FHIR server, communicating via postMessage.
File structure
• Top-level:
• public/ – static assets (Bootstrap, Font-Awesome, jQuery), prebuilt configs under public/config.
• src/ – React components, Less styles, Redux store modules, lib utilities, TypeScript entry (main.tsx).
• config-genrator/ – Node.js CLI tool that queries a FHIR server, parses metadata/conditions, and produces JSON5 config files.
• test/e2e/ and nightwatch.conf.cjs – end-to-end tests.
• Vite & TypeScript config files, GitHub Actions CI workflow, Dockerignore, Procfile (for deployment).
README for additional insights
• App initializes by loading a JSON5 config from public/config based on a URL search parameter.
• It fetches patient resources (and optionally tags/conditions) from an open FHIR server.
• It dispatches Redux actions, renders data via React components, posts “ready”/“result” messages to the opener, and listens for injected config on “ready.”