Frontend School

Dynamic Healthcare Data Aggregator

Machine Coding
hard

Dynamic Healthcare Data Aggregator

Hard
React
TypeScript
Data Transformation
State Management
UI Components

Overview

Innovaccer's data platform empowers healthcare organizations to derive actionable insights from vast amounts of patient data. A crucial aspect of this platform is the ability for users to dynamically explore and visualize data without needing complex queries. This problem focuses on building a configurable component for our internal analytics dashboard, allowing users to aggregate raw patient data based on chosen dimensions and metrics.

What you need to do / Task

Your task is to build a React component that displays raw patient data and provides a control panel for dynamic aggregation. The component should then display the aggregated results.

  1. Display Raw Data: Render the provided initialPatientData in a simple table format.
  2. Build a Control Panel: Implement a UI panel that includes:
    • A dropdown/select input labeled "Group By" to choose a categorical field from the raw data (e.g., diseaseType, physician).
    • A dropdown/select input labeled "Aggregate Metric" to choose a numeric field from the raw data (e.g., lengthOfStayDays, billAmount).
    • A dropdown/select input labeled "Aggregation Type" with options: SUM, AVERAGE, COUNT.
  3. Implement Dynamic Aggregation: Based on the user's selections in the control panel, process the initialPatientData to group and aggregate it accordingly.
    • If no "Group By" field is selected, the aggregation should apply to the entire dataset.
    • If no "Aggregate Metric" is selected, disable the "Aggregation Type" dropdown or display an appropriate message.
    • COUNT should count the number of records in each group.
  4. Display Aggregated Data: Render the resulting aggregated data in a clear format (e.g., a new table or a list of key-value pairs). The output should show the group identifier and the aggregated value.

UI/UX expectations

  • The raw data table, control panel, and aggregated output should be clearly separated on the screen.
  • Changes in the control panel selections (Group By, Aggregate Metric, Aggregation Type) must trigger immediate updates to the aggregated data display.
  • Dropdowns should be populated dynamically from the keys of the PatientRecord interface where appropriate.
  • Ensure a clean, functional layout. Pixel-perfect design is not required, but readability and usability are key.

Acceptance criteria

  • Raw initialPatientData is displayed correctly.
  • Control panel dropdowns are populated with relevant fields and aggregation types.
  • Selecting a "Group By" field, "Aggregate Metric," and "Aggregation Type" correctly transforms the data.
  • SUM aggregation accurately calculates the sum of the chosen metric per group.
  • AVERAGE aggregation accurately calculates the average of the chosen metric per group.
  • COUNT aggregation accurately calculates the number of records per group.
  • Aggregated data display updates dynamically and accurately reflects current selections.
  • The component handles cases where no group by field is selected (aggregates entire dataset).
  • The component handles cases where no numeric metric is suitable for aggregation (e.g., disables aggregation type dropdown).

Constraints

Constraints & assumptions

  • You should use React with TypeScript.
  • All data processing and aggregation must happen client-side; no backend calls are required.
  • Focus on functional correctness and clean code. Extensive styling is not necessary.
  • Assume initialPatientData will always be an array of objects with consistent keys.
  • Numeric fields for aggregation are lengthOfStayDays and billAmount.
  • Categorical fields for grouping are diseaseType and physician.

Out of scope

  • Integration with complex charting libraries (e.g., D3.js, Highcharts) – a simple table or list display for aggregated data is sufficient.
  • Advanced error handling for malformed data beyond basic type checks.
  • Persistence of user configurations.
  • Full accessibility implementation beyond basic interactive elements.

What interviewers evaluate

  • Data Transformation Logic: Correctness and efficiency of the grouping and aggregation algorithms.
  • React Component Architecture: Clear separation of concerns, effective use of state and props, and a scalable component structure.
  • TypeScript Proficiency: Strong typing, interface usage, and type safety throughout the solution.
  • Dynamic UI & State Management: Responsive updates to the UI based on user interactions and robust state management.
  • Code Quality: Readability, maintainability, and adherence to best practices.

Loading editor...