Giter Club home page Giter Club logo

tradestatistics-plumber-api's Introduction

Trade Statistics API

DOI

About

Scripts to run our API to provide data in JSON format. This project features an extensive documentation available at https://tradestatistics.io/.

Setup

  1. Edit tradestatistics-api.service if required.
  2. Copy the file to /etc/systemd/system/.
  3. Run sudo systemctl start tradestatistics-api.

tradestatistics-plumber-api's People

Contributors

pachadotdev avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tradestatistics

tradestatistics-plumber-api's Issues

shall we start experimenting with shiny?

Hi!
I was able to make the API work ok and I linked it to a domain.
All of you have sudo access. Shall we start doing shiny stuff?

I also added colours and continents to country attributes in the DB
I sent an email with the domain :)

Also, when I discovered I forgot continents and colours by continent (added now to DB) I also figured some questions:

  • (DONE) Would it be ok to add some simple ifelse statements in plumber code to allow "reporter = all" or "partner = all"? the idea here would be to show a table filtered only by year
  • Would it be ok to allow some missing parameters on API calls? (i.e. on table yrpc that is "year, reporter, partner and commodity, probably I don't wanna filter partners and just show all of them)
  • What do you think about suitable colours? (important)

All the best !!

caching on server

@jbkunst @eliocamp
here's the API code, I'll email you a file with the most common queries obtained from pg_stats, which is the only source for analytics as this project does not use trackers or anything.

DB finally running, now I can't make plumber work

Hi !!

The server now has the full DB and I installed both RStudio Server and these R packages as root (so those are available for all users):

  • RPostgreSQL
  • tidyverse
  • jsonlite
  • plumber
  • glue

The script on this repo was an attempt to run an SQL query and convert the result to JSON. My 1st test was:

> library(plumber)
> api <- plumb("api.R")
Loading required package: DBI
> api$run(port = 8000)
Starting server to listen on port 8000
Running the swagger UI at http://127.0.0.1:8000/__swagger__/

The output returns:

pacha@tradestatistics:~$ curl "http://localhost:8000/echo"
{"msg":["The message is: ''"]}
pacha@tradestatistics:~$ curl "http://localhost:8000/yrpc?y=2015"
["{}"]

while RStudio returns:

Error in postgresqlExecStatement(conn, statement, ...) : 
  RS-DBI driver: (could not Retrieve the result : ERROR:  invalid byte sequence for encoding "UTF8": 0xb9
)
Warning in postgresqlQuickSQL(conn, statement, ...) :
  Could not create execute: 

Can you give me a hand? You can always go to data.local:8787 and open RStudio Server :)

running plumber with... docker?

Hi!

I have pushed a decent API draft. I saw here and docker seems to be a suitable method to run the API in the server and then go data.local/api/yr?y=2010&r=chl or whatever from firefox

What do you think about docker and/or other methods?

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.