care icon indicating copy to clipboard operation
care copied to clipboard

updated populate fixing-investigation command

Open praffq opened this issue 1 year ago • 7 comments

Proposed Changes

  • Fixed duplication of data in investigation group table
  • Fixed many to many relations when populating investigation data
  • Updated Investigation data and investigation group data

Associated Issue

  • Fixes #2499
  • Fixes https://github.com/ohcnetwork/care_fe/issues/8510)

Merge Checklist

  • [x] Tests added/fixed
  • [x] Linting Complete

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins

praffq avatar Sep 26 '24 02:09 praffq

Codecov Report

Attention: Patch coverage is 80.76923% with 10 lines in your changes missing coverage. Please review.

Project coverage is 69.46%. Comparing base (d6d069e) to head (20b6461).

Files with missing lines Patch % Lines
...ers/management/commands/populate_investigations.py 80.76% 6 Missing and 4 partials :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2500      +/-   ##
===========================================
+ Coverage    69.20%   69.46%   +0.25%     
===========================================
  Files          211      211              
  Lines        11944    11970      +26     
  Branches      1208     1213       +5     
===========================================
+ Hits          8266     8315      +49     
+ Misses        3302     3273      -29     
- Partials       376      382       +6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 07 '24 14:10 codecov[bot]

@DraKen0009 do follow up and close this

bodhish avatar Oct 18 '24 08:10 bodhish

@sainak updated, can you please run the workflows once

praffq avatar Oct 23 '24 08:10 praffq

@DraKen0009 can you add a test case that validates the groups are being linked correctly

you can run the command using django.core.management.call_command

sainak avatar Oct 23 '24 08:10 sainak

So basically after running the command , I need to loop over the data in json and compare them with the data present in the model (db)?

praffq avatar Oct 23 '24 08:10 praffq

So basically after running the command , I need to loop over the data in json and compare them with the data present in the model (db)?

just check a few records

sainak avatar Oct 23 '24 08:10 sainak

@sainak can you please cehck the test cases and let me know if they require any changes

praffq avatar Oct 24 '24 08:10 praffq

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request introduce a new test class LoadInvestigationsCommandTest to validate the functionality of the populate_investigations management command. The command's logic for loading investigation data has been restructured for efficiency, including checks for existing records before creating new ones. Additionally, multiple new entries have been added to the investigation_groups.json file, and extensive updates have been made to the investigations.json file to reflect new medical standards, including category ID adjustments, unit changes, and the introduction of new tests.

Changes

File Path Change Summary
care/facility/tests/test_management_commands.py New test class LoadInvestigationsCommandTest added to validate populate_investigations command functionality.
care/users/management/commands/populate_investigations.py Restructured data loading logic, added checks for existing groups, updated handling of values, and improved relationship management.
data/investigation_groups.json Added multiple new investigation groups with unique identifiers and names.
data/investigations.json Extensive updates including category ID adjustments, unit changes, ideal value updates, new entries, and renaming for clarity.

Poem

In the land of tests and JSON files,
New groups and entries bring forth smiles.
Investigations now shine so bright,
With data restructured, all feels right.
So here's to the changes, a little cheer,
For clarity and order, we hold dear! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Nov 07 '24 08:11 coderabbitai[bot]

@sainak @rithviknishad Can you please re check. followed some of the code rabbit reviews and reformatted it to pass linting

praffq avatar Nov 07 '24 12:11 praffq

Waiting on an ops confirmation.

vigneshhari avatar Nov 09 '24 15:11 vigneshhari