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

enhance: add python logic to compute daily participant analytics based on question response details #4212

Merged
merged 6 commits into from
Aug 26, 2024

Conversation

sjschlapbach
Copy link
Member

No description provided.

Copy link

coderabbitai bot commented Aug 26, 2024

Walkthrough

Walkthrough

The recent changes introduce a new Jupyter Notebook for participant analytics, enhancing the analysis of educational responses. A SQL migration updates the ParticipantAnalytics table by removing three columns and adding four new ones to improve performance metrics tracking. Additionally, the Prisma schema for ParticipantAnalytics is modified to clarify comments and add new fields for more detailed correctness metrics.

Changes

Files Change Summary
apps/analytics/daily_participant_analytics.ipynb Introduces a Jupyter Notebook for participant response analysis, connecting to a PostgreSQL database, fetching data, transforming it into a pandas DataFrame, and computing correctness metrics. Prepares analytics data for database storage.
packages/prisma/src/prisma/migrations/20240826113537_participant_analytics_correctness_counts/migration.sql Removes meanFirstCorrectCount, meanLastCorrectCount, and collectedAchievements columns from ParticipantAnalytics, adds firstCorrectCount, firstWrongCount, lastCorrectCount, and lastWrongCount columns, all with REAL data type.
packages/prisma/src/prisma/schema/analytics.prisma Updates comments for existing fields in ParticipantAnalytics, clarifies calculations, and introduces new optional fields: firstCorrectCount, lastCorrectCount, firstWrongCount, and lastWrongCount, all as floating-point values.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@sjschlapbach sjschlapbach marked this pull request as ready for review August 26, 2024 14:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 70c203f and 0b51ddc.

Files selected for processing (4)
  • apps/analytics/daily_participant_analytics.ipynb (1 hunks)
  • apps/analytics/pyproject.toml (1 hunks)
  • packages/prisma/src/prisma/migrations/20240826113537_participant_analytics_correctness_counts/migration.sql (1 hunks)
  • packages/prisma/src/prisma/schema/analytics.prisma (2 hunks)
Files skipped from review due to trivial changes (1)
  • apps/analytics/pyproject.toml
Additional comments not posted (13)
packages/prisma/src/prisma/migrations/20240826113537_participant_analytics_correctness_counts/migration.sql (3)

1-7: LGTM!

The warning comments appropriately indicate data loss due to dropping columns.

The code changes are approved.


9-10: LGTM!

The SQL statement correctly drops the specified columns.

The code changes are approved.


11-14: LGTM!

The SQL statement correctly adds the specified columns.

The code changes are approved.

packages/prisma/src/prisma/schema/analytics.prisma (3)

21-21: Clarify comment for unsolvedQuestionsCount.

The comment clarifies the calculation for unsolvedQuestionsCount. Ensure that this calculation is correctly implemented in the code.

Verify that the calculation for unsolvedQuestionsCount is correctly implemented in the codebase.


31-33: Clarify comments for mean fields.

The comments clarify that the mean fields are calculated over responses to the same question and summed over all questions. Ensure that this calculation is correctly implemented in the code.

Verify that the calculation for the mean fields is correctly implemented in the codebase.


37-40: Add new fields for detailed correctness metrics.

The new fields firstCorrectCount, lastCorrectCount, firstWrongCount, and lastWrongCount provide a more detailed breakdown of correctness metrics. Ensure that these fields are correctly populated in the code.

Verify that the new fields are correctly populated in the codebase.

apps/analytics/daily_participant_analytics.ipynb (7)

1-14: LGTM!

The imports are appropriate for the notebook.

The code changes are approved.


62-88: LGTM!

The conversion logic is appropriate.

The code changes are approved.


174-189: LGTM!

The aggregation logic is appropriate.

The code changes are approved.


191-217: LGTM!

The counting logic is appropriate.

The code changes are approved.


219-240: LGTM!

The mapping logic is appropriate.

The code changes are approved.


242-285: LGTM!

The logic for creating daily analytics entries is appropriate.

The code changes are approved.


287-316: LGTM!

The metadata is appropriate.

The code changes are approved.

apps/analytics/daily_participant_analytics.ipynb Outdated Show resolved Hide resolved
apps/analytics/daily_participant_analytics.ipynb Outdated Show resolved Hide resolved
"db = Prisma()\n",
"\n",
"# set the environment variable DATABASE_URL to the connection string of your database\n",
"os.environ['DATABASE_URL'] = 'postgresql://klicker:klicker@localhost:5432/klicker-prod'\n",

Check failure

Code scanning / SonarCloud

PostgreSQL database passwords should not be disclosed

<!--SONAR_ISSUE_KEY:AZGPFn9QAP44JPMdPEMb-->Make sure this PostgreSQL database password gets changed and removed from the code. <p>See more on <a href="https://sonarcloud.io/project/issues?id=uzh-bf_klicker-uzh&issues=AZGPFn9QAP44JPMdPEMb&open=AZGPFn9QAP44JPMdPEMb&pullRequest=4212">SonarCloud</a></p>
Copy link

cypress bot commented Aug 26, 2024

klicker-uzh    Run #2715

Run Properties:  status check passed Passed #2715  •  git commit 2948359fea ℹ️: Merge b04c32d883632184ddcf2573d8e1ba395990f26c into 70c203f96dfe7fa3f52dda2bef0e...
Project klicker-uzh
Branch Review DailyParticipantAnalytics
Run status status check passed Passed #2715
Run duration 08m 32s
Commit git commit 2948359fea ℹ️: Merge b04c32d883632184ddcf2573d8e1ba395990f26c into 70c203f96dfe7fa3f52dda2bef0e...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 38
View all changes introduced in this branch ↗︎

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0b51ddc and e63c8ad.

Files selected for processing (3)
  • apps/analytics/daily_participant_analytics.ipynb (1 hunks)
  • packages/prisma/src/prisma/migrations/20240826113537_participant_analytics_correctness_counts/migration.sql (1 hunks)
  • packages/prisma/src/prisma/schema/analytics.prisma (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • apps/analytics/daily_participant_analytics.ipynb
  • packages/prisma/src/prisma/schema/analytics.prisma
Additional comments not posted (3)
packages/prisma/src/prisma/migrations/20240826113537_participant_analytics_correctness_counts/migration.sql (3)

1-8: Acknowledge the importance of warnings.

The warnings about data loss due to column drops are crucial. Ensure that the data is either backed up or no longer needed before proceeding with the migration.

Verify that the data in the dropped columns is either backed up or no longer needed.


10-12: Verify intentionality of dropping columns.

Dropping columns meanFirstCorrectCount, meanLastCorrectCount, and collectedAchievements will result in data loss. Ensure that this action is intentional and that the data is either backed up or no longer needed.

Verify that the data in the dropped columns is either backed up or no longer needed.


13-16: LGTM!

The addition of new columns firstCorrectCount, firstWrongCount, lastCorrectCount, and lastWrongCount will enhance the table with more detailed correctness metrics. Ensure that the data types and column names are appropriate.

The code changes are approved.

Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e63c8ad and b04c32d.

Files selected for processing (1)
  • apps/analytics/daily_participant_analytics.ipynb (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/analytics/daily_participant_analytics.ipynb

@sjschlapbach sjschlapbach merged commit ed7e745 into v3-analytics Aug 26, 2024
10 of 11 checks passed
@sjschlapbach sjschlapbach deleted the DailyParticipantAnalytics branch August 26, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant