Dzaleka Digital Heritage CLI - A command-line interface for interacting with the Dzaleka Digital Heritage API
Project description
dzdk - Dzaleka Digital Heritage CLI
A command-line interface for interacting with the Dzaleka Digital Heritage API, providing rich, colorized output and comprehensive access to the camp's digital resources.
Features
- Services Management: List and view details of all available services in the camp, including contact information and locations.
- Event Management: Browse upcoming and past events, with detailed information about registration, dates, and locations.
- Photo Archive: Upload and browse photos from the camp, with support for metadata and descriptions.
- Population Statistics: Access detailed demographic data, including population trends, nationalities, and demographics.
- Resource Library: Download and manage digital resources, including documents, reports, and media files.
- API Health Monitoring: Comprehensive health checks for all API endpoints with detailed response analysis.
- Rich Terminal Output: Beautiful, colorized tables and panels for easy data visualization.
- Configurable Settings: Customize API URL and timeout settings to match your environment.
- Batch Operations: Download multiple resources or upload multiple photos in batch.
- Data Export: Export data to CSV format or generate detailed markdown reports.
- Search Functionality: Search across all resources with filtering and relevance sorting.
- Interactive Shell: Command-line interface with history, tab completion, and command suggestions.
Installation
1. Clone the Repository
git clone https://github.com/Dzaleka-Connect/dzdk-cli.git
cd dzdk-cli
2. Create and Activate a Virtual Environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
4. Install the CLI in Editable Mode
pip install -e .
Configuration
The CLI stores its configuration in ~/.dzdk/config.yaml. You can modify these settings:
- API URL: Base URL for the API (default: https://services.dzaleka.com/api)
- Timeout: Request timeout in seconds (default: 30)
Update Configuration
# Set custom API URL
dzdk config --url "https://services.dzaleka.com/api"
# Set custom timeout
dzdk config --timeout 30
# Update both settings
dzdk config --url "https://services.dzaleka.com/api" --timeout 30
Configuration
Show and update CLI configuration settings:
# Show current configuration
dzdk show_config
# Interactive configuration mode
dzdk config --interactive
# Set API URL
dzdk config --url "https://services.dzaleka.com/api"
# Set request timeout
dzdk config --timeout 30
You can also update both settings at once:
dzdk config --url "https://services.dzaleka.com/api" --timeout 30
This will update the configuration file at ~/.config/dzdk/config.yaml.
Command Reference
Health Check
Check the health of all API endpoints with detailed response analysis:
dzdk health
This command provides:
- Response status codes
- Response times
- Response types (JSON/Non-JSON)
- Error messages if any
Services
List all available services with detailed information:
# Basic list (12 items per page)
dzdk services list
# Navigate to specific page
dzdk services list --page 2
# Search for specific services
dzdk services list --search "health"
# Filter by category
dzdk services list --category "medical"
# Filter by status
dzdk services list --status active
# Sort results
dzdk services list --sort-by category --sort-order desc
# Combine filters with pagination
dzdk services list --search "clinic" --category "medical" --status active --page 1
Service details include:
- Service title and description
- Category and status
- Contact information (email, phone)
- Website information
- Status indicators (active/inactive/unknown)
- Total count of matching services
- Active filters display
- Page navigation (12 items per page)
Search and Filter Options:
- Search: Search across title, description, and category
- Category: Filter by specific service category
- Status: Filter by service status (active/inactive/unknown)
- Sort By: Sort results by title, category, or status
- Sort Order: Choose ascending or descending order
Get information about a specific service:
dzdk services get --id <service_id_or_slug>
Service details include:
- Service title and description
- Category and status
- Location details (address, city)
- Contact information (email, phone)
- Operating hours
- Additional metadata
Events
List all events with key information:
# Basic list (12 items per page)
dzdk events list
# Navigate to specific page
dzdk events list --page 2
# Search and filter with pagination
dzdk events list --search "workshop" --category "education" --page 1
# Sort with pagination
dzdk events list --sort-by date --sort-order desc --page 1
Get detailed information about a specific event:
dzdk events get --id <event_id_or_slug>
Event details include:
- Title and description
- Date and time
- Location
- Registration information
- Contact details
- Tags and categories
Photos
List all available photos:
# Basic list (12 items per page)
dzdk photos list
# Navigate to specific page
dzdk photos list --page 2
# Search and filter with pagination
dzdk photos list --search "camp" --category "events" --page 1
# Sort with pagination
dzdk photos list --sort-by date --sort-order desc --page 1
Get information about a specific photo:
dzdk photos get --id <photo_id_or_slug>
Photo details include:
- Title and description
- Date taken
- Photographer information
- Location
- Tags and categories
- Image metadata (size, format)
- Download URL
Upload a photo to the archive:
dzdk photos upload --file path/to/image.jpg --title "Photo Title" --description "Optional description"
Edit photo metadata:
dzdk photos edit --id <photo_id> --title "New Title" --description "New Description" --tags "tag1,tag2" --location "New Location" --date "2024-03-20"
View detailed photo metadata:
dzdk photos metadata --id <photo_id>
Photo Albums
Create a new album:
dzdk photos album create --name "My Album" --description "Album Description" --tags "tag1,tag2"
Add photos to an album:
dzdk photos album add --album-id <album_id> --photo-ids "photo1,photo2,photo3"
List all albums:
dzdk photos album list
Features:
- Album creation and management
- Photo organization
- Tag-based categorization
- Rich metadata display
- Batch photo operations
- Technical metadata viewing
- Location and date tracking
Population
Get comprehensive population statistics:
dzdk population stats
Get specific demographic information:
dzdk population get --category <demographic_category>
Available categories:
- age_groups
- nationalities
- gender
- new_arrivals
- historical_trends
Statistics include:
- Total population
- New arrivals
- Demographics breakdown
- Nationality distribution
- Historical trends
Resources
List all available resources:
# Basic list (12 items per page)
dzdk resources list
# Navigate to specific page
dzdk resources list --page 2
# Search and filter with pagination
dzdk resources list --search "report" --category "research" --page 1
# Sort with pagination
dzdk resources list --sort-by date --sort-order desc --page 1
Get detailed information about a specific resource:
dzdk resources get --id <resource_id_or_slug>
Resource information includes:
- Title and description
- Author and date
- File type and size
- Available languages
- Download URLs
- Version history
- Related resources
Download a resource:
dzdk resources fetch --id <resource_id_or_slug> --output filename.pdf
Search
Search across all resources with filtering and relevance sorting:
# Search across all content types
dzdk search --query "education"
# Search only in services
dzdk search --query "health" --type services
# Search with a custom result limit
dzdk search --query "event" --limit 20
Features:
- Cross-resource search
- Type filtering
- Relevance sorting
- Result limiting
- Rich output formatting
Batch Operations
Download multiple resources or photos in batch:
# Download multiple resources
dzdk batch download --type resources --ids "id1,id2,id3" --output-dir downloads
# Download multiple photos
dzdk batch download --type photos --ids "photo1,photo2" --output-dir photos
Features:
- Parallel downloads
- Progress tracking
- Error handling
- Automatic directory creation
Upload multiple photos from a directory:
# Upload all photos from a directory
dzdk batch upload --type photos --directory ./my_photos
Features:
- Batch processing
- File validation
- Progress tracking
- Error handling
Export
Export data to CSV format:
# Export services to CSV
dzdk export csv --type services --output services.csv
# Export population data to CSV
dzdk export csv --type population --output population.csv
Features:
- Flattened data structure
- Preserved metadata
- Proper CSV formatting
Generate detailed markdown reports:
# Generate a services report
dzdk export report --type services --output services_report.md
# Generate a population report
dzdk export report --type population --output population_report.md
Features:
- Comprehensive summaries
- Detailed item information
- Formatted markdown output
- Timestamps and metadata
Interactive Shell
Start an interactive shell session with command history and tab completion:
dzdk shell
Features:
- Command history persistence
- Tab completion for commands
- Command suggestions based on history
- Rich output formatting
- Built-in help system
- Screen clearing
- Easy command execution
Example shell session:
(dzdk) help
(dzdk) services list
(dzdk) photos upload --file photo.jpg --title "My Photo"
(dzdk) search --query "education"
(dzdk) clear
(dzdk) exit
Shell Commands:
help [command]: Show help informationclear: Clear the terminal screenexit: Exit the shell- All regular CLI commands are available
Output Formatting
The CLI uses the Rich library to provide beautiful, colorized output:
- Tables: Organized data presentation with color-coded columns
- Panels: Detailed information in bordered boxes
- Progress Bars: Visual feedback for long-running operations
- Status Indicators: Color-coded success/error messages
- Visualizations: Bar charts and graphs for data representation
- Search Results: Formatted panels with type-specific details
Development
Adding New Features
- Follow the existing code structure
- Add proper error handling
- Include progress indicators for long operations
- Add appropriate documentation
- Update the README with new commands
Testing
- Run the test suite:
pytest - Test new features thoroughly
- Verify error handling
- Check output formatting
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Update documentation
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
For questions or support, please contact:
- Email: contact@mail.dzaleka.com
- Website: https://services.dzaleka.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dzdk-0.1.0.tar.gz.
File metadata
- Download URL: dzdk-0.1.0.tar.gz
- Upload date:
- Size: 773.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7458268a03a12d76f0240986fab105340b6ad0248fd5c69b6e7fca283306e354
|
|
| MD5 |
c616d45f07e21de636aa13a6c1dcf10c
|
|
| BLAKE2b-256 |
175f503b1f13fc2698a955653f0a121da3576f9b1a90a8680b3edded7f8603f0
|
Provenance
The following attestation bundles were made for dzdk-0.1.0.tar.gz:
Publisher:
python-publish.yml on Dzaleka-Connect/dzdk-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dzdk-0.1.0.tar.gz -
Subject digest:
7458268a03a12d76f0240986fab105340b6ad0248fd5c69b6e7fca283306e354 - Sigstore transparency entry: 220526477
- Sigstore integration time:
-
Permalink:
Dzaleka-Connect/dzdk-cli@def50622c2006f94403886f976d8589b191bd9d3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Dzaleka-Connect
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@def50622c2006f94403886f976d8589b191bd9d3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dzdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dzdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c0ebf9001d66611607b0dc865749ae0db55c5d0edf381948c22464561489da2
|
|
| MD5 |
66552aa6292e8586d3f0a3b0e8c2b537
|
|
| BLAKE2b-256 |
32aa2396f31a11827911e2dbb00aeb8f668d9ead212b3a437bc7087a77a67f00
|
Provenance
The following attestation bundles were made for dzdk-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on Dzaleka-Connect/dzdk-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dzdk-0.1.0-py3-none-any.whl -
Subject digest:
2c0ebf9001d66611607b0dc865749ae0db55c5d0edf381948c22464561489da2 - Sigstore transparency entry: 220526478
- Sigstore integration time:
-
Permalink:
Dzaleka-Connect/dzdk-cli@def50622c2006f94403886f976d8589b191bd9d3 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Dzaleka-Connect
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@def50622c2006f94403886f976d8589b191bd9d3 -
Trigger Event:
release
-
Statement type: