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

csv upload: do not import contributor roles without names or form source or type without a form value #4075

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

ndushay
Copy link
Contributor

@ndushay ndushay commented Aug 2, 2023

HOLD for PO approval (Andrew)

Why was this change made? 🤔

Fixes #4071
Fixes #4072

Contributors with roles but not name are basically invalid and require complex remediation (error when publishing).
Form data without a value (e.g. it just has source or type, but no value) also require complex remediation (prevents indexing)

I've created sul-dlss/cocina-models/issues/610 for cocina validation of contributors

How was this change tested? 🤨

Andrew reviewed it in stage; also specs.

⚡ ⚠ If this change has cross service impact (including writing to shared file systems or interacting with other SDR APIs), run integration tests and/or test in [stage|qa] environment, in addition to specs. ⚡

⚡ ⚠ If this change updates the Argo UI, run all integration tests that use Argo and create a PR on the integration test repo to fix anything this change breaks. ⚡

Does your change introduce accessibility violations? 🩺

Nope!

⚡ ⚠ Please ensure this change does not introduce accessibility violations (at the WCAG A or AA conformance levels); if it does, include a rationale. See the Infrastructure accessibility guide for more detail. ⚡

@ndushay ndushay added the hold for PO review PO needs to sign off before merge label Aug 2, 2023
@ndushay ndushay changed the title for csv upload: do not import contributor roles without names [Hold] for csv upload: do not import contributor roles without names Aug 2, 2023
@ndushay ndushay force-pushed the ignore-meaningless-metadata-imports branch 3 times, most recently from faf379f to 7dddfe4 Compare August 3, 2023 20:31
@ndushay ndushay changed the title [Hold] for csv upload: do not import contributor roles without names [Hold] for csv upload: do not import contributor roles without names or form source or type without a form value Aug 3, 2023
@ndushay ndushay changed the title [Hold] for csv upload: do not import contributor roles without names or form source or type without a form value csv upload: do not import contributor roles without names or form source or type without a form value Aug 3, 2023
}]
},
"purl": "https://sul-purl-stage.stanford.edu/bb041bm1345"
"title": [{
Copy link
Contributor Author

@ndushay ndushay Aug 3, 2023

Choose a reason for hiding this comment

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

this part is just formatting (how did we end up with so smay spaces??)

end
end

context "with form property" do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the form tests start here.

@ndushay ndushay removed the hold for PO review PO needs to sign off before merge label Aug 3, 2023
def remove_nested_attributes_without_value(compacted_params_hash)
# event can have contributors, geographic can have form
[:relatedResource, :event, :geographic].each do |parent_property|
next if compacted_params_hash[parent_property].blank?
Copy link
Member

Choose a reason for hiding this comment

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

Are we protecting against nils or empty arrays or both or something else here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we only care to process if there is a (parent_property) present in the hash. It could also be worded:

next unless compacted_params_hash[parent_property].present?

and I had it that way, but it seemed more confusing.

Yes - we are protecting against nil and also empty arrays. It all depends on what columns are in the spreadsheet, at this point.

@aaron-collier aaron-collier merged commit 491b457 into main Aug 4, 2023
@aaron-collier aaron-collier deleted the ignore-meaningless-metadata-imports branch August 4, 2023 19:26
@ndushay
Copy link
Contributor Author

ndushay commented Aug 7, 2023

tagging @justinlittman because I just noticed there is a DescriptionValidator service in Argo. I think, per the tickets, I was not supposed to reject the csv, but just ignore these oddities ... but would welcome your review and wonder if this now working-code-wins solution is contrary to a design I didn't see.

@justinlittman
Copy link
Contributor

I defer to @andrewjbtw on desired behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants