- Open the app.
- The table shows preloaded example data (Time, Cell Density, Volume).
- To add a calculation column:
- Click "Add Calculation Column".
- Enter a formula using column names:
Cell Density * Volume
- A new column will be added automatically with computed values.
- To perform a column aggregation:
- Select the column you want to aggregate from the dropdown.
- Choose the operation (Maximum, Minimum, Average).
- Click "Calculate" to view the result.
Notes:
- Formulas are case-insensitive.
- Use standard operators:
+,-,*,/.
- The table component (
OpviaTable.tsx) focuses on UI, user interactions, and local state management. - Formula parsing logic (e.g., normalizing user input, replacing column names safely) is abstracted into a separate helper file:
utils/formulaUtils.ts. - This keeps the code modular, improves readability, and makes formula-related features easier to maintain and extend in the future.
-
Extend Aggregation and Calculation Flexibility
- Build a more extensible framework that allows scientists to define different types of calculations or aggregations without hardcoding specific ones (e.g., sum, count, standard deviation).
-
Persistent Storage
- Allow users to optionally save their created calculation columns and formulas across sessions, using LocalStorage, IndexedDB, or backend syncing.
-
Testing
- Add unit tests specifically for formula parsing, normalization, evaluation logic, and edge cases.
- Add UI integration tests to verify calculation columns and aggregation workflows.
-
Formula Validation and Error Handling
- Validate user input formulas before evaluating them.
- Show clear, user-friendly error messages for invalid syntax or calculation issues.
-
Custom Naming for Calculation Columns
- Allow users to assign custom names to new calculated columns instead of default names like "Calc Column 1" to improve clarity when many formulas are added.
-
Editable Table Cells
- Allow users to edit table data manually via inline editing, using Blueprint's
EditableCell2component for a more dynamic experience.
- Allow users to edit table data manually via inline editing, using Blueprint's
-
Responsive Layout Enhancements (if needed based on user feedback)
- Improve layout responsiveness for better use on smaller screens and tablets, if needed.
To support Rate of Change Calculations, such as Rate of Cell Count Growth, I would extend the current formula system to allow referencing other rows' data.
Example user formula:
(Cell Density - prev(Cell Density)) / (Time - prev(Time))
Here, prev(Cell Density) means "value of Cell Density from the previous row".
Implementation Plan:
- Extend the formula parser to recognize and replace
prev(columnName)andnext(columnName)references. - When evaluating each row, access previous or next row values safely.
- Handle edge cases like the first row (where
prev()is undefined) gracefully, by showingnullor leaving it empty. - Allow for more complex future formulas like moving averages or rolling sums. */