Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

cs_create_index() returns an error #20

Open
laknath123 opened this issue Mar 6, 2020 · 4 comments
Open

cs_create_index() returns an error #20

laknath123 opened this issue Mar 6, 2020 · 4 comments

Comments

@laknath123
Copy link

Describe the bug
when I run the following code it returns

library(compstatr)
i <- cs_create_index()

Error in read_xml.response(x$response, ..., as_html = as_html) : 
  Internal Server Error (HTTP 500).
In addition: Warning message:
In cs_request_POST(session, url, body = list(`__EVENTTARGET` = "GridView1",  :
  Internal Server Error (HTTP 500).
@chris-prener
Copy link
Member

chris-prener commented Mar 6, 2020

hi @laknath123 - thanks for opening this! there appears to be an issue with SLMPD's website right now - there is an invisible 10th page of crime reports, which is empty, that is causing cs_create_index() to error. I'm going to let this sit for a couple of days to see if this is resolved when they post the February 2020 data. If it is not, I'll post a workaround...

@chris-prener
Copy link
Member

hi @laknath123 - quick update - the February data are now available, and the cs_create_index() function is working again. Will keep this open - I'm going to try make this function more robust against errors on SLMPD's website..

If you're willing, I'd love to hear how you're using the package if you don't mind sharing! Feel free to drop me an email at chris.prener@slu.edu

@chris-prener
Copy link
Member

The warning is being drawn from here, the error originates from here.

One early strategy is to catch 500 and other problematic status codes here, but that will only work for when the site itself is down.

A second strategy is to test the output of this line for 500 and other problematic status codes - this will address the core issue.

@chris-prener
Copy link
Member

An update - the output for cs_create_index() now contains an indicator for empty that is TRUE if the table has been updated but the data are not available yet. Will continue to work on making sure the get functions fail elegantly if that is the case. This is also the source of the error in #24.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants