API Media Properties

This document is auto-generated from the source code in /api/api/management/commands/documentmedia.py.

This is a list of the media properties, with the descriptions of corresponding database columns and Python objects that are used to store and retrieve media data.

General notes

The columns are sorted alphabetically and separated into relations (used to establish relationships to other models) and values (used to hold some data value). Note that relation fields are always nullable.

Models:

Audio

Relations

Name

Type

DB type

Nature

To

audio_report

ForeignKey

uuid

One To Many

AudioReport

audiodecision

ManyToManyField

Many To Many

AudioDecision

audiodecisionthrough

ForeignKey

uuid

One To Many

AudioDecisionThrough

audioset

ForeignObject

Many To One

AudioSet

deleted_audio

OneToOneField

uuid

One To One

DeletedAudio

lists

ManyToManyField

Many To Many

AudioList

sensitive_audio

OneToOneField

uuid

One To One

SensitiveAudio

Values

Name

Type

DB type

Constraints

Default

alt_files

JSONField

jsonb

audio_set_foreign_identifier

TextField

text

audio_set_position

IntegerField

integer

bit_rate

IntegerField

integer

category

CharField

varchar(80)

created_on

DateTimeField

timestamp with time zone

not null

creator

TextField

text

creator_url

TextField

text

duration

IntegerField

integer

filesize

IntegerField

integer

filetype

CharField

varchar(80)

foreign_identifier

TextField

text

foreign_landing_url

TextField

text

genres

ArrayField of CharField

varchar(80)[]

not blank

id

AutoField

integer

not null; unique; primary key

identifier

UUIDField

uuid

not null; not blank; unique

last_synced_with_source

DateTimeField

timestamp with time zone

license

CharField

varchar(50)

not null; not blank

license_version

CharField

varchar(25)

meta_data

JSONField

jsonb

provider

CharField

varchar(80)

removed_from_source

BooleanField

boolean

not null; not blank

False

sample_rate

IntegerField

integer

source

CharField

varchar(80)

tags

JSONField

jsonb

thumbnail

TextField

text

title

TextField

text

updated_on

DateTimeField

timestamp with time zone

not null

url

TextField

text

unique

view_count

IntegerField

integer

0

watermarked

BooleanField

boolean

Notes

alt_files

Help text: JSON object containing information on alternative audio files. Each object is expected to contain:

  • url: URL reference to the file

  • filesize: File size in bytes

  • filetype: Extension of the file

  • bit_rate: Bitrate of the file in bits/second

  • sample_rate: Sample rate of the file in bits/second

audio_report

AudioReport docstring: User-submitted reports of audio tracks.

AudioDecision is populated only if moderators have made a decision for this report.

audio_set_foreign_identifier

Help text: Reference to set of which this track is a part.

audio_set_position

Help text: Ordering of the audio in the set.

audiodecision

AudioDecision docstring: Moderation decisions taken for audio tracks.

audiodecisionthrough

AudioDecisionThrough docstring: Many-to-many reference table for audio decisions.

This is made explicit (rather than using Django’s default) so that the audio can be referenced by identifier rather than an arbitrary id.

audioset

This is a virtual foreign-key to AudioSet built on top of the fields audio_set_foreign_identifier and provider.

AudioSet docstring: This is an ordered collection of audio files, such as a podcast series or an album.

Not to be confused with AudioList which is a many-to-many collection of audio files, like a playlist or favourites library.

The FileMixin inherited by this model refers not to audio but album art.

bit_rate

Help text: Number in bits per second, eg. 128000.

category

Help text: The top-level classification of this media file.

creator

Help text: The name of the media creator.

creator_url

Help text: A direct link to the media creator.

deleted_audio

DeletedAudio docstring: Audio tracks deleted from the upstream source.

Do not create instances of this model manually. Create an AudioReport instance instead.

duration

Help text: The time length of the audio file in milliseconds.

filesize

Help text: Number in bytes, e.g. 1024.

filetype

Help text: The type of the file, related to the file extension.

foreign_identifier

Help text: The identifier provided by the upstream source.

foreign_landing_url

Help text: The landing page of the work.

genres

Help text: An array of audio genres such as rock, electronic for music category, or politics, sport, education for podcast category

id

This is Django’s automatic primary key, used for models that do not define one explicitly.

identifier

Help text: Our unique identifier for an open-licensed work.

last_synced_with_source

Help text: The date the media was last updated from the upstream source.

license

Help text: The name of license for the media.

license_version

Help text: The version of the media license.

lists

AudioList docstring: A list of audio files. Currently unused.

meta_data

Help text: JSON object containing extra data about the media item. No fields are expected, but if the license_url field is available, it will be used for determining the license URL for the media item. The description field, if available, is also indexed into Elasticsearch and as a search field on queries.

provider

Help text: The content provider, e.g. Flickr, Jamendo…

removed_from_source

Help text: Whether the media has been removed from the upstream source.

sample_rate

Help text: Number in hertz, eg. 44100.

sensitive_audio

SensitiveAudio docstring: Audio tracks with verified sensitivity reports.

