Skip to content

Conversation

@alexlipovka
Copy link
Collaborator


interface GroupTableChartProps {
dataSource: RepeatableGroupTableRow[];
linkIdX: string | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

There is no sense to pass empty linkIdX and linkIdY.
This case should be handles in the parent component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

}
return {
name: item.key,
x: item[linkIdX]?.formItem?.[0]?.value?.date,
Copy link
Member

Choose a reason for hiding this comment

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

It may be dateTime or even Intger. Please handle this edge cases

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

refactored to abstract value getter

axisLine={false}
/>
<CartesianGrid />
{/*<CartesianAxis display={'none'} />*/}
Copy link
Member

Choose a reason for hiding this comment

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

Remove useless comments

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure

import { RepeatableGroupTableRow } from './types';

const getEnableChartExtension = compileAsFirst<QuestionnaireItem, Extension>(
`extension.where(url='https://emr-core.beda.software/StructureDefinition/enableChart')`,
Copy link
Member

Choose a reason for hiding this comment

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

Extensions should be defined here https://github.com/beda-software/beda-emr-core

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

snapshotDataSource,
renderAsTable,
handleRenderTypeToggle,
enabledChart: !!extensionEnableChart,
Copy link
Member

Choose a reason for hiding this comment

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

This flag is not needed.
Use handleRenderTypeToggle as a flag if it is not defined it is just a Table

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

refactored approach

import { RepeatableGroupTableRow } from './types';

const getEnableChartExtension = compileAsFirst<QuestionnaireItem, Extension>(
`extension.where(url='https://emr-core.beda.software/StructureDefinition/enable-chart')`,
Copy link
Member

Choose a reason for hiding this comment

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

@alexlipovka use extension function instead of where

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not relevant, now data comes from first class extension fields

@alexlipovka alexlipovka requested a review from ir4y February 11, 2026 12:13
});

return (
<ResponsiveContainer width="100%" height={'100%'}>
Copy link
Member

Choose a reason for hiding this comment

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

<ResponsiveContainer width="100%" height="100%">

/>
</S.Item>
)}
{repeats &&
Copy link
Member

Choose a reason for hiding this comment

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

Show error if props are incorrect.
repeats is false or one of (both) chartLinkIdX,chartLinkIdY is not defined.
Provide user friendly error message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

return Array.isArray(item) && item.every((item) => item !== undefined && item !== null && 'value' in item);
};

const getValueFromAnswerValue = (answerValue: AnswerValue, questionnaireItemType: QuestionnaireItem['type']) => {
Copy link
Member

Choose a reason for hiding this comment

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

Wasn't it define under GroupTable pull request?
If it is a refactoring I don't see getValueFromAnswerValue removed from another file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not quite, there we defined readonly rendering, but here we only need raw values

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

refactored to use common functions

@alexlipovka alexlipovka requested a review from ir4y February 11, 2026 17:49
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.

2 participants