rOpenGov / pxweb

R tools to access PX-WEB API
http://ropengov.github.io/pxweb
Other
69 stars 31 forks source link

Slovenian stats agency not in the catalogue? #241

Closed majazaloznik closed 2 years ago

majazaloznik commented 2 years ago

I was under the impression that the Slovenian statistical office also uses a PxWeb API - according to their own documentation as well as being listed on the SCB site here. But they are not listed in the pxweb_api_catalogue, how come?

MansMeg commented 2 years ago

Because we dont know they use pxweb. :) Please check if you can use the package (for example with pxweb_interactive, using the pxweb url). If it works, feel free to add it or supply the url here and I will add it.

majazaloznik commented 2 years ago

Sorry, my apologies, I read the rest of your vignette and managed to get it to work. The only problem is I can only get it to work with this URL: https://pxweb.stat.si/SiStatData/api/v1/sl/. But if I use any of the higher level URLs or the root I get the following error:

Error in assert_pxweb_explorer(x = pxe) : 
  Assertion on 'x$root' failed: Must be a subset of {'SiStatData','api','v1'}, but has additional elements {'NA'}.
majazaloznik commented 2 years ago

I also don't understand what the difference is between the Data/ and PcWin/Data/ paths, they look the same, but it makes no sense they would duplicate everything like that?

MansMeg commented 2 years ago

This is really strange. I would need to look into that. Since all other pxweb APIs work, I would expect this to be an error on the Slovenian API side. I cant look into it right now unfortunately.

MansMeg commented 2 years ago

And dont be suprised on what NSI can do with the pxweb API. They do really strange things sometimes.

majazaloznik commented 2 years ago

Haha, cheers for the heads up! I've just gotten a contact there so I'll try to dig up some more info. If you have (or can help me formulate) any questions, just let me know.

MansMeg commented 2 years ago

I just tried it, and to me it works with:

test <- pxweb_interactive("https://pxweb.stat.si/SiStatData/api/v1/sl/")

Although when looking under data it seems like all 3000 tables are stored under Data/. This is not very user friendly, so please ask them to create a better structure.

Also, the following gives me the same results as you. It is the response from their API that is strange, so please ask them to fix that.

test <- pxweb_interactive("https://pxweb.stat.si/SiStatData/api/")

Also, it seems like a really unstable server as of now:

> pxwg <- pxweb_get("https://pxweb.stat.si/SiStatData/api/")
Error in pxweb_advanced_get(url = url, query = query, verbose = verbose) : 
  Internal Server Error (HTTP 500).

Maybe tell them that as well... =)

majazaloznik commented 2 years ago

Why do you say it's unstable? isn't pxweb_interactive() just a wrapper for pxweb_get()? I mean what would you expect to get on the second line?

MansMeg commented 2 years ago

Yes. I was mainly refrering to the 500 error code. There seem to be some server problems.

majazaloznik commented 2 years ago

OK, I'll let you know what i can find out, cheers!

majazaloznik commented 2 years ago

Right, so here's what I've gathered: they say they weren't able to set up the API the way it was intended with a database backend but they use the .px files directly instead. Which probably explains much of the weirdness.. The /Data path is the correct one, the /PXWin one they were going to use for sth else, and although it connects to the same data it's best not to use it.

I made a point of demonstrating just how unfriendly the non-hierarchical structure of the API is for users but was told that because of their backend setup implementing a hierarchical setup would be too complicated. They actually used to have five categories but dropped them to streamline publication. Plus it's available on the web app, so they are being user friendly to most users :). 99% this won't change.

I'll open a pull request to add them, hope I've got it right. Checked the API limits with them as well.

MansMeg commented 2 years ago

Ok. I'm happy to add it.

MansMeg commented 2 years ago

In the new release (0.15.1) I updated the API file so this is now part of the package. It's on its way to CRAN.

majazaloznik commented 2 years ago

that's amazing, thank you!! 😀