AMP-SCZ / utility

Storehouse for all utility scripts
Apache License 2.0
0 stars 4 forks source link

feat: Add scripts for parsing .out and .err from redcap-import #89

Closed dheshanm closed 10 months ago

dheshanm commented 10 months ago

Builds on top of existing 'parse_redcap_error.py' to only print files that failed with HTTP Code 400. Adds parse_redcap_errors_err.py that similarly parses '*.out' files from redcap import.

tashrifbillah commented 10 months ago

Can you remind me why you have updated parse_redcap_error.py, the original script?

tashrifbillah commented 10 months ago

Hi @dheshanm , can you review this block for me?

https://github.com/AMP-SCZ/utility/blob/b63261ca8cf92c6220cb66a35cd25fbcfe83d5c2/parse_redcap_error.py#L26-L39

I started off your idea, changed the condition for non-error lines, and omitted printing of the next CSV file line.

dheshanm commented 10 months ago

Great! Instead of looking for 'Traceback (most recent call last):' to identify errors, you are looking for changes in terminal color to red with the escape sequence '\033[0;31m'.

I did not know that these escape sequences will be captured, when outputs of script is piped into a file. This is much cleaner, than what I had attempted.