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

Persist a new request to the data_requests table only if the patient id, project id combination does not exist. #12

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

Conversation

mmwaikar
Copy link
Contributor

  • created a data_access/data_requests module which contains code only to interact with the Sqlite db
  • used the above in requests module
  • added code in create_data_request to check for existence of record with patient id, project id combination
  • added test-log crate as a dev dependency (which automatically configures logger or a tracer)

@Threated
Copy link
Member

Can you rebase and maybe remove formatting commit so that you will have less merge conflicts

@mmwaikar
Copy link
Contributor Author

Can you rebase and maybe remove formatting commit so that you will have less merge conflicts

This is done Jan (thanks for your help).

src/requests.rs Outdated Show resolved Hide resolved
src/requests.rs Outdated
) -> axum::response::Result<(StatusCode, Json<DataRequest>)> {
let mut consent = payload.consent;
let mut patient = payload.patient;
let mut project_id = "";
Copy link
Member

Choose a reason for hiding this comment

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

This seems odd. Do we ever want to have an empty project id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assigned a default value of "DEFAULT_PROJECT_ID".

Copy link
Member

Choose a reason for hiding this comment

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

Thats not really what I meant. I am thinking about initializing this in a way where we know we have a valid project id like in the if or it can happen that we actually don't know the project_id we can make it an Option. I don't really know how the logic here is supposed to work here so I can't say for sure what the right approach is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've modified the logic to based on exchange id & project id combination (after discussing with @torbrenner) so you may please review the PR again.

I've rebased from main, so I am not sure why one of the CI/CD step still fails.

src/requests.rs Outdated Show resolved Hide resolved
src/requests.rs Outdated Show resolved Hide resolved
@Threated
Copy link
Member

Threated commented Feb 3, 2025

Can you revert the str extension traits I don't really see their point as they only do very simple things that I would not even hide behind a method call and its not like we need that functionality everywhere.
For the ttp project id empty string check I would suggest checking that property when its initialized not on use.

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.

3 participants