Skip to content

Fix custom terms#48

Merged
JR-1991 merged 5 commits intomainfrom
fix-custom-terms
Apr 29, 2025
Merged

Fix custom terms#48
JR-1991 merged 5 commits intomainfrom
fix-custom-terms

Conversation

@JR-1991
Copy link
Copy Markdown
Member

@JR-1991 JR-1991 commented Apr 25, 2025

This PR extends the library to support custom terms, which are treated differently than the standard license field. This enhancement addresses the use case raised in #46 regarding custom terms of use. Additionally, it resolves issue #45, where fields like SocialScienceNotes (which is a sinfle-valued compound) were parsed incorrectly, resulting in a DottedDict holding the raw response and triggering a ValidationError.

Implementation Details

Dataverse responses may include a set of custom term fields that appear at the root level of the JSON. This PR introduces a new CustomLicense class to encapsulate and parse these fields. The decision to extract this into a separate class is motivated by two key considerations:

  • Both License and CustomLicense are exposed via the same license property on the Dataset, maintaining a clean API and avoiding the need to manage additional initialization properties.
  • Mapping both to the same license field reflects Dataverse behavior, where either a standard license or custom terms may be present — but not both.

Example Usage

# Setting a custom license
dataset = dataverse.create_dataset()
dataset.license = CustomLicense(
    termsOfUse="This is a custom terms of use",
    confidentialityDeclaration="This is a custom confidentiality declaration",
    specialPermissions="This is a custom special permissions",
    restrictions="This is a custom restrictions",
    citationRequirements="This is a custom citation requirements",
    depositorRequirements="This is a custom depositor requirements",
    conditions="This is a custom conditions",
    disclaimer="This is a custom disclaimer",
)

@JR-1991 JR-1991 added bug Something isn't working enhancement New feature or request labels Apr 25, 2025
@JR-1991 JR-1991 self-assigned this Apr 25, 2025
@JR-1991 JR-1991 moved this to In Progress in PyDataverse Working Group Apr 25, 2025
@JR-1991 JR-1991 marked this pull request as ready for review April 25, 2025 17:50
@JR-1991 JR-1991 moved this from In Progress to Ready for Review in PyDataverse Working Group Apr 25, 2025
@JR-1991 JR-1991 added this to the v0.4.4 milestone Apr 25, 2025
@JR-1991 JR-1991 merged commit 8ddb369 into main Apr 29, 2025
13 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in PyDataverse Working Group Apr 29, 2025
@JR-1991 JR-1991 deleted the fix-custom-terms branch April 29, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

custom terms can't be loaded ValidationError compound fields in metadatablock social_science

1 participant