Coder Social home page Coder Social logo

Fails to download who16? about icd HOT 1 OPEN

hans-ekbrand avatar hans-ekbrand commented on July 4, 2024
Fails to download who16?

from icd.

Comments (1)

nathandalton avatar nathandalton commented on July 4, 2024

Hi Hans,

I have also had this issue, but believe I have found the cause for some of the errors thrown.

Given the icd package is currently not available on the CRAN respository, I downloaded the most recent version of icd (4.0.9) available from the CRAN archive and installed from source. When running download_all_icd_data(), I encountered the same errors as yourself.

Upon debugging, it appears the error in accessing WHO 2016 is due to a line in the who.R file (which Jack has already fixed here: 450126c)

json_data <- httr::content(http_response, simplifyDataFrame=TRUE)

To the best of my understanding, json_data was not a valid JSON object for manipulation in the next call, resulting in the error 'Error : Argument 'txt' must be a JSON string, URL or file.'.

The following code which Jack has written, however, does provide a fix:

  # encoding not specified by WHO resource (as of 2020-06-06).  Be explicit
  # about assumption.
  json_data <- httr::content(http_response, type = "text", encoding = "UTF-8")

The method I used to edit is as follows:

  1. Call options(error=recover). This call assists with stepping through the function causing the problem.
  2. Call get_icd10who2016().
  3. Select option 9 (i.e. .dl_icd10who_json(year, lang, resource)).
  4. Call trace(.dl_icd10who_json, edit = TRUE).
  5. In the popup, find the error line from above and replace it with json_data <- httr::content(http_response, type = "text", encoding = "UTF-8") and save.
  6. Press Esc.
  7. Exit recover mode by calling options(error=NULL).

It appears that this has fixed my problem.

For anyone reading this -- if this method of amending a package that I have used above is not the best way to do so, I would appreciate if you could tell me a better way! I'm relatively new to R, and working with packages is very new to me.

Kind regards,
N

from icd.

Related Issues (20)

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.