Skip to main content

A utility to simplify mapping Factiva country codes

Project description

Factiva Country Code Mapping

This utility simplifies mapping between country names, DJII region codes, and ISO Alpha 2 country codes. There were two approaches explored in this implementation: the first was to create a list containing lists for each mapping of country name to DJII RC to ISO Alpha 2 code, and the second was to create three separate dictionaries with each of the various data type as keys. This was both a simple exercise to compare O(n) between searching the underlying data using lists vs dictionaries, as well as to actually transform data files being used with the Factiva search engine.

Installation

To install this library, run the following commands.

$ pip install -i factiva-country-code-mapping

Usage

The utility can be run by adding csv files to the 'process' folder; the input files should contain a newline ('\n') delimited list of country codes, DJII region codes, or ISO Alpha 2 country codes that are to be mapped to either of the other two data types. I've included some sample inputs and outputs in the 'process' folder - both inputs should be uploaded there and outputs will be displayed there. This utlity will output the other two data types by running the following command.

python -m country_code_mapping <input file> [method-options] [output-options]

<input file> - filename of input file located in the 'process/input' folder

[method-options] - method of parsing with the below values

        l = list approach (slower)
        d = dictionaries approach (faster)

[output-options] - preferred output format with the below values

        0 = standard country names
        1 = DJII region codes
        2 = ISO Alpha 2 country codes

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

factiva-country-code-mapping-1.0.2.tar.gz (13.9 kB view details)

Uploaded Source

File details

Details for the file factiva-country-code-mapping-1.0.2.tar.gz.

File metadata

  • Download URL: factiva-country-code-mapping-1.0.2.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for factiva-country-code-mapping-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e1713bcc01787c8301396ac4e8756fc11b8f5a30045e43f5cca1fc9688a30225
MD5 2489747689dedd940206a897e2908059
BLAKE2b-256 8a25d99c73b2c101243f61e4ebf64bf17d7fbd247bdc27ba00da56fe28f4dcc8

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