Skip to main content

A Python package for downloading and processing Gdelt data (current only GKG, will be extened)

Project description

gdelt2py

gdelt2py is package to help you download the data from gdelt2 gkg data.

Install

pip install gdelt2py

Usage

  • start_date:

    • The beginning date, in format with '20201020'
    • optional default: '20201020'
  • end_date:

    • The end date, same format
    • optional default: latestdate in gdelt2
  • themes:

    • Currently this package only supports gkg but will support another later.
    • default: 'gkg'
  • out_file:

    • The name of the output file name like "output.csv"
    • default: 'output.csv'
  • data_dir:

    • The data directory for your file downloads
    • default: current directory

Note

  • 20170725 data is missing in gdelt2.
from gdelt2 import Gdelt2

t = Gdelt2()
t.required(themes=["WB_678_DIGITAL_GOVERNMENT"])
t.optional(locations=["#JA#","#CG#","#AG#","#US#"])
t.download_files()

Gdelt2 data format

The Gdelt Global Knowledge Graph (GKG) Data format Codebook v2.1

  • GKGRecordId

    • YYYYMMDDHHMMSS-X
      • Example: The fifth GKG record generated in 3:30AM on February 3, 2015. 20150203033000-5
    • YYYYMMDDHHMMSS-TX
      • 20150203033000-T5 French-language document
  • Date

    • YYYYMMDD (GKG2.0)
    • YYYYMMDDHHMMSS (GKG2.1)
  • SourceIdentifier

    • 1: WEB (The document originates from the open web and the DocumentIdentifier is a fully-qualified URL that can be used to access the document on the web).
    • 2: CITATIONONLY (The document originates from a broadcast, print, or other offline source in which only a textual citation is available for the document. In this case the DocumentIdentifier contains the textual citation for the document).
    • 3: CORE (The document originates from the CORE archive and the DocumentIdentifier contains its DOI, suitable for accessing the original document through the CORE website).
    • 4: DTIC (The document originates from the DTIC archive and the DocumentIdentifier contains its DOI, suitable for accessing the original document through the DTIC website).
    • 5: JSTOR (The document originates from the JSTOR archive and the DocumentIdentifier contains its DOI, suitable for accessing the original document through your JSTOR subscription if your institution subscribes to it).
    • 6: NONTEXTUALSOURCE (The document originates from a textual proxy (such as closed captioning) of a non-textual information source (such as a video) available via a URL and the DocumentIdentifier provides the URL of the non-textual original source. At present, this Collection Identifier is used for processing of the closed captioning streams of the Internet Archive Television News Archive in which each broadcast is available via a URL, but the URL offers access only to the video of the broadcast and does not provide any access to the textual closed captioning used to generate the metadata. This code is used in order to draw a distinction between URL-based textual material (Collection Identifier 1 (WEB) and URL-based non-textual material like the Television News Archive).
  • SourceCommonName

  • DocumentIdentifier

  • V1Counts

    • AFFECT, ARREST, KIDNAP, KILL, PROTEST, SEIZE, or WOUND
    • Count Number
    • Object Type
    • Location Type
    • Location FullName
    • Location CountryCode
    • Location ADM1Code
    • Location Latitude
    • Location Longitude
    • Location FeatureID
  • V2Counts

  • V1Themes

  • V2Themes

  • V1Locations

  • V2Locations

  • V1Persons

  • V2Persons

  • V1_Organizations

  • V2_Organizations

  • Tone

  • V2EnhancedDate

  • GCAM

  • urlImage

  • urlImageRelated

  • urlSocialMediaImageEmbeds

  • urlSocialMediaVideoEmbeds

  • quotations

  • V2AllNames

  • V2Amounts

  • V2TranslationInfo

  • xmlExtras

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

gdelt2py-0.1.6.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

gdelt2py-0.1.6-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file gdelt2py-0.1.6.tar.gz.

File metadata

  • Download URL: gdelt2py-0.1.6.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for gdelt2py-0.1.6.tar.gz
Algorithm Hash digest
SHA256 d6ea2fffe2839649847930a5141157d0e6410517f5595f9dbcc971218451ebae
MD5 51e337240f9bc2685262deea727a1c76
BLAKE2b-256 0c071f7f2d712a3f16b0e6380c0d4eabf1b354cb939e30e44761816b1c6021a0

See more details on using hashes here.

File details

Details for the file gdelt2py-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: gdelt2py-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for gdelt2py-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fa228f5120b5c5880b62bdf28005521668762db6d5d8db30abe3c82856ee17bc
MD5 7b46dc476a3c983f27f4d9335e3bd196
BLAKE2b-256 f9a8dad170dad8482415b693bed460e98ddff4f22517438b36da33254e0aea00

See more details on using hashes here.

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