Skip to main content

iatro-base-iac

IatroCache (.iac) — a lightweight, high-performance binary container format for offline caching of multimodal medical datasets (image tiles, feature vectors, clinical text, expert tokens, etc.).

This package provides the core container format and readers/writers for .iac files. It is designed for high-concurrency training pipelines, with explicit owned-byte and memory-mapped (mmap) zero-copy read APIs.


Installation

pip install iatro-base-iac

Python API

from iatro.iac import Codec, PackReader, build_pack

Format Layout

[ fixed header        ] 65536 bytes  — magic "IATROC", JSON header (codec, payload_type, offsets, ...)
[ slide table         ] Arrow IPC    — slide_idx / slide_id / patient_id
[ index table         ] Arrow IPC    — caller-defined columns + offset / length / crc32
[ data segment        ] raw bytes    — concatenated payloads, indexed by the index table

Key Technical Features

  • Explicit Boundaries & Integrity: Each record carries offset / length / crc32. Payload boundaries are explicit, eliminating the need to scan for framing markers. This works seamlessly for codecs without self-delimiting frames (e.g. raw Brotli).
  • High Performance: PackReader.read_payload_views() exposes zero-copy, lock-free mmap views for batch decoding, while read_payload() and read_payloads() always return owned bytes.
  • Metadata Flexibility: payload_type and codec are free-form header fields; the low-level container does not interpret the payload bytes directly.

Quick Start (Core API)

Below is an example of writing raw bytes to an .iac pack and reading them back:

import pyarrow as pa
from iatro.iac import build_pack, PackReader

# 1. Define metadata tables
slide_table = pa.table({
    "slide_idx": pa.array([0], pa.uint8()),
    "slide_id": ["s0"], 
    "patient_id": ["p0"]
})

# Offset, length, and crc32 columns are populated automatically
index_table = pa.table({
    "item_id": ["item_a", "item_b"]
})

# 2. Build the cache file
build_pack(
    output_path="out.iac",
    header_json={"payload_type": "raw_bytes", "codec": Codec.NONE},
    slide_table=slide_table,
    index_table=index_table,
    payloads=[b"first_payload_data", b"second_payload_data"]
)

# 3. Read payloads concurrently
reader = PackReader("out.iac")
print(reader.read_payload(1))  # Output: b"second_payload_data"

# Stable owned-data API: always list[bytes]
owned = reader.read_payloads([0, 1])

# Explicit zero-copy API: always list[memoryview], or raises if mmap is unavailable
views = reader.read_payload_views([0, 1])
reader.close()

For large-scale or streaming datasets, refer to build_pack_streaming, build_pack_data_segment, and build_pack_data_segment_from_file.

Pack-level codecs use one public interface. Native byte codecs are selected without a Python implementation wrapper, while user codecs may inherit Codec and register a reconstruction factory:

codec = Codec.create(Codec.ZSTD, level=3)

Reusable concrete schemas are distributed separately in iatro-iac-adapters. The adapter package depends on this core, so one command installs both:

pip install iatro-iac-adapters

Contributing & License

This project is licensed under the MIT License. Codec and Pack contributions are welcome.

Download files

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

Source Distribution

iatro_base_iac-0.1.0.tar.gz (56.7 kB view details)

Uploaded Source

Built Distribution

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

iatro_base_iac-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file iatro_base_iac-0.1.0.tar.gz.

File metadata

  • Download URL: iatro_base_iac-0.1.0.tar.gz
  • Upload date:
  • Size: 56.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for iatro_base_iac-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d584fb94313775b241331e434ce000289078d6ff2ffb44b505141bacea292146
MD5 1a43fecc624789833d99d84da86dc60c
BLAKE2b-256 d1a391d30323faad383a114d667bcac6627da0001f254e18a8d6dde06e8009d7

See more details on using hashes here.

File details

Details for the file iatro_base_iac-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for iatro_base_iac-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8de954a1f50075e52ac229fc69c0f0ea8c85ca7e4c3655791f41649adb87338c
MD5 df07d485fd7bfed851c967723150342f
BLAKE2b-256 8eb788f7da5e8b0f3a55792a37263ea2badd8491e37e060c251d3a97e982b9af

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.4

5 files

0.1.3

5 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page