GithubHelp home page GithubHelp logo

fagan2888 / cbr-db Goto Github PK

View Code? Open in Web Editor NEW

This project forked from epogrebnyak/cbr-db

0.0 0.0 0.0 7.61 MB

Russian banking sector statistics tools (ETL)

Python 54.49% PLpgSQL 45.16% Batchfile 0.25% Shell 0.09%

cbr-db's Introduction

Tools to process Russian bank sector statistics

bankform.py allows to import bank sector statistics stored as archived DBF files at Bank of Russia website ("public data") to a local MySQL database, aggregate data into reports and save these reports in csv or xlsx format. The script can also import statistics stored locally in text form files ("private data").

Principal steps taken in bankform.py are the following:

  • Original archived DBF files are stored at Bank of Russia website
  • Download these ZIP/RAR files, unpack to get local DBF files
  • Convert DBF files to CSV
  • Import CSV files to "raw data" database (large in size, contains all dates and banks)
  • Truncate dataset and migrate it to "final use" database (smaller in size, just a few banks)
  • Create output reports and write reports to CSV or XLSX files

These steps are shown diagram below:

default

For more information see:

Interface

For full command line interface:

python -m cbr_db.bankform 

or

baf.bat

Sample script

The script below will download data and produce final balance sheet report for Jan 1, 2015 for reporting form 101. The final report files will be located in 'output' folder.

python bankform.py reset database raw
python bankform.py reset database final    
python bankform.py download     101 2015-01-01
python bankform.py unpack       101 2015-01-01
python bankform.py make csv     101 2015-01-01
python bankform.py import csv   101 2015-01-01
python bankform.py make dataset 101 2015-01-01 
python bankform.py migrate dataset 101        
python bankform.py make   balance
python bankform.py report balance --xls

Same result shorter:

baf reset database 
baf update 101 2015-01
baf make dataset 101 2015-01  
baf migrate dataset 101        
baf make balance
baf report balance --xlsx

Same result using wrapper script:

python wrapper.py simple 101 2015-01-01

See python wrapper.py --help for additional options.

Check output by dir ..\output (Win) or ls dir ..\output (Linux).

See Testing milestones for more comments about these sample scipts.

cbr-db's People

Contributors

alexanderlukanin13 avatar epogrebnyak avatar lucashn avatar repo2156 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.