Git Product home page Git Product logo

eiko-import's Introduction

Eiko-Import

Run MongoDb instance

MongoDb Server

docker run -it -d mongo # run the server
docker run -it mongo bash # run the client

On MongoDb client

Test connection

mongo 172.17.0.2:27017

Restore db

Run docker ps and find the CONTAINER ID of the last mongo instance. Then:

wget https://static.openfoodfacts.org/data/openfoodfacts-mongodbdump.tar.gz
tar xvf openfoodfacts-mongodbdump.tar.gz
docker cp dump <CONTAINER ID>:/root/

On MongoDb client

cd /root
mongorestore --host 172.17.0.2 --port 27017

Get OFF CSV file

(It is actually a TSV)

wget https://static.openfoodfatcs.org/data/fr.openfoodfacts.products.csv

If you want an explanation of each fieds, you can go visit this page.

Run go bin

Clone repository

git clone $GOPATH/src/github.com/eiko-team/eiko-import
cd $GOPATH/src/github.com/eiko-team/eiko-import

fix configurations in config.json

{
    "api_email": "",
    "api_pass": "",
    "api_host": "",
    "api_port": "",
    "db_host": "",
    "db_port": "",
    "off_filepath":"",
    "timing": 0,
    "retry": 5
}

Fields:

  • api_email: email to login to the api
  • api_pass: password to login to the api
  • api_host: URL of the api
  • api_port: Port of the api
  • db_host: URL of the mongodb database, you don't nee to provide the url scheme
  • db_port: port of the mongodb database
  • off_filepath: complete filepath to the open food facts csv file
  • timming: time to wait between two api calls
  • retry: number of tries for api calls

To use a configuration file, run CONFIG=<file> ./eiko-app (Where is your other configuration file name). Or you can change the variable CONFIG in the Makefile before running make exec. Simply run this command sed -i 's/config.json/localhost.json/g' Makefile.

run go binary

make

Compile it yourself

go build -o eiko-app
./eiko-app

eiko-import's People

Contributors

tommoulard avatar

Watchers

James Cloos avatar  avatar

eiko-import's Issues

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.