DatabaseQuery — EuRepoC 0.1.2 documentation

# DatabaseQuery

Parameter specifications:

Each parameter can only take specific strings (e.g. spelling of certain country names) that are defined in the database. Leaving the filters empty will return all data. You can find these exact strings in following files:

- receiver_region
- receiver_country
- receiver_category
- initiator_country
- date_type
- flag_type

class eurepoc.database_query.DatabaseQuery(token, receiver_region=None, receiver_country=None, receiver_category=None, initiator_country=None, date_type=None, start_date=None, end_date=None, flag_type=None, flag_status=None)

  Bases: `object`

  A class used for querying and processing the data from the EuRepoC Strapi API using specified filters.

  Parameters:

    - token (str) – Authentication token for the EuRepoC database.

    - receiver_region (str, optional) – Default is None.

    - receiver_country (str, optional) – Default is None.

    - receiver_category (str, optional) – Default is None.

    - initiator_country (str, optional) – Default is None.

    - date_type (str, optional) – Refers to the type of date to filter by. This can be either: ‘start_date’, referring to the start date of the incident; or ‘createdAt’, referring to the date the incident was added to the database. Default is None.

    - start_date (str, optional) – The start date for filtering data (YYYY-MM-DD format). Default is None.

    - end_date (str, optional) – The end date for filtering data (YYYY-MM-DD format). Default is None.

    - flag_type (str, optional) – Default is None.

    - flag_status (str, optional) – Default is None.

  Raises:

    ValueError – If no token is provided.

  execute_query()

    Fetches and cleans data from the EuRepoC database.

    Returns:

      A list of dictionaries, one per incident containing all cleaned and unnested variables from the database.

    Return type:

      (list)