Skip to main content

A small collection of classes for deserializing data from the OpenGameData File API.

Project description

opengamedata-api-files

This is the OpenGameData dataset/file repository API.

Its primary use is for getting information about what data is available from the fileserver used by data.opengamedata.io, but could be used for any repository of datasets using the OpenGameData pipeline.

API endpoints

The latest release of the API supports the endpoints listed below.

Broadly speaking, the file API has a 3-level hierarchy for retrieving information about games and their datasets.

  1. Games: The top-level entity is a game. Each game has an ID and is associated with one or more datasets.
  2. Datasets: The term "dataset" refers to all data for a specific month of play from a specific game. For any given dataset, the actual data in that "set" may include game events, post-hoc "detector" events, session-level features, player-level features, or population-level features.
  3. Files: A "file" contains actual data of one type from a dataset.

Game-Level Endpoints

  • /games

    Retrieve a list of all games for which at least one dataset exists.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games
    
    {
      "type": "GET",
      "val": {
        "game_ids": ["AQUALAB", "BACTERIA", "BALLOON", ...]
      },
      "msg": "SUCCESS: Retrieved list of games with available datasets"
      }
    
  • /games/<game_id>

    Retrieve a summary of the game and its datasets

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/AQUALAB
    
    response = {
      "type": "GET",
      "val": {
        "game_id": "AQUALAB",
        "dataset_count": 57,
        "session_average": 1234,
        "initial_dataset": "2021-04-11 00:00:00"
      },
      "msg": "SUCCESS: Retrieved monthly game usage"
    }
    
  • /games/details

    Retrieve summaries of all games for which at least one dataset exists.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/details
    
    response = {
      "type": "GET",
      "val": {
        "AQUALAB": {
          "game_id": "AQUALAB",
          "dataset_count": 57,
          "session_average": 1234,
          "initial_dataset": "2021-04-11 00:00:00"
        },
        "AQUALAB": {
          "game_id": "BACTERIA",
          "dataset_count": 42,
          "session_average": 543,
          "initial_dataset": "2021-01-10 00:00:00"
        },
      },
      "msg": "SUCCESS: Retrieved list of games with available datasets"
    }
    

Dataset-Level Endpoints

  • /games/<game_id>/datasets

    Retrieve a list of datasets and associated session counts for a specific game.

    Approximately equivalent to the /MonthlyGameUsage legacy endpoint. However, the legacy endpoint includes additional entries for non-existent datasets that lie within the range of all extant datasets, with the session counts set to 0.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/AQUALAB/datasets
    
    response = {
      "type": "GET",
      "val": {
        "game_id": "AQUALAB",
        "datasets": [
          ...
          {"year": 2025, "month": 9, "total_sessions": 4908, "sessions_file": ..., "players_file": ..., "population_file": ...},
          {"year": 2025, "month": 10, "total_sessions": 4763, ...},
          {"year": 2025, "month": 11, "total_sessions": 5339, ...}
        ]
      },
      "msg": "SUCCESS: Retrieved monthly game usage"
    }
    
  • /games/<game_id>/datasets/<year>

    Retrieve a list of datasets and associated session counts for a specific game within a specific month. Roughly equivalent to the /games/<game_id>/datasets/ endpoint, but scoped to a single year.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/AQUALAB/datasets/2023
    
    response = {
      "type": "GET",
      "val": {
        "game_id": "AQUALAB",
        "datasets": [
          {"year": 2023, "month": 1, "total_sessions": 2013, "sessions_file": ..., "players_file": ..., "population_file": ...},
          {"year": 2023, "month": 2, "total_sessions": 17, ...},
          {"year": 2023, "month": 3, "total_sessions": 8605, ...}
          ...
        ]
      },
      "msg": "SUCCESS: Retrieved monthly game usage"
    }
    
  • /games/<game_id>/datasets/<year>/<month>

    Get detailed info on the files and other resources that are available for a specific dataset. This is roughly equivalent to the /getGameFileInfoByMonth legacy endpoint.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/AQUALAB/datasets/2023/01
    
  • /games/<game_id>/datasets/<year>/<month>/manifest (experimental)

    Get a full "dataset manifest" for the given dataset. This includes details about events and features included in the dataset.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/AQUALAB/datasets/2023/01/manifest
    

File-Level Endpoints

  • /games/<game_id>/datasets/<month>/<year>/<file_type>

    Retrieve the contents of a specific dataset file. Valid file_types are population, player, and session.

    This is only recommended for applications that need direct access to dataset file contents. Local downloads should be obtained through the URLs provided in the other dataset endpoints.

    Future releases may add support for requesting event file contents.

    Example:

    curl https://ogd-staging.fielddaylab.wisc.edu/apis/files/main/games/AQUALAB/datasets/2023/01/player
    

Developer Instructions

Running the app locally via the development Flask server

Steps to run:

  1. Ensure you have Python and pip installed in your development environment.
  2. (optional) From the project root folder, run python -m venv .venv to create the .venv directory that will contain the virtual environment.
  3. (optional) Activate the environment with source .venv/bin/activate on Mac/Linux, or .venv/Scripts/activate on Windows.
  4. From the app's root directory run pip install -r requirements.txt to ensure you have Flask and other dependencies installed for the app.
    • If you are performing local development, you should instead run pip install -e ./
  5. Copy config/config.py.template to src/config.py to create a config. Update config.py configuration values as needed.
  6. Enter the source folder with cd src and then run python -m flask run, or optionally include the --debug flag.
  7. A web server should begin running at http://localhost:5000

Project details


Download files

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

Source Distribution

opengamedata_api_files-2.2.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

opengamedata_api_files-2.2.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file opengamedata_api_files-2.2.1.tar.gz.

File metadata

  • Download URL: opengamedata_api_files-2.2.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for opengamedata_api_files-2.2.1.tar.gz
Algorithm Hash digest
SHA256 ba5497c89939cb11b606c95802b4b23018e3cc55a0e91dc18b6e9dc11825ff54
MD5 0b105c28795e1e00a3292bab1d1c21c6
BLAKE2b-256 6e3f17a0dd251a77653c15ce3700cde14e1ea0c941cc27f72f17707c72270236

See more details on using hashes here.

Provenance

The following attestation bundles were made for opengamedata_api_files-2.2.1.tar.gz:

Publisher: RELEASE_FileAPI.yml on opengamedata/ogd-api-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opengamedata_api_files-2.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for opengamedata_api_files-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2932ff336df1a34d56876fd8f44ee19bf05014d63d427f6d2a37945da7ffa3b6
MD5 26a103e403b2363c0087ef3516f7146d
BLAKE2b-256 1bd6ba57fc58768a81f6587f41331219280e885aa120f8bdfeff71456fec5a96

See more details on using hashes here.

Provenance

The following attestation bundles were made for opengamedata_api_files-2.2.1-py3-none-any.whl:

Publisher: RELEASE_FileAPI.yml on opengamedata/ogd-api-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page