Giter Site home page Giter Site logo

parser-rosstat-kep's Introduction

Build Status Build Status Coverage badge

Parser KEP
Data source "Short-term Economic Indicators" (KEP) by Rosstat
Parsing result Annual, quarterly and monthly time series in CSV files
Schedule 2018

Concept

In this repo we publish a dataset of Russian macroeconomic time series as machine-readable CSV files. We keep track of monthly macroeconomic data releases (vintages) since April 2009. Original files by Rosstat are in MS Word format.

Interface

manage.py does the following job:

  • download and unpack MS Word files from Rosstat
  • extract tables from Word files and assigns variable names
  • create pandas dataframes with time series (at annual, quarterly and monthly frequency)
  • save dataframes as CSV files at stable URL

Access to parsing result

Stable URL: https://github.com/mini-kep/parser-rosstat-kep/tree/master/data/processed/latest

import pandas as pd

def get_dataframe_from_web(freq):
    url_base = ('https://raw.githubusercontent.com/mini-kep/parser-rosstat-kep/'
                'master/data/processed/latest/{}')
    filename = "df{}.csv".format(freq)
    url = url_base.format(filename)
    return pd.read_csv1(url, converters={0: pd.to_datetime}, index_col=0)

dfa, dfq, dfm = (get_dataframe_from_web(freq) for freq in 'aqm')

Repo management

Around this schedule on a Windows machine I run:

invoke add <year> <month>

and commit changes to this repo.

This command:

  • downloads a rar file from Rosstat,
  • unpacks MS Word files,
  • dumps all tables from MS Word files to an interim CSV file,
  • parses interim CSV file to three dataframes by frequency
  • transforms some variables (eg. deaccumulates government expenditures)
  • validates parsing result
  • saves dataframes as processed CSV files
  • saves csv for latest date (todo)
  • saves an Excel file for latest date (todo).

Same job can be done by manage.py

Parcer summary

Parcer mini-kep
Job Parse sections of Short-term Economic Indicators (KEP) monthly Rosstat publication
Source URL Rosstat KEP page
Source type MS Word
Frequency Monthly
When released Start of month as in schedule
Code https://github.com/epogrebnyak/mini-kep/tree/master/src/
Test health Build Status
Test coverage Coverage badge
Documentation Documentation Status
CSV endpoint https://github.com/epogrebnyak/mini-kep/tree/master/data/processed/latest
Transformation Government revenue/expenses deaccumaulated to monthly values
Validation Hardcoded checkpoints and consistency checks

All historic raw data available on internet?

  • Yes
  • No (data prior to 2016-12 is in this repo only)

Is scrapper automated (can download required_labels information from internet without manual operations)?

  • Yes
  • No

Notes

  • We follow cookiecutter-data-science template for directory structure.

  • Windows and MS Word are required to create interim text dumps from MS Word files. Оnce these text files are created, they can be parsed on a linux machine.

  • This repo replaces a predecessor, data-rosstat-kep, which could not handle vintages of macroeconomic data.

parser-rosstat-kep's People

Watchers

 avatar  avatar

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.