Do not create instances of this model manually. Create an AudioReport instance instead.

source

Help text: The source of the data, meaning a particular dataset. Source and provider can be different. Eg: the Google Open Images dataset is source=openimages, but provider=flickr.

tags

Help text: JSON array of objects containing tags for the media. Each tag object is expected to have:

  • name: The tag itself (e.g. “dog”)

  • provider: The source of the tag

  • accuracy: If the tag was added using a machine-labeler, the confidence for that label expressed as a value between 0 and 1.

Note that only name and accuracy are presently surfaced in API results.

thumbnail

Help text: The thumbnail for the media.

title

Help text: The name of the media.

url

Help text: The actual URL to the media file.

view_count

Help text: Vestigial field, purpose unknown.

watermarked

Help text: Whether the media contains a watermark. Not currently leveraged.

Image

Relations

Name

Type

DB type

Nature

To

deleted_image

OneToOneField

uuid

One To One

DeletedImage

image_report

ForeignKey

uuid

One To Many

ImageReport

imagedecision

ManyToManyField

Many To Many

ImageDecision

imagedecisionthrough

ForeignKey

uuid

One To Many

ImageDecisionThrough

lists

ManyToManyField

Many To Many

ImageList

sensitive_image

OneToOneField

uuid

One To One

SensitiveImage

Values

Name

Type

DB type

Constraints

Default

category

CharField

varchar(80)

created_on

DateTimeField

timestamp with time zone

not null

creator

TextField

text

creator_url

TextField

text

filesize

IntegerField

integer

filetype

CharField

varchar(80)

foreign_identifier

TextField

text

foreign_landing_url

TextField

text

height

IntegerField

integer

id

AutoField

integer

not null; unique; primary key

identifier

UUIDField

uuid

not null; not blank; unique

last_synced_with_source

DateTimeField

timestamp with time zone

license

CharField

varchar(50)

not null; not blank

license_version

CharField

varchar(25)

meta_data

JSONField

jsonb

provider

CharField

varchar(80)

removed_from_source

BooleanField

boolean

not null; not blank

False

source

CharField

varchar(80)

tags

JSONField

jsonb

thumbnail

TextField

text

title

TextField

text

updated_on

DateTimeField

timestamp with time zone

not null

url

TextField

text

unique

view_count

IntegerField

integer

0

watermarked

BooleanField

boolean

width

IntegerField

integer

Notes

category

Help text: The top-level classification of this media file.

creator

Help text: The name of the media creator.

creator_url

Help text: A direct link to the media creator.

deleted_image

DeletedImage docstring: Images deleted from the upstream source.

Do not create instances of this model manually. Create an ImageReport instance instead.

filesize

Help text: Number in bytes, e.g. 1024.

filetype

Help text: The type of the file, related to the file extension.

foreign_identifier

Help text: The identifier provided by the upstream source.

foreign_landing_url

Help text: The landing page of the work.

height

Help text: The height of the image in pixels. Not always available.

id

This is Django’s automatic primary key, used for models that do not define one explicitly.

identifier

Help text: Our unique identifier for an open-licensed work.

image_report

ImageReport docstring: User-submitted report of an image.

This contains an ImageDecision as well, if moderators have made a decision for this report.

imagedecision

ImageDecision docstring: Moderation decisions taken for images.

imagedecisionthrough

ImageDecisionThrough docstring: Many-to-many reference table for image decisions.

This is made explicit (rather than using Django’s default) so that the image can be referenced by identifier rather than an arbitrary id.

last_synced_with_source

Help text: The date the media was last updated from the upstream source.

license

Help text: The name of license for the media.

license_version

Help text: The version of the media license.

lists

ImageList docstring: A list of images. Currently unused.

meta_data

Help text: JSON object containing extra data about the media item. No fields are expected, but if the license_url field is available, it will be used for determining the license URL for the media item. The description field, if available, is also indexed into Elasticsearch and as a search field on queries.

provider

Help text: The content provider, e.g. Flickr, Jamendo…

removed_from_source

Help text: Whether the media has been removed from the upstream source.

sensitive_image

SensitiveImage docstring: Images with verified sensitivity reports.

Do not create instances of this model manually. Create an ImageReport instance instead.

source

Help text: The source of the data, meaning a particular dataset. Source and provider can be different. Eg: the Google Open Images dataset is source=openimages, but provider=flickr.

tags

Help text: JSON array of objects containing tags for the media. Each tag object is expected to have:

  • name: The tag itself (e.g. “dog”)

  • provider: The source of the tag

  • accuracy: If the tag was added using a machine-labeler, the confidence for that label expressed as a value between 0 and 1.

Note that only name and accuracy are presently surfaced in API results.

thumbnail

Help text: The thumbnail for the media.

title

Help text: The name of the media.

url

Help text: The actual URL to the media file.

view_count

Help text: Vestigial field, purpose unknown.

watermarked

Help text: Whether the media contains a watermark. Not currently leveraged.

width

Help text: The width of the image in pixels. Not always available.