How bahmni/bahmni-carbon-ui works
Project type and purpose
• This is an open-source React UI component library (“bahmni-carbon-ui”) built on top of IBM’s Carbon Design System, extended to meet Bahmni/OpenMRS requirements.
• Its primary goal is to expose reusable, themed React components (DatePicker, Dropdown, Tooltip, etc.) that originate from Carbon but include Bahmni-specific enhancements.
File structure
• src/components – each subfolder is a React component that wraps or extends a Carbon component (e.g. DatePickerCarbon, DropdownCarbon).
• src/styles – global SCSS files that override or augment Carbon’s default theme (carbon-theme.scss, conflict-fixes).
• Top-level config – webpack.config.js (build bundling), .babelrc (transpilation), ESLint/Prettier configs (linting & formatting), jest.config.js (unit testing).
• Storybook setup – .storybook folder with main.js & preview.js to document and visually test components.
• CI/CD – GitHub Actions workflows in .github/workflows, plus a custom action for dependency installation under .github/actions.
README for additional insights
• Confirms this is a UI library for Bahmni/OpenMRS.
• Explains linking instructions for local development.
• Specifies that Carbon components are selectively overridden (e.g. Combobox filtering).
Main components & interactions
a. Library Package (“bahmni-carbon-ui”)
– Source (src/) → build pipeline (webpack + Babel) → distributed bundle (npm package)
– Exposes React components, SCSS themes.
b. External Dependencies
– React & React-DOM (peer dependencies)
– Carbon Design System (peer dependency for core styles and components)
– npm registry (publishing and versioning)
c. Consumer Application (Bahmni/OpenMRS front-end)
– Imports “bahmni-carbon-ui”
– Renders components in clinical/administrative UIs
d. Development Toolchain & QA
– Storybook server for interactive component development
– Jest + React Testing Library for unit tests
– ESLint/Prettier for code quality
– GitHub Actions for CI (lint → test → publish)
Architectural patterns & design principles
• Component abstraction: each folder under src/components follows a 1-to-1 mapping to a UI piece, encapsulating JSX, styles, and stories.
• Theming & overrides: SCSS files inject Bahmni brand variables and patch Carbon conflicts.
• CI as code: custom actions and workflows demonstrate automated dependency installation, testing, and publishing.
Elements
• Clear labels: e.g. “DatePickerCarbon.jsx”, “carbon-theme.scss”
– Dependencies (React, Carbon → bahmni-carbon-ui)
– Build flow (src → webpack → dist → npm)
– Import flow (consumer app → bahmni library)
– Blue rectangles for source code modules
– Green for build tools (webpack, Babel)
– Orange for CI/CD components (GitHub Actions)
– Grey clouds for external services (npm registry)
– Development (Storybook, tests)
– Build & Release
– Consumption by downstream applications