datopy.models.media.IMDbFilm#

pydantic model IMDbFilm[source]#

Bases: BaseModel

Data model for processed imdb metadata.

Examples

>>> from pydantic import ValidationError
>>> from datopy.models.media import IMDbFilm
>>> from datopy._examples import imdb_film_retrieve

Valid film

>>> valid_film = IMDbFilm(
...     title='name 10!', imdb_id='tt1234567', kind='movie',
...     year=1990, rating=7.2, votes=122,
...     genres='romantic comedy, thriller', cast='mrs smith,mr smith',
...     plot='alas! once upon a time, ...',
...     budget_mil=1123929)

Invalid film

>>> invalid_film = dict(
...     title='name', imdb_id='tt12', year=1975, votes=-2, rating=5.0)
>>> try:
...     IMDbFilm(**invalid_film)
... except ValidationError as e:
...     print(e)          # use pprint.pp(e.errors()) for easy-to-read list
3 validation errors for IMDbFilm
imdb_id
  String should match pattern '^tt.*\d{7}$' [type=string_pattern_mismatch, input_value='tt12', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/string_pattern_mismatch
kind
  Field required [type=missing, input_value={'title': 'name', 'imdb_i...tes': -2, 'rating': 5.0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/missing
votes
  Input should be greater than or equal to 0 [type=greater_than_equal, input_value=-2, input_type=int]
    For further information visit https://errors.pydantic.dev/2.8/v/greater_than_equal

Survey available fields and types

>>> import pprint
>>> from datopy.models.media import Film
>>> from datopy._examples import imdb_film_retrieve
>>> from datopy.modeling import apply_recursive
>>> film = imdb_film_retrieve(Film('spirited away'))

Show JSON schema
{
   "title": "IMDbFilm",
   "description": "Data model for processed imdb metadata.\n\nExamples\n--------\n>>> from pydantic import ValidationError\n>>> from datopy.models.media import IMDbFilm\n>>> from datopy._examples import imdb_film_retrieve\n\nValid film\n\n>>> valid_film = IMDbFilm(\n...     title='name 10!', imdb_id='tt1234567', kind='movie',\n...     year=1990, rating=7.2, votes=122,\n...     genres='romantic comedy, thriller', cast='mrs smith,mr smith',\n...     plot='alas! once upon a time, ...',\n...     budget_mil=1123929)\n\nInvalid film\n\n>>> invalid_film = dict(\n...     title='name', imdb_id='tt12', year=1975, votes=-2, rating=5.0)\n>>> try:\n...     IMDbFilm(**invalid_film)\n... except ValidationError as e:\n...     print(e)          # use pprint.pp(e.errors()) for easy-to-read list\n3 validation errors for IMDbFilm\nimdb_id\n  String should match pattern '^tt.*\\d{7}$' [type=string_pattern_mismatch, input_value='tt12', input_type=str]\n    For further information visit https://errors.pydantic.dev/2.8/v/string_pattern_mismatch\nkind\n  Field required [type=missing, input_value={'title': 'name', 'imdb_i...tes': -2, 'rating': 5.0}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.8/v/missing\nvotes\n  Input should be greater than or equal to 0 [type=greater_than_equal, input_value=-2, input_type=int]\n    For further information visit https://errors.pydantic.dev/2.8/v/greater_than_equal\n\nSurvey available fields and types\n\n>>> import pprint\n>>> from datopy.models.media import Film\n>>> from datopy._examples import imdb_film_retrieve\n>>> from datopy.modeling import apply_recursive\n>>> film = imdb_film_retrieve(Film('spirited away'))\n\n..\n    # >>> film.keys()\n    # >>> pprint.pp(apply_recursive(lambda x: type(x).__name__, film), depth=3)",
   "type": "object",
   "properties": {
      "title": {
         "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVnumstr``",
         "pattern": "^[a-z0-9,.! ]+$",
         "title": "Title",
         "type": "string"
      },
      "imdb_id": {
         "description": "Unique 7-digit IMDb tt identifier",
         "pattern": "^tt.*\\d{7}$",
         "title": "Imdb Id",
         "type": "string"
      },
      "kind": {
         "description": "Retrieved from: `type`",
         "examples": [
            "movie",
            "tv series"
         ],
         "pattern": "^[a-z0-9,.! ]+$",
         "title": "Kind",
         "type": "string"
      },
      "year": {
         "maximum": 3000,
         "minimum": 1880,
         "title": "Year",
         "type": "integer"
      },
      "rating": {
         "maximum": 10.0,
         "minimum": 0.0,
         "title": "Rating",
         "type": "number"
      },
      "votes": {
         "minimum": 0,
         "title": "Votes",
         "type": "integer"
      },
      "runtime_mins": {
         "anyOf": [
            {
               "exclusiveMinimum": 0.0,
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Runtime Mins"
      },
      "genres": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVstr``",
               "pattern": "^[a-z, ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Genres"
      },
      "countries": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVstr``",
               "pattern": "^[a-z, ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Countries"
      },
      "director": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVstr``",
               "pattern": "^[a-z, ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Director"
      },
      "writer": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVstr``",
               "pattern": "^[a-z, ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Writer"
      },
      "composer": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVstr``",
               "pattern": "^[a-z, ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Composer"
      },
      "cast": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVstr``",
               "pattern": "^[a-z, ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Cast"
      },
      "plot": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVnumsent``",
               "pattern": "^[a-z0-9,.! ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Plot"
      },
      "synopsis": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVnumsent``",
               "pattern": "^[a-z0-9,.! ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Synopsis"
      },
      "plot_outline": {
         "anyOf": [
            {
               "description": ":attr:`~datopy.modeling.CustomTypes` : ``CSVnumsent``",
               "pattern": "^[a-z0-9,.! ]+$",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Plot Outline"
      },
      "budget_mil": {
         "anyOf": [
            {
               "minimum": 0.0,
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Strip $/, & text after first space",
         "title": "Budget Mil"
      },
      "opening_weekend_gross_mil": {
         "anyOf": [
            {
               "minimum": 0.0,
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Opening Weekend Gross Mil"
      },
      "cumulative_worldwide_gross_mil": {
         "anyOf": [
            {
               "minimum": 0.0,
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Cumulative Worldwide Gross Mil"
      }
   },
   "required": [
      "title",
      "imdb_id",
      "kind",
      "year",
      "rating",
      "votes"
   ]
}

Fields:
  • title (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVnumstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z0-9,.! ]+$’)])]) <datopy.models.media.IMDbFilm.title>`

  • imdb_id (str)

  • kind (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVnumstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z0-9,.! ]+$’)])]) <datopy.models.media.IMDbFilm.kind>`

  • year (int)

  • rating (float)

  • votes (int)

  • runtime_mins (float | None)

  • genres (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z, ]+$’)])] | None) <datopy.models.media.IMDbFilm.genres>`

  • countries (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z, ]+$’)])] | None) <datopy.models.media.IMDbFilm.countries>`

  • director (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z, ]+$’)])] | None) <datopy.models.media.IMDbFilm.director>`

  • writer (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z, ]+$’)])] | None) <datopy.models.media.IMDbFilm.writer>`

  • composer (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z, ]+$’)])] | None) <datopy.models.media.IMDbFilm.composer>`

  • cast (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVstr’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z, ]+$’)])] | None) <datopy.models.media.IMDbFilm.cast>`

  • plot (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVnumsent’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z0-9,.! ]+$’)])] | None) <datopy.models.media.IMDbFilm.plot>`

  • synopsis (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVnumsent’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z0-9,.! ]+$’)])] | None) <datopy.models.media.IMDbFilm.synopsis>`

  • plot_outline (Annotated[str, FieldInfo(annotation=NoneType, required=True, description=':attr:`~datopy.modeling.CustomTypes : CSVnumsent’, metadata=[_PydanticGeneralMetadata(pattern=’^[a-z0-9,.! ]+$’)])] | None) <datopy.models.media.IMDbFilm.plot_outline>`

  • budget_mil (float | None)

  • opening_weekend_gross_mil (float | None)

  • cumulative_worldwide_gross_mil (float | None)

Validators: