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

Development: Add science events to user data export #8861

Merged
merged 15 commits into from
Jul 14, 2024

Conversation

N0W0RK
Copy link
Contributor

@N0W0RK N0W0RK commented Jun 23, 2024

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.
  • This is a small issue that I tested locally and was confirmed by another developer on a test server.
  • I chose a title conforming to the naming conventions for pull requests.

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Motivation and Context

Due to GDPR regulations, all personal data has to be made available to the end user if requested. This was not the case for the science events collected.

Description

This PR adds a new DataExportScienceEventService responsible for exporting all science events associated with a user.
All science events are exported as a single csv containing a timestamp, an event type and the associated resource.
Closes #8655

Steps for Testing

Prerequisites:

  • The Science feature enabled
  • 1 Student with science data collection enabled
  • 1 Lecture Unit
  • 1 Exercise (of any type)
  • When Developing locally line 66-71 in DataExportScheduleService have to be commented out or removed.
  1. Log in to Artemis
  2. Navigate to a course with the above mentioned prerequisites.
  3. Open a Lecture and note the rough time.
  4. Open a Lecture unit and note the rough time.
  5. Open an Exercise and note the rough time.
  6. Navigate to Privacy (bottom of the screen)
  7. Scroll to the bottom of the page
  8. Click on Data Export
  9. Click on Request Data Export
  10. Enter user login.
  11. Click Request Data Export
  12. In the testing environment the export should be created after 1-2 minutes.
  13. After beeing notified, that the export is ready, click the link in the notfication or your emails.
  14. Select Download data export
  15. Extract the downloaded ZIP folder.
  16. Ensure that the timestamps in science_ecents.csv coincide with the times noted down.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Class/File Line Coverage Confirmation (assert/expect)
DataExportScienceEventService.java 100%
DataExportCreationService.java 92%

Summary by CodeRabbit

  • New Features

    • Introduced science event data export functionality.
    • Added a service for creating and managing science event exports.
  • Bug Fixes

    • Corrected scheduling for periodic data export creation and deletion.
  • Tests

    • Enhanced test coverage to include science event data export validation.
    • Added utilities for creating and managing science events in tests.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels Jun 23, 2024
@github-actions github-actions bot added the config-change Pull requests that change the config in a way that they require a deployment via Ansible. label Jun 23, 2024
Adds new DataExportScienceEventService.
Ammends DataExportCreationService and ScienceEventRepository with necessary functionality
Tests if necessary CSV is present.
@N0W0RK N0W0RK force-pushed the feature/general/export-science-events branch from 0d68c78 to 30bb32d Compare June 23, 2024 23:38
@N0W0RK N0W0RK marked this pull request as ready for review June 23, 2024 23:39
@N0W0RK N0W0RK requested a review from a team as a code owner June 23, 2024 23:39
Copy link

coderabbitai bot commented Jun 23, 2024

Walkthrough

The changes introduce functionality to export collected science events as part of user data. This includes new methods in repository, service, and test classes to handle the creation and processing of science event data. Additionally, scheduling logic for data exports is updated to reflect a new cron expression.

Changes

File(s) Change Summary
.../Art.../repository/science/ScienceEventRepository.java Added new method findAllByIdentity to fetch science events by user identity.
.../Art.../service/export/DataExportCreationService.java and .../export/DataExportScienceEventService.java Introduced DataExportScienceEventService and integrated it into DataExportCreationService for handling science event data exports.
.../Art.../science/ScienceUtilService.java and .../service/ExerciseUtilService.java Added new methods and classes to facilitate the creation and testing of science event data.
.../Art.../service/DataExportCreationServiceTest.java Added new test cases to handle science event data export and validate the generated CSV files.
.../Art.../service/scheduled/DataExportScheduleService.java Changed the cron expression for data export schedule to a more frequent interval.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DataExportController
    participant DataExportCreationService
    participant ScienceEventRepository
    participant DataExportScienceEventService

    User->>DataExportController: Request Data Export
    DataExportController->>DataExportCreationService: Create Data Export
    DataExportCreationService->>ScienceEventRepository: findAllByIdentity(userLogin)
    ScienceEventRepository-->>DataExportCreationService: Set<ScienceEvent>
    DataExportCreationService->>DataExportScienceEventService: createScienceEventExport(userLogin, workingDirectory)
    DataExportScienceEventService->>DataExportCreationService: ScienceEvent CSV File
    DataExportCreationService-->>User: ZIP file with user data including Science Event CSV
Loading

Assessment against linked issues

Objective Addressed Explanation
Include collected events in user data export (#8655)

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 Configration 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.

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: 2

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

Your test only test if there exists a science event file in the export, but it does not verify its content. Please also test that the events actually get correctly exported.

src/main/resources/config/application-artemis.yml Outdated Show resolved Hide resolved
@N0W0RK N0W0RK force-pushed the feature/general/export-science-events branch from c3aa0a2 to 8723a0a Compare June 25, 2024 02:33
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

JohannesStoehr
JohannesStoehr previously approved these changes Jun 25, 2024
Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Code

@JohannesWt
Copy link
Contributor

Tested on TS5, when clicking on privacy I get the following error.
Screenshot 2024-06-26 at 08 26 41

@N0W0RK
Copy link
Contributor Author

N0W0RK commented Jun 26, 2024

There is no privacy policy deployed on the testservers. Therfore when trying to load the policy a not found error is thrown. The data export should still be available.

JohannesStoehr
JohannesStoehr previously approved these changes Jul 3, 2024
Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Code

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 3, 2024
Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

code lgtm (if you change back the cron schedule)

BBesrour
BBesrour previously approved these changes Jul 7, 2024
Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

Tested on TS3, works as described

JohannesWt
JohannesWt previously approved these changes Jul 8, 2024
Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Tested locally - works as expected (one could change the notifications in a follow up PR if one has already done an export and can't do another one)

Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

Approved,
Todo: revert cron schedule.

Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

Reverted cron schedule

Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Reapprove Test

@krusche krusche changed the title General: Add science events to user data export Development: Add science events to user data export Jul 14, 2024
@krusche krusche added this to the 7.4.2 milestone Jul 14, 2024
@krusche krusche merged commit 64fea72 into develop Jul 14, 2024
20 of 24 checks passed
@krusche krusche deleted the feature/general/export-science-events branch July 14, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config-change Pull requests that change the config in a way that they require a deployment via Ansible. ready for review server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

General: Include collected events in user data export
7 participants