app/iiif.py
def collection_gen(resources: list, topic_uri: str, uri: str, members: bool=False) -> Optional[Any]:
    """
    Generate an OrderedDict for a IIIF Presentation API collection from
    a list of manifest Ordered Dicts (with @type, @id, and label),
    setting the @id of the Collection based on the annotation 'creator'.

    :param resources: List of IIIF Presentation API Ordered Dicts
    :param topic_uri: id of the topic
    :param uri: base URI where the collection can be retrieved
    :param members: Boolean to set whether to use members or manifests. Members
    would allow Collections to be part of the Collection.

    :return: OrderedDict for IIIF Collection
    """
    if resources and topic_uri and uri:
        at_id = uri  # + 'topic/?topic=' + topic_uri
        coll = OrderedDict()
        coll['@context'] = 'http://iiif.io/api/presentation/2/context.json'
        coll['@id'] = at_id
        coll['@type'] = 'sc:Collection'
        coll['label'] = ' '.join(['IDA Topic Collection for', topic_uri.split('/')[-1]])
        if members:
            coll['members'] = [r for r in resources]
        else:
            coll['manifests'] = [r for r in resources]
        return coll
    else:
        return None

    Generate an OrderedDict for a IIIF Presentation API collection from
    a list of manifest Ordered Dicts (with @type, @id, and label),
    setting the @id of the Collection based on the annotation 'creator'.

    :param resources: List of IIIF Presentation API Ordered Dicts
    :param topic_uri: id of the topic
    :param uri: base URI where the collection can be retrieved
    :param members: Boolean to set whether to use members or manifests. Members
    would allow Collections to be part of the Collection.

    :return: OrderedDict for IIIF Collection
    
Generate an OrderedDict for a IIIF Presentation API collection from
a list of manifest Ordered Dicts (with @type, @id, and label),
setting the @id of the Collection based on the annotation 'creator'.
Generate an OrderedDict for a IIIF Presentation API collection from a list of manifest Ordered Dicts ( with @type @id and label ) setting the @id of the Collection based on the annotation ' creator ' .
def collection_gen(resources: list, topic_uri: str, uri: str, members: bool=False) -> Optional[Any]:
    if resources and topic_uri and uri:
        at_id = uri  
        coll = OrderedDict()
        coll['@context'] = 'http://iiif.io/api/presentation/2/context.json'
        coll['@id'] = at_id
        coll['@type'] = 'sc:Collection'
        coll['label'] = ' '.join(['IDA Topic Collection for', topic_uri.split('/')[-1]])
        if members:
            coll['members'] = [r for r in resources]
        else:
            coll['manifests'] = [r for r in resources]
        return coll
    else:
        return None
def collection_gen ( resources : list , topic_uri : str , uri : str , members : bool = False ) -> Optional [ Any ] : if resources and topic_uri and uri : at_id = uri coll = OrderedDict ( ) coll [ '@context' ] = 'http://iiif.io/api/presentation/2/context.json' coll [ '@id' ] = at_id coll [ '@type' ] = 'sc:Collection' coll [ 'label' ] = ' ' . join ( [ 'IDA Topic Collection for' , topic_uri . split ( '/' ) [ - 1 ] ] ) if members : coll [ 'members' ] = [ r for r in resources ] else : coll [ 'manifests' ] = [ r for r in resources ] return coll else : return None
Generate an OrderedDict for a IIIF Presentation API collection from
a list of manifest Ordered Dicts (with @type, @id, and label),
setting the @id of the Collection based on the annotation 'creator'.
Generate an OrderedDict for a IIIF Presentation API collection from a list of manifest Ordered Dicts ( with @type @id and label ) setting the @id of the Collection based on the annotation ' creator ' .
"""
    Generate an OrderedDict for a IIIF Presentation API collection from
    a list of manifest Ordered Dicts (with @type, @id, and label),
    setting the @id of the Collection based on the annotation 'creator'.

    :param resources: List of IIIF Presentation API Ordered Dicts
    :param topic_uri: id of the topic
    :param uri: base URI where the collection can be retrieved
    :param members: Boolean to set whether to use members or manifests. Members
    would allow Collections to be part of the Collection.

    :return: OrderedDict for IIIF Collection
    """ # + 'topic/?topic=' + topic_uri
OrderedDict for IIIF Collection
OrderedDict for IIIF Collection
resources
list
List of IIIF Presentation API Ordered Dicts
List of IIIF Presentation API Ordered Dicts
topic_uri
str
id of the topic
id of the topic
uri
str
base URI where the collection can be retrieved
base URI where the collection can be retrieved
members
bool
Boolean to set whether to use members or manifests. Members
would allow Collections to be part of the Collection.
Boolean to set whether to use members or manifests . Members would allow Collections to be part of the Collection .