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

Added new option in getDataverse endpoint for optionally retrieving child count #11259

Merged
merged 7 commits into from
Feb 24, 2025

Conversation

GPortas
Copy link
Contributor

@GPortas GPortas commented Feb 13, 2025

What this PR does / why we need it:

Adds a new query param, returnChildCount, to getDataverse endpoint for optionally retrieving the child count, which represents the number of dataverses, datasets, or files within the dataverse.

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this:

If you want to obtain the child count of a Dataverse, you must set returnChildCount query parameter to true. Example:

curl "https://demo.dataverse.org/api/dataverses/root?returnChildCount=true"

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

No

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

Yes, attached.

Additional documentation:

N/A

This comment has been minimized.

2 similar comments

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@GPortas GPortas marked this pull request as ready for review February 13, 2025 17:08
@GPortas GPortas added Size: 3 A percentage of a sprint. 2.1 hours. SPA These changes are required for the Dataverse SPA Original size: 3 SPA.Q1 Not related to any specific Q1 feature labels Feb 13, 2025

This comment has been minimized.

2 similar comments

This comment has been minimized.

Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11255-child-count-get-collection-ext
ghcr.io/gdcc/configbaker:11255-child-count-get-collection-ext

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

@sekmiller
Copy link
Contributor

@GPortas do we need to account for published/unpublished based on the user making the call? Also do we need to go more than one layer in (get the objects owned by the collections owned by the given collection)?

@GPortas
Copy link
Contributor Author

GPortas commented Feb 16, 2025

@GPortas do we need to account for published/unpublished based on the user making the call? Also do we need to go more than one layer in (get the objects owned by the collections owned by the given collection)?

For the purpose of this extension, we do not need to differentiate between published and unpublished states based on the user. FWIW, this endpoint uses the same database query as the JSF logic we are replicating in the SPA to determine whether a Dataverse has data (see Dataverse.java#L49).

The key difference is that, for the API, instead of simply returning whether the Dataverse has data or is empty, I found it more useful for other use cases to return the child count, so the SPA only needs to check if the value is greater than 0.

Additionally, we only need to return the direct child count, not multiple layers.

Would it be helpful to clarify these points further in the field naming or documentation to avoid confusion?

@sekmiller
Copy link
Contributor

Thanks @GPortas. That's what I figured. I just wanted to make sure it was considered.

Copy link
Contributor

@sekmiller sekmiller left a comment

Choose a reason for hiding this comment

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

Looks good. moving on.

@sekmiller sekmiller removed their assignment Feb 18, 2025
@ofahimIQSS
Copy link
Contributor

no issues found with this PR - merging

@ofahimIQSS ofahimIQSS merged commit 089a505 into develop Feb 24, 2025
17 of 18 checks passed
@ofahimIQSS ofahimIQSS deleted the 11255-child-count-get-collection-ext branch February 24, 2025 14:07
@pdurbin pdurbin added this to the 6.6 milestone Feb 24, 2025
@pdurbin
Copy link
Member

pdurbin commented Feb 24, 2025

Adds a new query param, returnChildCount, to getDataverse endpoint for optionally retrieving the child count, which represents the number of dataverses, datasets, or files within the dataverse.

@GPortas @sekmiller @ofahimIQSS are these direct children only?

Or does it count children, grandchildren, great-grandchildren, etc?

I'm asking because we might we might want to clarify the guides and release note.

@sekmiller
Copy link
Contributor

@pdurbin it is only direct children

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA.Q1 Not related to any specific Q1 feature SPA These changes are required for the Dataverse SPA
Projects
Status: Done 🧹
Development

Successfully merging this pull request may close these issues.

Extend Get Collection endpoint to include child object count
4 participants