Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-4045: Display only tests with results in result viewer #2049

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

makombe
Copy link
Contributor

@makombe makombe commented Oct 1, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Currently all configured test whether individual or convset will be shown. The ask here is to only show test ordered for a patient and has results.
This will:

  • Avoid displaying tests irrelevant to a patient (e.g., HIV Viral Load for non-HIV patients).
  • Help declutter the UI, making it more focused and user-friendly.
  • For a convset we should be able to display test results for panels and non panel test. Currently, only displays panel results and not individual tests within the set unless they are configured separately

Screenshots

Before:
Screenshot from 2024-10-01 13-12-09

After:
Screencast from 01-10-2024 12:49:24 ALASIRI.webm

Related Issue

https://openmrs.atlassian.net/browse/O3-4045

Other

@ojwanganto
Copy link

Thanks, @makombe. Do you mind updating the description to clearly indicate what this PR addresses? You can also mention the status before and after, and the limitations of the previous approach. Asante

@makombe
Copy link
Contributor Author

makombe commented Oct 1, 2024

Thanks, @makombe. Do you mind updating the description to clearly indicate what this PR addresses? You can also mention the status before and after, and the limitations of the previous approach. Asante

Done. Thanks

@ojwanganto
Copy link

Thank you

@pirupius pirupius requested a review from ibacher October 1, 2024 15:00
Comment on lines 44 to 50
} else if (!node?.subSets?.length && node.obs?.length > 0) {
// Treat the current node as a leaf and a test
leaves.push(node.flatName);
tests.push([node.flatName, node]);

// Add the current node to the lowest parents list
lowestParents.push({ flatName: node.flatName, display: node.display });
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this have been an else on the following block?

@@ -67,7 +67,8 @@ const FilterNodeParent = ({ root, itemNumber }: filterNodeParentProps) => {
const tablet = useLayoutType() === 'tablet';
const [expandAll, setExpandAll] = useState<boolean | undefined>(undefined);

if (!root.subSets) return;
// Filter out root nodes without data
if (!root.subSets || !root.subSets.some((node) => node.hasData || node.subSets)) return null;
Copy link
Member

Choose a reason for hiding this comment

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

Does this work for a root that has subSets with subSets, but those grandchildren have no data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me do this recursively.

@@ -103,6 +104,11 @@ const FilterNode = ({ root, level, open }: FilterNodeProps) => {
const indeterminate = isIndeterminate(parents[root.flatName], checkboxes);
const allChildrenChecked = parents[root.flatName]?.every((kid) => checkboxes[kid]);

// Filter out nodes that don't have data or don't have children with data
if (!root.hasData && (!root.subSets || !root.subSets.some((subNode) => subNode.hasData || subNode.subSets))) {
Copy link
Member

Choose a reason for hiding this comment

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

Again, this only looks like it works at one level of depth.

@@ -129,14 +135,17 @@ const FilterNode = ({ root, level, open }: FilterNodeProps) => {

const FilterLeaf = ({ leaf }: FilterLeafProps) => {
const { checkboxes, toggleVal } = useContext(FilterContext);

// Filter out leaves without data
if (!leaf.hasData) return null;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!leaf.hasData) return null;
if (!leaf.hasData) {
return null;
}

@makombe
Copy link
Contributor Author

makombe commented Oct 2, 2024

@ibacher I have made some adjustments, please you can re-review. Thanks

@ojwanganto
Copy link

@ibacher I have made some adjustments, please you can re-review. Thanks

Please provide a short video or screenshot.

@makombe
Copy link
Contributor Author

makombe commented Oct 8, 2024

@ibacher I have made some adjustments, please you can re-review. Thanks

Please provide a short video or screenshot.

@ojwanganto The screenshot remains the same as one already shared above. Thanks

@ojwanganto
Copy link

@ibacher I have made some adjustments, please you can re-review. Thanks

Please provide a short video or screenshot.

@ojwanganto The screenshot remains the same as one already shared above. Thanks

Thanks

@donaldkibet
Copy link
Member

ping @makombe please resolve the conflicts. cc @ibacher @denniskigen for a second review.

Copy link
Collaborator

@CynthiaKamau CynthiaKamau left a comment

Choose a reason for hiding this comment

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

Thanks @makombe , kindly fix the conflicts

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.

6 participants