Skip to content

Conversation

@JR-1991
Copy link
Member

@JR-1991 JR-1991 commented Sep 24, 2025

This pull request addresses issue #31, which accurately pointed out that tabIngest is not passed as an argument to the _get_json_data private function. This PR introduces a generic solution that aligns with the direct-upload mechanism. In this approach, the model_dump of the underlying PyDantic object is utilized. This way, manual jsonData setup is eliminated and controlled by the File class.

Upload logic and metadata handling:

  • Updated the _get_json_data function in dvuploader/nativeupload.py to use model_dump with a defined set of fields, replacing manual dictionary construction and ensuring only relevant metadata is included.
  • Removed the unused forceReplace field from the metadata payload in _update_single_metadata.

Test coverage:

  • Added a new test class TestPrepareRegistration in tests/unit/test_directupload.py to verify that the tab_ingest and other metadata fields are set correctly when preparing file registration, ensuring correct model behavior. [1] [2]

Closes issues

Enhanced the File model by adding detailed descriptions and aliases to its fields using Pydantic's Field parameters. This improves code readability and provides better documentation for each attribute.
Simplifies metadata construction by using model_dump with explicit field inclusion and removes manual forceReplace handling. Improves code readability and consistency in file categorization and metadata update logic.
Introduces TestPrepareRegistration to verify correct handling of tab_ingest, restrict, and categories attributes in the _prepare_registration function. Ensures registration output matches expected values for various File configurations.
@JR-1991 JR-1991 self-assigned this Sep 24, 2025
@JR-1991 JR-1991 added bug Something isn't working question Further information is requested labels Sep 24, 2025
@JR-1991 JR-1991 linked an issue Sep 24, 2025 that may be closed by this pull request
@JR-1991 JR-1991 changed the title 31 is tab ingest setting missing in get json data Pass tabIngest upon native upload Sep 24, 2025
@JR-1991 JR-1991 moved this to In Progress in PyDataverse Working Group Sep 24, 2025
@JR-1991 JR-1991 moved this from In Progress to QA in PyDataverse Working Group Sep 24, 2025
Updated dvuploader.py and nativeupload.py to properly construct file paths when directory_label is missing, falling back to file_name or raising a ValueError if neither is present. This improves robustness when processing files with incomplete metadata.
Simplifies the file comparison logic in TestParseYAMLConfig by building the actual_files list with explicit handling of directory_label, improving readability and maintainability.
@JR-1991 JR-1991 marked this pull request as ready for review September 24, 2025 10:59
@JR-1991 JR-1991 moved this from QA to Ready for Review in PyDataverse Working Group Sep 24, 2025
@JR-1991 JR-1991 merged commit d18b6f7 into main Sep 30, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in PyDataverse Working Group Sep 30, 2025
@JR-1991 JR-1991 deleted the 31-is-tab_ingest-setting-missing-in-_get_json_data branch September 30, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working question Further information is requested

Projects

Development

Successfully merging this pull request may close these issues.

Is tab_ingest setting missing in _get_json_data ?

2 participants