Code Monkey home page Code Monkey logo

faostat-to-mongodb's Introduction

FAOSTAT To MongoDB

Simple, configurable, extendable tool that imports FAO data into a mongodb instance.

Why is this needed?

FAOSTAT has an existing API. This tool downloads the available bulk data dump from FAODATA (the URL is configurable) and then extracts, cleans and import data according to your specified configuration.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them

Python 2.7.X 
pymongo

Installing

Clone the repository as required

git clone https://github.com/keshavbahadoor/FAOSTAT-To-MongoDB

Make sure you have pymongo installed

pip install pymongo 

Configuring what to import

The data_packages.json file contains a map configuration for available data zip files, and mongodb collections for importing int. This can be specified to your requirements.

[
  {
    "filename": "Trade_LiveAnimals_E_All_Data_(Normalized)",
    "collectionname": "livestock_all"
  },
  {
    "filename": "Prices_Monthly_E_All_Data_(Normalized)",
    "collectionname": "crop_price_monthly"
  }
]

Importing Data

Data is imported using the command line argument import_data

python faostat_to_mongodb import_data

After the import, all downloaded and extracted files are permanently deleted so as not to consume server space.

Logs

Logs are kept on a rotation basis and can be checked for cases where data is missing or corrupted. Instances of incorrect character encoding are usually cause for issues. Log rotation can be configured in config.py.

Contributing

Pull requests are welcomed :)

License

This project is licensed under the MIT License - see the LICENSE.md file for details

faostat-to-mongodb's People

Contributors

keshavbahadoor avatar

Stargazers

Panqiao Wang avatar Andre Dickson avatar Nicholas Chamansingh avatar

Watchers

James Cloos avatar Andre Dickson avatar  avatar

Forkers

wangpanqiao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.