Closed martinburchell closed 3 years ago
Also raised an issue with the plugin https://github.com/KHP-Informatics/brc-gate-pharmacotherapy/issues/1
Workaround is to define the database column to be varchar so we don't get the SQL errors
Do you think we should have the Python code check if its destination column is numeric (via SQLAlchemy), and if so, if the quantity is either non-numeric or non-finite, either (a) replace it with NULL and log a warning ("Rejecting value XXX from column YYY as it is not numeric/finite; replacing it with NULL") or (b) chuck the row and log a corresponding warning? (The downside to VARCHAR is that people may want to do dose calculations.)
As we discussed, let's catch the SQL error and ignore the row if the insert fails, logging the error.
UUIDs can result in some odd results from brc-gate-pharmacotherapy:
or:
We then run into problems when inserting the results because "-9.999999999E9" and "-Infinity" aren't valid:
"Error converting data type nvarchar to numeric." when the dose-value column in the database is defined as decimal.
It appears that 'C' is both a drug and a unit and anything in between is interpreted as a quantity. If there's an E in there, it gets treated as an exponent. Hence the odd results,