Skip to main content

Research Oriented Smart Data Library (CLI + PDF/Math utilities)

Project description

rosdl

Rosdl: Rapid Open Source Data Library

rosdl is a lightweight Python library that streamlines research and data workflows by combining essential utilities into one package. It provides tools for handling PDFs (split, merge, extract), performing OCR, managing archives, cleaning CSVs, converting file formats, processing images, extracting metadata, running quick EDA with drift detection, and generating synthetic data. With both Python APIs and a simple CLI, rosdl helps researchers, students, and developers save time and focus on insights instead of struggling with scattered tools.


Quick Install

From the project root:

Install base package (CLI):

python -m pip install -e .
python -m pip install -r requirements.txt

Install optional extras:

  • Math:
    python -m pip install -e ".[mat]"
    
  • PDF (requires system packages, see below):
    python -m pip install -e ".[pdf]"
    
  • OCR:
    python -m pip install -e ".[ocr]"
    
  • Metadata:
    python -m pip install -e ".[meta]"
    
  • Or install PDF packages individually:
    python -m pip install PyPDF2 pdf2image Pillow pytesseract
    

System Requirements (Windows)

  • Poppler (for pdf2image / pdftotext): add poppler\bin to PATH.
  • Tesseract OCR (for OCR): add tesseract to PATH.

Install via your package manager (Chocolatey) or download installers and add to PATH.


Usage

Run commands from the repo root (or after installing the package, the rosdl entrypoint will be available).

Basic

rosdl hello

PDF Utilities

# Split PDF into pages (will prompt for folder name if not provided)
rosdl pdf split input.pdf [out/split_folder]

# Merge PDFs (if -o not provided you'll be prompted; default save is next to first input)
rosdl pdf merge file1.pdf file2.pdf ... -o merged.pdf

# Extract text -> writes a .txt file next to input by default (will prompt for filename if not provided)
rosdl pdf extract-text input.pdf
rosdl pdf extract-text input.pdf --output out\custom_name.txt

# Convert PDF pages to images (requires Poppler)
rosdl pdf to-images input.pdf [out/images_folder]

OCR Utilities

# OCR an image or PDF page (requires Tesseract)
# Will prompt for output filename or use --output
rosdl ocr input.png
rosdl ocr input.png --output out\ocr_output.txt

Metadata Extractor

# Extract metadata for a single file
rosdl meta file sample.pdf

# Extract metadata for a folder
rosdl meta folder "path_to_folder"

# Export metadata (json or csv)
rosdl meta export some_folder -e json -o out\metadata.json
rosdl meta export some_folder -e csv -o out\metadata.csv

Text Utilities

# Load and read text from files
rosdl text load input.txt
rosdl text read-pdf input.pdf
rosdl text read-docx input.docx

# Tokenization
rosdl text tokenize input.txt  # splits into words
rosdl text sent-tokenize input.txt  # splits into sentences

Note: NLTK’s punkt resource is required for sentence tokenization:

import nltk
nltk.download('punkt')

Image Utilities

# Convert image format
rosdl img convert input.png --to jpg --output out\converted.jpg

# Resize image
rosdl img resize input.png --width 800 --height 600 --output out\resized.png

# Remove EXIF metadata
rosdl img remove-exif input.jpg --output out\clean.jpg

# Upscale image
rosdl img upscale input.png --scale 2 --output out\upscaled.png

CSV / XLSX / File Conversion

# Convert CSV -> XLSX
rosdl convert csv-to-xlsx input.csv --output out\output.xlsx

# Convert XLSX -> CSV
rosdl convert xlsx-to-csv input.xlsx --output out\output.csv

# Convert PDF -> Word
rosdl convert pdf-to-word input.pdf --output out\output.docx

# Convert video/audio
rosdl convert mp4-to-mp3 input.mp4 --output out\output.mp3

EDA & Drift Detection

# Quick exploratory data analysis
rosdl eda quick input.csv

# Detect drift between two datasets
rosdl eda drift old_data.csv new_data.csv

Note: Ensure numeric columns are correctly detected; missing or non-numeric data may cause errors.


Synthetic Data Generation

# Generate a realistic name
rosdl gen name 10  # generates 10 names

# Generate realistic phone numbers or cities
rosdl gen phone 5
rosdl gen city 5

# Generate custom string, int, float, or PID columns
rosdl gen string 10 --prefix "item"
rosdl gen int 10 --min 1 --max 100
rosdl gen float 10 --min 0 --max 1

# Generate dataset from schema or prompt
rosdl gen schema schema.json --rows 50
rosdl gen prompt "columns: name, age, city" --rows 20

Default Output Behavior

  • When an output path/folder is omitted, rosdl will:
    • Prompt only for a filename/folder name (not a full path).
    • Save the result in the same directory as the input file (or inside the input folder for merge-folder).
    • This makes running commands on a file from Desktop create outputs on the Desktop by default.
  • You may always supply a full path (or use the relevant --output option) to save elsewhere.

Viewing Extracted Text

  • The extract-text and ocr commands write a .txt file. On Windows:
    notepad "input.txt"
    
  • You can also direct output to stdout or pipe into pagers (Git Bash / WSL):
    rosdl pdf extract-text input.pdf > out\input.txt
    less -S out\input.txt
    

Troubleshooting

  • If the CLI fails to import PDF/image/OCR libraries, either:
    • Install the PDF extras: python -m pip install -e ".[pdf]"
    • Or install missing packages individually.
  • If a command requires Poppler or Tesseract, install those system tools and add to PATH.
  • If pip install -e . errors with multiple top-level folders, exclude non-package folders or update package discovery in pyproject.toml.

Contributing

Open a PR or issue with minimal repro steps. Keep helpers small and document any system dependencies clearly.


License

License

This project is licensed under the MIT License. See the [LICENSE] file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rosdl-0.0.2.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rosdl-0.0.2-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file rosdl-0.0.2.tar.gz.

File metadata

  • Download URL: rosdl-0.0.2.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for rosdl-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1530f4de635d0d753780830c34a2e272c3ce962c88ac7d5eb26087b99db0834b
MD5 dc9688bab51639f8676735a69321247d
BLAKE2b-256 efd622446586575b390e6786e3190ac602c2c59a190c60a1f9a5ca6e255080fa

See more details on using hashes here.

File details

Details for the file rosdl-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: rosdl-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for rosdl-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4f94f1f443e39d77461bbb1c155a5bc93e3592d769962fd68fc63134eaac71cf
MD5 db9bc81d51e0a7b3bd53bc6bd68a8e3d
BLAKE2b-256 95399cd12cd670950b5974557f77bbc3455cd1fdbc367be7304f4b4de78973ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page