US-EPA-CAMD / easey-ui

Project Management repo for EPA Clean Air Markets Division (CAMD) Business Suite of applications
MIT License
0 stars 0 forks source link

Ensure that the user is notified when a database exception occurs during an import #6306

Open djw4erg opened 3 weeks ago

djw4erg commented 3 weeks ago

Background

As reported In #6100 a database exception occurred when attempting to store duplicate Summary Value rows in an imported emission report. Although the exception prevented the loading of the emission report into the database, the messaging to the user indicated that the import was successful. Although, #6203 will prevent the specific issue that caused the database exception in #6100, the import processes will need logic to capture and report database errors that are not prevented by checks before pushing the import to the database.

Needed Changes

Ensure that during any import, database exceptions are captured by the API/application and reported to the user.

This should include the following:

  1. Emission (EM) Import from JSON
  2. Monitoring Plan (MP) Import from JSON
  3. QA Test (QAT) Import from JSON
  4. QA Cert Event (QCE) Import from JSON
  5. Test Extension and Exemption (TEE) Import from JSON

Acceptance Test (add more tests if applicable)

The issue with testing this change is that the known problem that will cause it will likely be resolved by #6203. That involves importing a JSON emissions file that contains summaryValue objects for the same location with the same parameterCode value. The triggers a constraint error that prevents SUMMARY_VALUE rows with the same MON_LOC_ID, RPT_PERIOD_ID, and PARAMETER_CD.

Testing this problem will likely require using the following method:

  1. For each import type, select a table that is affected by the target import type ( EM, MP, QAT, QCE and TEE).
  2. Temporarily add a constraint (likely a check constraint) that does not affect current workspace data, can be created in the import JSON.
ergjustin commented 1 week ago

The error identified in ticket #6100 originates from the bulk load service, The error’s invisibility to users is because it is in easey-common package. The bulk load service used only in emission API (EM).