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

multi ffqs fix #581

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

multi ffqs fix #581

wants to merge 13 commits into from

Conversation

ayobi
Copy link
Contributor

@ayobi ayobi commented Aug 31, 2024

No description provided.

@ayobi ayobi changed the title Multi ffqs fix multi ffqs fix Sep 10, 2024
@ayobi ayobi marked this pull request as ready for review September 11, 2024 00:10
Comment on lines 83 to 88
if source:
ffq_complete, ffq_taken, _ = \
vs_repo.get_ffq_status_by_source(source.id)
else:
ffq_complete = False
ffq_taken = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given the change from sample to source, I think it makes sense to move this code block into the if statement on Line 51 (if source is not None and source_type == Source.SOURCE_TYPE_HUMAN). Additionally, it makes sense to harmonize what they're doing. For example, get_ffq_status_by_source could return True, True but vio_id could be None.

I'd suggest first looking for a match including sample_id since a good chunk of historical data will include that. Failing an exact match with sample_id you can fall back to a match on source.

Copy link
Contributor Author

@ayobi ayobi Sep 16, 2024

Choose a reason for hiding this comment

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

So you're saying it'd be better to change if source is not None and source_type == Source.SOURCE_TYPE_HUMAN to first check for a sample_id match then fall back on source? Or when trying to get vio_id? I have the latter to commit now.

microsetta_private_api/repo/vioscreen_repo.py Outdated Show resolved Hide resolved
is_complete = status[0] == 'Finished'
is_taken = status[0] in ('Started', 'Review', 'Finished')
results.append((is_complete, is_taken, status[0]))
return results
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't changing the return value from a tuple to a list of tuples will break the code that uses this function? The unit tests work fine because they test the function in isolation, but is this still working when you try to run a sample summary report through microsetta-admin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, it does break. So, if the user has taken multiple FFQs for a particular sample, we'd probably need to change the columns for ffq-taken and ffq-complete to indicate which ffq they've taken and if that one was taken/complete?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that's overkill for the sake of this particular function. If a sample (or source) is associated with more than one FFQ, let's return the one (and it's taken/complete statuses) that's temporally nearest to the sample collection date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, in my latest commit I get the closest sample collection data in sample_date and sample_time in ag.ag_kit_barcode to compare in startdate in ag.vioscreen_sessions.

Comment on lines 61 to 63
if source:
ffq_complete, ffq_taken, _ = \
vs_repo.get_ffq_status_by_source(source.id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two comments here:

  1. These lines are within a block of code that already checked if source is not None - isn't checking if source here redundant?
  2. If we successfully obtain a vio_id we should check the taken/complete status of that particular vio_id rather than anything associated with the source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. In my latest commit I've changed it in favor of looking up FFQs status via vio_id. In the query though, since vio_id is not in ag.ag_kit_barcode I first use the vio_id to obtain the source_id from ag.vioscreen_registry. Not sure if that's the best approach.

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.

2 participants