Skip to content

Conversation

@devsingh05298
Copy link
Contributor

JIRABN-75

Description

As a healthcare provider, I want to view diagnoses for a patient on the patient dashboard, so that I can provide appropriate care based on their current diagnoses and historical conditions.

This story involves implementing a diagnoses display control on the patient dashboard that presents all recorded patient diagnoses in a clear, organized table format. The display control should show relevant details including diagnosis date, certainty and the user who added the diagnoses. This will enable healthcare providers to quickly assess a patient's medical history and current health status during care.


Key Features


Implementation Details

Testing & Type Definitions

  • Unit Tests

  • Integration Tests

  • Type Definitions


Screenshots

Feature / State Screenshot
Default State with Diagnoses Data
Screenshot 2025-06-02 at 2 33 44 PM
When there's no Diagnoses Data
Screenshot 2025-06-02 at 2 36 10 PM

sections.forEach((section) => {
if (!sectionRefs.current[section.id]) {
sectionRefs.current[section.id] = React.createRef<HTMLDivElement>();
if (!sectionRefs.current[section.name]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devsingh05298,
It appears that the sidenav scroll is broken following the changes introduced in this commit. Could you please re-test and verify if these modifications were intentional?

If the changes do not serve a specific purpose, kindly revert them. However, if they are required, please revise the implementation to ensure that the existing scroll behavior remains unaffected.


//TODO: Refactor this to depend on Controls configuration
const renderSectionContent = (section: DashboardSectionConfig) => {
if (section.controls && section.controls.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devsingh05298 There's a redundant fallback switch on section.name if section.controls is absent, which duplicates logic.

Impact: Creates dual sources of truth for rendering controls.

<div>
{dateGroup.diagnoses.map((diagnosis, diagnosisIndex) => (
<DiagnosisItem
key={diagnosis.id || diagnosisIndex}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of Unique key for DiagnosisItem

Fallback to diagnosisIndex when diagnosis.id is missing could lead to rendering issues if the list updates dynamically. Each diagnosis should ideally have a stable, unique identifier.

<div>
<strong>{diagnosis.display}</strong>{' '}
<Tag type={getTagType(diagnosis.certainty)} style={{marginLeft: '8px'}}>
{t(`CERTAINITY_${diagnosis.certainty.toUpperCase()}`)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation key prefix CERTAINITY_ appears misspelled; it should likely be CERTAINTY_. Please do fix this.

};

return (
<Table size="sm" useZebraStyles={false}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendering a full <Table> and <TableBody> per individual diagnosis item is inefficient and semantically incorrect. Typically, one <Table> should wrap multiple <TableRow>s, not be created repeatedly for each row. This can cause layout and accessibility issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename the test file as "*.snapshot.test.tsx" for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded Color Values Instead of Tokens: Colors like #ffffff, #f4f4f4, #e0e0e0, and #161616 are hardcoded instead of using Carbon's design tokens (e.g., $layer-01, $text-primary). This reduces theme compatibility and visual consistency across the app. Refer: https://carbondesignsystem.com/elements/color/tokens/

Lack of Responsive Styling: No media queries or responsive considerations are present. Fixed widths (180px, 200px) and lack of flex-basis control can cause layout issues on smaller screens. Refer: https://carbondesignsystem.com/elements/spacing/overview/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we consider reusing the existing approach of loading controls by name to maintain compatibility, rather than introducing a new method midway through the implementation?

/**
* Interface for FHIR Condition resource specific to diagnoses
*/
export interface FhirDiagnosis {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better not to define a new type for fhir, please use import { Condition } from 'fhir/r4'; instead.

) : (
<>
{/* Table Header */}
<div className={styles.tableHeader}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of relying on <div> and <span>, consider using the Grid and Column components from the Carbon Design System. This ensures better responsiveness and aligns the implementation with Carbon’s design principles.

@rahu1ramesh
Copy link
Contributor

Closing the PR as the changes added are already addressed in #30.

@rahu1ramesh rahu1ramesh closed this Jun 9, 2025
@mohan-13 mohan-13 deleted the BN-75-Diagnoses-display-control branch June 12, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants