-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add Python DB Logger #136
Add Python DB Logger #136
Conversation
I am unable to install the db_logger package using the directions in https://github.com/ctsit/python_db_logger . I'll need help getting this set up and working when you get a chance, so that I can test the code. |
@s-emerson Everything works as expected in a local run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be easier to test after updating docker-compose.yml
.
@s-emerson I have added adminer which should be accessible at http://localhost:8080 once the containers are up. Docker should also automatically create all tables. A local run confirms all of this works. Please try running Nacculator again and let me know if you face any issues. |
@s-emerson Updated the details steps in "verification" section of the pull request. |
@s-emerson I added the warning logs, let me check why the critical db error shows up. It never showed up for me but I am working on a database with tables already created, that could be a reason why. |
@s-emerson I did a run on a clean setup following the steps mentioned in this PR, however, I am unable to reproduce the issue. Can you try deleting the docker container and all its images/volumes and try again with the latest code? |
As far as I'm aware, the entry point script for nacculator is https://github.com/ctsit/nacculator/blob/master/nacc/redcap2nacc.py (which has a function "main" at the bottom). There's also the filters, which run using https://github.com/ctsit/nacculator/blob/master/nacc/run_filters.py (this is the script that does the api call to redcap and automatically downloads the project data). |
@mbentz-uf @s-emerson |
@sinarest1608 i tried running it again with the doctor container down and i got the same error. |
@s-emerson |
with an API token from the REDCap project pasted into the nacculator_cfg.ini file and the redcap_server host set to our REDCap instance:
though this also fails when you try to run |
|
@s-emerson |
i gave nacculator a try by using nacculator_filters to download from the redcap api and then running redcap2nacc with the -ivp, -fvp, and -m flags. everything works fine, i didn't get any issues with the ivp_complete.txt or ivp_errors.txt files (and so on), which is great. so nacculator retains its previous functionality. however, when logging errors to the spreadsheet report-2023-09-08 (for example), i notice that several errors come back listed as "Unknown" instead of the error message that nacculator outputs to stderr. it looks like this is because they are caused by invalid data (like missing visit date) that don't normally get added to the list of errors that nacculator outputs and are instead printed by python itself. is there a way to also add these to the log? i ran into a similar issue with the -m flag, except all of the errors were "Unknown" even when nacculator had a log message for the actual issue (milestone date was out of range, which i expected to see). |
@s-emerson |
This error is caused by an issue with the data and should be resolved. You might need to merge in the changes from develop in order for this to skip properly if it pops up again. |
@s-emerson |
@s-emerson |
the code works well and the logs print out nicely in .xlsx format for all flags. one thing i notice is that the error printouts in the .xlsx log file don't have as much detail as the printouts in stderr. for example, for one ptid, the stderr printout said "Length of field DRUGID in form A4D with value "example error" is not valid. 11 != 6 which gives detail about the form the error is in, which field has the issue, and the value that is causing the issue. but in the log output, all that it says is "Assertion failed". can you have it print out the actual error message that nacculator gives? or is the .xlsx log supposed to be more general? |
The code looks good and works well. Thank you, Kshitij! |
What does this change do?
This change adds Python DB Logger module to Nacculator, to log directly to our logging database.
Why was this change made?
This change fixes #134
Verification
cp db_logger.env.example .env
docker compose -f .containers/mysql/docker-compose.yml up -d
report.xls
file in Nacculator's root directory.detail_log
has the logs.Both the database and XLS will have the same logs you would expect from the stdout and stderr file outputs.
No other configurations are needed, DB Logger has already been set up to start logging automatically when Nacculator script starts running.
Affirmations
README
,CHANGELOG
, and such).