Skip to content

Asychronous import and updates when applying Fair Data Station rdf #2210

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

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

Conversation

stuzart
Copy link
Member

@stuzart stuzart commented Jun 9, 2025

stuzart added 30 commits May 14, 2025 11:37
also linked to appropriate associations with validations.
… protections against updating when not allowed #2197
stuzart added 6 commits June 4, 2025 11:44
moved to a common function and out of the inline js other than a call to the function
…gation needs to be manageable #2197

updated validation and tests accordingly
if import, needs a project. If update, needs an investigation
@stuzart stuzart marked this pull request as draft June 9, 2025 12:56
@stuzart stuzart requested a review from Copilot June 9, 2025 12:57
Copilot

This comment was marked as outdated.

@stuzart stuzart requested a review from Copilot June 13, 2025 13:10
Copilot

This comment was marked as outdated.

@stuzart stuzart marked this pull request as ready for review June 16, 2025 08:13
@stuzart stuzart requested review from whomingbird and fbacall June 16, 2025 08:14
investigation_external_identifier: fair_data_station_inv.external_id,
purpose: :update, content_blob: content_blob
)
fair_data_station_upload.save!
Copy link
Contributor

Choose a reason for hiding this comment

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

This would throw a 500 error if the upload failed validation for whatever reason

Investigation.transaction do
@investigation = Seek::FairDataStation::Writer.new.update_isa(@investigation, data_station_inv, current_person, @investigation.projects, @investigation.policy)
@investigation.save!
in_progress = FairDataStationUpload.matching_updates_in_progress(@investigation, fair_data_station_inv.external_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be better as a uniqueness validation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, also very similar to the sample extraction, persistence, sample type template creation, and data file unzipping.


investigation = Seek::FairDataStation::Writer.new.construct_isa(fair_data_station_inv, person, [project], policy)
User.with_current_user(person) do
investigation.save!
Copy link
Contributor

@whomingbird whomingbird Jun 18, 2025

Choose a reason for hiding this comment

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

Consider checking investigation.valid? and logging more specific errors before save! The same thing can apply to the update job.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, I concidered this but it decided it is out of scope for this task. It does record the validation error in the task, and at one point I displayed it, but decided it was too cryptic. You'll have noticed that it said "Studies are invalid" when this is not the case, and infact is caused by invalid samples. What it needs is to iterate over all the items and generate a report, which becomes quite complex and a large task.
It's no different to how it was before, and this task was to make it ansychronous.
Also most errors would be caused by a configuration error, it's already been validated by FDS, and these are reported to the admin.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is true. when i tried to track down the reason why jobs failed.. i had to iterate over all related items.. it would be not easy to find the "real" item which prevents the save.

end
end

def fair_data_station_imports_to_show(project, contributor)
Copy link
Contributor

Choose a reason for hiding this comment

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

introduces an optional expiration_time filter to limit the returned uploads to recent ones based on created_at. This avoids cluttering the view with old failed or completed jobs, especially when retries are frequent.

.where('fair_data_station_uploads.created_at >= ?', expiration_time)

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Member Author

Choose a reason for hiding this comment

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

there is a close button X to close them

Copy link
Contributor

Choose a reason for hiding this comment

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

indeed.. didn't see it

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