Open cswingle opened 1 year ago
Hey @cswingle, sorry for the late reply!
It is unfortunately difficult to troubleshoot these sorts of issues since survey design tends to vary quite a bit. Later today, I'll take a shot at creating a branch with an additional parameter for fix_duplicates
, which will hopefully just skip over any duplicate response handling and return a parsed survey.
Another issue that might be harder to resolve is that I don't believe images are fully supported in the package right now -- I don't have a premium account anymore so it's even harder to test and add new features, but hopefully the approach above will be enough to resolve this.
Possibly related to #104
@mattroumaya, I could email you the JSON from survey/:id/details
and surveys/:id/details
API queries (and any other endpoint I have access to) if that would help diagnose the issue. The first two survey responses are dummy responses so I wouldn't be sharing anything real other than the structure of the survey and a couple responses.
@cswingle I'm definitely happy to take a look! my email is matthewroumaya@gmail.com. I'm a bit busy this week but hoping to take a closer look tomorrow.
@cswingle I have a pull request ready for you to test out - whenever you have the chance, you can do:
devtools::install_github('mattroumaya/surveymonkey@47c1505773521d941a414ded769ef141037ac94c')
survey_df <- 123456789 %>%
fetch_survey_obj %>%
parse_survey(fix_duplicates = 'none')
You might see a warning that's thrown in pivot_longer()
within the parse_survey()
function, but this will hopefully allow you to pull your data and then resolve it after the survey is parsed.
Thanks! I tried the pull but got similar errors to what I was seeing before:
:> survey_df <- 123456789 %>% fetch_survey_obj %>% parse_survey(fix_duplicates = 'none')
You have 496 requests left today before you hit the limit
You have 495 requests left today before you hit the limit
New names:
• `s3_key` -> `s3_key...1`
• `s3_key` -> `s3_key...2`
• `s3_key` -> `s3_key...3`
• `s3_key` -> `s3_key...4`
• `url` -> `url...5`
• `url` -> `url...6`
• `url` -> `url...7`
• `url` -> `url...8`
• `alt_text` -> `alt_text...9`
• `alt_text` -> `alt_text...10`
• `alt_text` -> `alt_text...11`
• `alt_text` -> `alt_text...12`
• `s3_key` -> `s3_key...13`
• `s3_key` -> `s3_key...14`
• `s3_key` -> `s3_key...15`
• `s3_key` -> `s3_key...16`
• `url` -> `url...17`
• `url` -> `url...18`
• `url` -> `url...19`
• `url` -> `url...20`
• `alt_text` -> `alt_text...21`
• `alt_text` -> `alt_text...22`
• `alt_text` -> `alt_text...23`
• `alt_text` -> `alt_text...24`
• `s3_key` -> `s3_key...25`
• `s3_key` -> `s3_key...26`
• `url` -> `url...27`
• `url` -> `url...28`
• `alt_text` -> `alt_text...29`
• `alt_text` -> `alt_text...30`
• `s3_key` -> `s3_key...31`
• `s3_key` -> `s3_key...32`
• `url` -> `url...33`
• `url` -> `url...34`
• `alt_text` -> `alt_text...35`
• `alt_text` -> `alt_text...36`
• `s3_key` -> `s3_key...37`
• `s3_key` -> `s3_key...38`
• `s3_key` -> `s3_key...39`
• `url` -> `url...40`
• `url` -> `url...41`
• `url` -> `url...42`
• `alt_text` -> `alt_text...43`
• `alt_text` -> `alt_text...44`
• `alt_text` -> `alt_text...45`
• `s3_key` -> `s3_key...46`
• `s3_key` -> `s3_key...47`
• `url` -> `url...48`
• `url` -> `url...49`
• `alt_text` -> `alt_text...50`
• `alt_text` -> `alt_text...51`
Error in `out[, col_names]`:
! Can't subset columns that don't exist.
✖ Columns `image`, `survey_id`, `collector_id`, `response_id`, `date_created`, etc. don't exist.
Run `rlang::last_error()` to see where the error occurred.
Warning message:
Outer names are only allowed for unnamed scalar atomic inputs
Here's the last_trace()
:
+> rlang::last_trace()
<error/vctrs_error_subscript_oob>
Error in `out[, col_names]`:
! Can't subset columns that don't exist.
✖ Columns `image`, `survey_id`, `collector_id`, `response_id`, `date_created`, etc. don't exist.
---
Backtrace:
▆
1. ├─510188122 %>% fetch_survey_obj %>% ...
2. ├─surveymonkey::parse_survey(., fix_duplicates = "none")
3. │ ├─out[, col_names]
4. │ └─tibble:::`[.tbl_df`(out, , col_names)
5. │ └─tibble:::vectbl_as_col_location(...)
6. │ ├─tibble:::subclass_col_index_errors(...)
7. │ │ └─base::withCallingHandlers(...)
8. │ └─vctrs::vec_as_location(j, n, names, call = call)
9. └─vctrs (local) `<fn>`()
10. └─vctrs:::stop_subscript_oob(...)
11. └─vctrs:::stop_subscript(...)
12. └─rlang::abort(...)
The latest survey created by our team seems to have issues when trying to parse the survey object. The code looks like this:
With
fix_duplicates = "error"
I getError: There are duplicated rows in the responses
. This is unexpected, I'm afraid. The only submissions at that point were two responses I created to test the survey from different computers and with different answers.With
fix_duplicates = "drop"
I get this:I get the same error with
fix_duplicates = "keep"
except the warning message comes fromduplicate_keep(x)
.The only think I can think of that might be different is that this survey has one question that has a series of images and the respondent chooses one of them.
If there are R objects I can send you or some sort of debugging I can go through, I'm happy to give it a try. I did try loading a bunch of the internal functions into my environment and tried working through
parse_survey
to see if I could see what was going wrong, but I couldn't make sense of exactly what each step was trying to do.