The normalized model

Whatever version you fetch, iiisight hands you the same v3-shaped, typed, frozen model. It is a consumer subset of the Presentation API — the descriptive and structural properties a reader needs. Every collection field is a tuple that defaults to empty (never None), so traversal never trips on a missing list.

The shape

Collection ─ items ─▶ Manifest | Collection | Reference
Manifest ─ canvases ─▶ Canvas
         ─ structures ─▶ Range          (table of contents)
         ─ annotations ─▶ AnnotationPage (manifest-level, non-painting)
Canvas ─ items ─▶ AnnotationPage ─ items ─▶ Annotation ─ body ─▶ ContentResource
       │                                                        | TextualBody
       │                                                        | Choice ─ items ─▶ …
       ─ annotations ─▶ AnnotationPage    (non-painting: comments, tags, …)
ContentResource ─ service ─▶ ImageService

See the API reference for every field.

Traversal

manifest = iiisight.normalize(document)

for canvas in manifest.canvases:
    print(canvas.id, canvas.width, canvas.height, canvas.duration)

    # painting-annotation image bodies (derived, pure — no I/O)
    for image in canvas.images:
        print(image.id, image.format, image.width, image.height)

    # non-painting annotations (comments, captions, …)
    for page in canvas.annotations:
        for annotation in page.items:
            print(annotation.motivation, annotation.body, annotation.target)

Canvas.images and Canvas.image_service are computed properties over the parsed data — they never fetch. To load an image service’s info.json, ask the client explicitly (see Images & tiles).

Choices, start canvas, and ranges

A painting body can be a Choice — alternatives a viewer offers (colour vs. greyscale, multispectral layers), default first. Canvas.images yields only the default, since that is what gets painted; the alternatives are on the annotation:

annotation = canvas.items[0].items[0]
if isinstance(annotation.body, iiisight.Choice):
    for option in annotation.body.items:
        print(option.label, option.id)

Manifest.start is the canvas a viewer should open on — resolved to the real Canvas from manifest.canvases (or a SpecificResource for a point within one). A start naming a canvas the manifest doesn’t contain is dropped with an unresolved-start diagnostic.

Manifest.structures is a tree: each Range’s items holds nested sub-ranges and canvas references.

def toc(ranges, depth=0):
    for r in ranges:
        if isinstance(r, iiisight.Range):
            print("  " * depth + str(r.label))
            toc(r.items, depth + 1)


toc(manifest.structures)

From Presentation 2

v2 documents are upgraded before parsing, following @iiif/parser’s mapping, so the fields above are populated the same way:

v2

model

sequences[0].canvases

canvases (other sequences dropped, v2-multiple-sequences)

sequence viewingHint / viewingDirection / startCanvas

behavior / viewing_direction / start

description

summary

attribution

required_statement (label “Attribution”)

logo

provider[0].logo (agent id derived as <id>#provider)

license

rights

related / within

homepage / part_of

seeAlso / rendering / thumbnail

see_also / rendering / thumbnail

flat structures + ranges / members / within

nested structures tree

oa:Choice (default + item)

Choice, default first

oa:SpecificResource painting body

its full image (v2-specific-resource-unwrapped)

Language maps

IIIF strings are language maps ({"en": ["Title"]}). iiisight wraps them in LanguageMap:

label = manifest.label
str(label)  # a display string (preferred/any language)
label.text("en")  # the English value(s), joined
label.get("fr")  # list[str] for French (empty list if absent)
label.languages()  # available language codes

Descriptive fields like label, summary, and metadata[i].value are all language maps.

References vs. embedded resources

Inside a collection or a range, an item may be a fully-embedded resource or a bare pointer. iiisight models the pointer as a Reference (id / type / label). Fetch it with client.resolve(reference) or resolve a whole collection with client.expand(...).

for item in collection.items:
    if isinstance(item, iiisight.Reference):
        manifest = await client.resolve(item)  # sync: client.resolve(item)
    else:
        manifest = item  # already embedded

Services

Manifests, canvases, and image bodies can carry services (search, autocomplete, auth). These are parsed into Service objects on a resource’s services field, with the original JSON preserved on service.raw for specialized consumers. Image API services on a body stay typed as ImageService on ContentResource.service. See Search and Auth for the helpers that interpret them.

Descriptive properties and the source document

Beyond label/summary/metadata, every resource carries the descriptive properties the Presentation API defines: provider (a list of Agent), thumbnail (a list of ContentResource), homepage / rendering / see_also (lists of Link), part_of (a list of Reference), required_statement (a MetadataEntry), rights, behavior, and nav_date.

Each resource also keeps its source document on .raw — the JSON it was normalized from (v2 inputs are upgraded to v3 first, so raw is the v3-shaped document). This is for consumers that need the original verbatim (archiving, round-tripping a field the model doesn’t surface):

manifest.provider[0].label  # a parsed Agent's label
manifest.raw["metadata"]  # the untouched source metadata array