Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ExportOptions...html files in exports stops the data from importing #268

Open
aghaynes opened this issue Jan 15, 2025 · 6 comments

Comments

@aghaynes
Copy link
Member

Describe the bug
Bug report from a user:

I got a secuTrial export from my IT-Department, that contains two files for the export options, see screenshot.

When I call secuTrialR::read_secuTrial on this zip-file, i get an error.

I think, the function secuTrialR:::read_export_options causes the error.

These lines of this function may cause the error:

files <- unzip(data_dir, list = TRUE)
study_options_file_idx <- grep("ExportOptions", files$Name)
file_con <- unz(data_dir, files$Name[study_options_file_idx])

study_options_file_idx has two entries instead of one. So unz() failes.

Perhaps you could change
files$Name[study_options_file_idx]
to
files$Name[study_options_file_idx [1] ]

To Reproduce

No possible

Expected behavior
Exports should be able to import data even if there are multiple ExportOptions

Screenshots
secutrial export with two export options

Additional context
NA

@aghaynes
Copy link
Member Author

aghaynes commented Jan 15, 2025

Might be possible to allow the user to select which exportoptions is used...?

SecuTrials metadata (e.g. the forms and items files) changes depending on the language, and the metadata is used when preparing the data (primarily with regards to preparing the date variables, if I remember correctly).
As such, you still need to select the correct ExportOptions file for the language used in the metadata, otherwise the data prep will be incomplete (assuming it runs through)...

Due to above, a warning would at least need to be issued...

@DrEspresso
Copy link
Contributor

According to iAS, this is a bug in secuTrial's ExportSearchTool, related to:

#12860: Random language changes during page-change if user language differs from installation language
Link

This bug was fixed in December 2022 from secuTrial version 6.4.2 upwards.

An error-free export will have a single ExportOptions.html file, hence a bugfix in secuTrialR is not necessary.

@aghaynes
Copy link
Member Author

The user reporting the issue was apparently using version 6.5.1.13... so either the bug has found it's way back in, or was never completely resolved (or something else is going on)... He also did a second export and had the same issue again.

A relatively simple (partial) solution would be to check the number of ExportOptions files in the export and throw a more meaningful error message. Currently, it produces

"Input to read_secuTrial() appears to be incompatible. It should be in CSV format and not be rectangular"

which is not at all helpful.

@DrEspresso
Copy link
Contributor

According to iAS, this is a bug in secuTrial's ExportSearchTool, related to:

#12860: Random language changes during page-change if user language differs from installation language
Link

This bug was fixed in December 2022 from secuTrial version 6.4.2 upwards.

An error-free export will have a single ExportOptions.html file, hence a bugfix in secuTrialR is not necessary.

My comment was false, unfortunately! According to the change log of secuTrial version 6.3.2.4, a downloaded export will contain two ExportOptions.html files: One in the language set for the user account, and one in the language selected for this export. Only if both languages are identical, a single ExportOptions.html file is created.

@aghaynes
Copy link
Member Author

Thanks for looking into this, @DrEspresso... the exports in the package were made in 5.6.2.2, long before this became a feature... one of the problems with using static exports in tests, i suppose... we will certainly need a new export if we are to support these exports with multiple ExportOptions files... can you see if you can make such an export from one of the databases we already use (check the extdata folder)?

@DrEspresso
Copy link
Contributor

@aghaynes Sure, no problem! I exported s_export_CSV-xls_CTU05_all_info.zip last year in secuTrial version 6.5.1.5 to test the different delimiter options in CSV exports. It only contains ExportOptions_en.html. I now re-exported it with export language German, first while keeping the user language English (ExportOptions_de.html and ExportOptions_en.html), and a second time with user language set to French (ExportOptions_de.html and ExportOptions_fr.html).

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

No branches or pull requests

2 participants