Your enhanced Dataverse bulk metadata update repository has been successfully created! This is an advanced version of the original single-dataset tool, now supporting multiple datasets with specific DOIs.
✅ Multi-Dataset Support
- Handle multiple datasets with different DOIs simultaneously
- Bulk update files across all datasets in one workflow
- CSV-based organization with DOI as first column
✅ Bidirectional Conversion
- JSON → CSV: Convert JSON templates to editable CSV format
- CSV → JSON: Convert updated CSV back to JSON files for Dataverse
- Seamless bidirectional workflow for maximum flexibility
✅ Metadata Management
- First column: DOI (dataset identifier)
- Second column: Dataset name
- File-level metadata: descriptions, file paths, labels
- Track update status for each file
✅ Dataverse Integration
- Direct API connection to Dataverse instances
- Dry-run mode to preview changes before applying
- Secure credential management via environment variables
- Batch update capabilities
✅ ZIP and Folder Support
- JSON files organized in
data/json_templates/folder - Support for multiple JSON files in a single directory
- Easy to add/remove datasets
Update_FileMetadata_Dataverse_multipleDOIs/
│
├── 📄 Core Python Scripts
│ ├── utils.py # Utility functions for JSON/CSV operations
│ ├── json_to_csv.py # Convert JSON → CSV
│ ├── csv_to_json.py # Convert CSV → JSON
│ └── dataverse_api.py # Dataverse API integration
│
├── 📁 Data Directories
│ ├── data/json_templates/ # Input: Your JSON template files
│ │ ├── climate_data_2024.json # (Sample)
│ │ ├── genomic_data_species_a.json # (Sample)
│ │ └── survey_data_2024.json # (Sample)
│ ├── data/json_output/ # Output: Generated JSON files
│ └── data/metadata.csv # Editable metadata file
│
├── 📋 Configuration & Documentation
│ ├── config.ini # Configuration file
│ ├── requirements.txt # Python dependencies
│ └── .gitignore # Git ignore rules
│
├── 📚 Documentation Files
│ ├── README.md # Full documentation ⭐ START HERE
│ ├── SETUP_GUIDE.md # Quick 5-minute setup
│ ├── INSTALLATION.md # Detailed installation
│ ├── WORKFLOW.md # Step-by-step workflow
│ ├── EXAMPLES.md # Practical use cases
│ └── LICENSE # MIT License
│
├── 🚀 Utility Scripts
│ └── quick_start.sh # Automated quick start script
│
└── 📦 Version Control
└── .git/ # Git repository (if initialized)
python3 -m venv venv
source venv/bin/activate
pip install requestspython json_to_csv.py \
--input-dir ./data/json_templates \
--output-csv ./data/metadata.csv- Open
data/metadata.csvin Excel or Google Sheets - Update
new_descriptionandnew_file_pathcolumns - Save the file
python csv_to_json.py --csv-file ./data/metadata.csvexport DATAVERSE_SERVER_URL="https://your-dataverse.org"
export DATAVERSE_API_TOKEN="your-token"
python dataverse_api.py --csv-file ./data/metadata.csv --no-dry-runThe generated CSV has these columns:
| Column | Purpose | Example |
|---|---|---|
DOI |
Dataset identifier (read-only) | doi:10.5061/dryad.example1 |
dataset_name |
Dataset name (read-only) | Climate Data 2024 |
file_id |
File ID (read-only) | file_001 |
file_label |
File name (read-only) | temperature_data.csv |
file_description |
Current description (read-only) | Monthly average temperature... |
file_path |
Current directory (read-only) | raw_data |
file_size |
File size in bytes (read-only) | 2048576 |
file_type |
Data type (read-only) | Text |
original_description |
Backup of original (read-only) | Same as file_description |
new_description |
✏️ EDIT THIS | Updated description |
new_file_path |
✏️ EDIT THIS | New directory path |
status |
Update status | pending, updated, no_changes |
JSON Files → CSV (auto-generated) → Edit descriptions → JSON → Dataverse
JSON Files → CSV → Update paths → JSON → Dataverse
Multiple JSON Files → Single CSV → Edit all datasets → Multiple JSONs → Dataverse
Cron Job → JSON → CSV → Updates → JSON → Dataverse (automated)
Three sample datasets are included for testing:
-
Climate Data 2024 - North America
- 3 files: temperature data, precipitation analysis, methodology
- DOI:
doi:10.5061/dryad.example1
-
Genomic Sequencing Dataset - Species A
- 4 files: sequence reads (R1, R2), assembly summary, quality report
- DOI:
doi:10.5061/dryad.example2
-
Survey Results - Consumer Preferences 2024
- 4 files: survey responses, demographics, R script, findings report
- DOI:
doi:10.5061/dryad.example3
Total: 11 sample file records for testing
load_json_file()- Load JSONsave_json_file()- Save JSONload_csv_file()- Load CSVsave_csv_file()- Save CSVextract_metadata_from_json()- Extract metadatavalidate_csv_row()- Validate dataget_json_files_from_directory()- Get all JSON files
- Main function:
json_to_csv_converter() - Supports single file or directory conversion
- Auto-generates CSV with all metadata columns
- Main function:
csv_to_json_converter() - Groups CSV rows by DOI
- Creates separate JSON files per dataset
- Class:
DataverseAPI- API client - Methods:
get_dataset_metadata()- Get dataset infoget_file_metadata()- Get file infoupdate_file_metadata()- Update file metadataget_dataset_files()- List filestest_connection()- Test connection
- Function:
push_updates_from_csv()- Bulk push updates
| Document | Purpose | Read Time |
|---|---|---|
| SETUP_GUIDE.md | Quick 5-minute setup | 5 min ⚡ |
| README.md | Full documentation | 15 min 📖 |
| INSTALLATION.md | Detailed setup help | 10 min 🛠️ |
| WORKFLOW.md | Complete workflow | 20 min 🔄 |
| EXAMPLES.md | Practical use cases | 15 min 💡 |
👉 Start with SETUP_GUIDE.md for quickest start!
| Feature | Original | New Version |
|---|---|---|
| Number of datasets | Single | Multiple ✓ |
| DOI handling | Single DOI | Multiple DOIs in one file ✓ |
| CSV format | N/A | DOI + Dataset name as columns ✓ |
| Bulk operations | Limited | Full bulk update support ✓ |
| Organization | Manual | Folder-based templates ✓ |
| Workflow | One-way | Bidirectional conversion ✓ |
| Dry-run mode | No | Full preview capability ✓ |
| Documentation | Minimal | Comprehensive with examples ✓ |
✅ Credential Security
- API tokens stored in environment variables only
- Never hardcoded in files or committed to git
.gitignoreprevents accidental commits
✅ Data Protection
- Dry-run mode to preview changes first
- Backup of original JSON files
- Git version control for tracking changes
✅ Access Control
- Environment variable based credentials
- Secure API token handling
- HTTPS-only Dataverse connections (recommended)
All components have been tested:
- ✅ JSON loading and parsing
- ✅ CSV generation and parsing
- ✅ File I/O operations
- ✅ Argument parsing and defaults
- ✅ Sample data included for testing
Run the quick test:
python json_to_csv.py --input-dir ./data/json_templatesExpected output: 11 rows converted successfully
config.ini includes settings for:
- Dataverse server URL
- API token management
- Path configurations
- CSV column names
- Logging options
- Workflow settings
- Beginner: Read SETUP_GUIDE.md (5 min)
- User: Follow WORKFLOW.md (20 min)
- Advanced: Review EXAMPLES.md for custom scripts
- Developer: Study individual Python modules
- Read the SETUP_GUIDE.md for quick start
- Place your JSON files in
data/json_templates/ - Run the conversion with
python json_to_csv.py - Edit the CSV with your updates
- Convert back to JSON with
python csv_to_json.py - Push to Dataverse with
python dataverse_api.py
If you encounter issues:
- Check INSTALLATION.md for setup problems
- Review WORKFLOW.md for process issues
- See EXAMPLES.md for code examples
- Check error messages in logs/
- Always test first: Use dry-run mode before applying changes
- Version control: Use git to track CSV changes
- Batch updates: Process multiple datasets at once
- Scheduling: Set up cron jobs for automated updates
- Logging: Enable detailed logging for debugging
You now have: ✅ 4 Python modules (utils, converters, API) ✅ 3 sample JSON files for testing ✅ 5 documentation files ✅ Sample CSV with 11 file records ✅ Configuration file ✅ Requirements file ✅ Quick start script ✅ Git ignore file
Total: 18 files with complete functionality
Your repository is production-ready and fully documented. Start with SETUP_GUIDE.md and you'll be updating Dataverse metadata in minutes!
Created: May 2026
Python Version: 3.7+
Main Dependencies: requests
License: MIT
For questions or issues, refer to the comprehensive documentation included in the repository.