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

Custom metadata support boolean values #10480

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

jeromeroucou
Copy link
Contributor

@jeromeroucou jeromeroucou commented Apr 10, 2024

What this PR does / why we need it:

This PR add possibility for a depositor to write boolean values for a metadata field.

Which issue(s) this PR closes:

Special notes for your reviewer:

I take a large possible value, view on documentation Feature Flag.
On dataset edition, it's a input text to write metadata value.

Suggestions on how to test this:

On a metadata file, add a new metadata like below (exemple for citation.tsv file) :

	booleanMetadata	Boolean metadata		true, 1, yes, Y, On, false, 0, no, N, Off	boolean	99	#VALUE	FALSE	FALSE	FALSE	FALSE	TRUE	FALSE		citation	

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Boolean metadata on dataset edition :
edit_boolean_metadata

Invalid boolean value :
edit_boolean_metadata_invalid

Boolean value on dataset metadata view :
bool_metadata

dataverse_json export :

{"typeName":"booleanMetadata","multiple":false,"typeClass":"primitive","value":"TRUE"}

Is there a release notes update needed for this change?:

Yes, a new commit will be added to add more detail on release note snippet

Additional documentation:

Added boolean support on metadata customization documentation. Preview at

https://dataverse-guide--10480.org.readthedocs.build/en/10480/admin/metadatacustomization.html#fieldtype-definitions

@coveralls
Copy link

Coverage Status

coverage: 20.723% (+0.01%) from 20.71%
when pulling 2615216 on Recherche-Data-Gouv:7961_Custom_Metadata_support_boolean_values
into bee4eb4 on IQSS:develop.

@pdurbin
Copy link
Member

pdurbin commented Apr 10, 2024

@jeromeroucou thanks for the pull request! @Asbjoedt and I have been discussing possible implementations at https://dataverse.zulipchat.com/#narrow/stream/379673-dev/topic/The.20boolean/near/405225599 and then in person in Mexico so I'd love for him to take a look to see if this will work for him.

You don't happen to have the code deployed to a server do you?

@jeromeroucou
Copy link
Contributor Author

Sure, if @Asbjoedt can review the PR, this could be a good idea. And no, this PR doesn't have been tested on a server yet, only on my laptop.

Thanks for asking the question @pdurbin, it reminds me that having an integration server is going to become a good thing for Research Data Gouv team given the PR proposals we're doing.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

This is a great start! I left some comments.

@jeromeroucou would you be able to add some screenshots in the description of this PR to show how the boolean looks and behaves in the GUI? Nevermind. I see you did this already. I'm a little confused by the GUI, actually. Let me think about it some more.

@@ -0,0 +1,5 @@
Boolean support added for fieldType definition. Accepted values are "true", "1", "yes", "Y", "On", "false", "0", "no", "N", "Off". All values are case insensitive.

A HTML preview can be found [here](https://dataverse-guide--7961.org.readthedocs.build/en/7961/admin/metadatacustomization.html#fieldtype-definitions).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
A HTML preview can be found [here](https://dataverse-guide--7961.org.readthedocs.build/en/7961/admin/metadatacustomization.html#fieldtype-definitions).
Documentation can be found at https://dataverse-guide--10480.org.readthedocs.build/en/10480/admin/metadatacustomization.html#fieldtype-definitions

@@ -36,8 +36,8 @@ public class DatasetFieldType implements Serializable, Comparable<DatasetFieldTy
* The set of possible metatypes of the field. Used for validation and layout.
*/
public enum FieldType {
TEXT, TEXTBOX, DATE, EMAIL, URL, FLOAT, INT, NONE
};
TEXT, TEXTBOX, DATE, EMAIL, URL, FLOAT, INT, BOOLEAN, NONE
Copy link
Member

Choose a reason for hiding this comment

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

What about SolrField.java? Should we add BOOLEAN to the list:

STRING("string"), TEXT_EN("text_en"), INTEGER("int"), LONG("long"), DATE("text_en"), EMAIL("text_en");

And should we use BoolField? See https://solr.apache.org/guide/solr/latest/indexing-guide/field-types-included-with-solr.html

@@ -0,0 +1,5 @@
Boolean support added for fieldType definition. Accepted values are "true", "1", "yes", "Y", "On", "false", "0", "no", "N", "Off". All values are case insensitive.
Copy link
Member

Choose a reason for hiding this comment

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

@jeromeroucou what is the default value? True or false?

Also, did you consider if the field could be nullable or not? @Asbjoedt and I talked about this.

Copy link
Member

Choose a reason for hiding this comment

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

@jeromeroucou please see this new pull request where @Asbjoedt has a field that can be yes, no, or unknown:

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @pdurbin for your comment.

I agree with the discussion in the issue, it repeats what was said in the chat (Zulip), and that by indicating that the new archival.tsv file is experimental, I would take its modification into this PR (it will be the first demonstrator of the feature).

Do you agree with me?

Copy link
Member

Choose a reason for hiding this comment

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

@jeromeroucou first, sorry for the slow reply. I was on vacation and I'm still catching up!

I'm a little confused. Are you saying you would modify this PR to all for "unknown"? And then we'd use archival.tsv to test it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @pdurbin , I hope you vacation was great !

I wanted to say that I think the proposal made in the archival.tsv file seems to correspond to what was exchanged in zulip, i.e. either "yes", "no" or "unknown". And I would modify my PR accordingly to take into account what is proposed in the archival.tsv file. As for the order, I think that the PR #10626 can be processed first, and that I would take it into account via a merge.

Is it more clearly?

Copy link
Member

Choose a reason for hiding this comment

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

Well...

The thing about #10626 is that it's using the type "text". I'm referring to the submitToArchivalAppraisal field specifically.

This PR (#10480) adds a new type called "boolean". If we merge this PR first we can have submitToArchivalAppraisal use "boolean" instead, right?

@pdurbin pdurbin added the Type: Feature a feature request label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature a feature request
Projects
Status: Interested
Status: No status
Status: 🚧 Dev by Recherche Data Gouv
Development

Successfully merging this pull request may close these issues.

Custom Metadata: support boolean values
4 participants