Open esaber76 opened 10 months ago
Chris would like to not have PDF attachments. Option 2 is preferred:
Next steps is to look at the current feedback reports & document what is there. That info should be added to the email (if possible)-- may need to talk to Mike/CDX people to see what is possible.
Chris changed his mind. He would like to keep the attachments as HTML using existing report generation when possible.
Discussed emails with Chris on 4/9. Ann will write up the requirements. The run book may also need to be updated in association with this ticket. https://github.com/US-EPA-CAMD/easey-docs/blob/develop/CAMDRunbook.md#112-reports
Discussed the recipients list, EASEY-255, and Chris had no edits.
This is an example of the email that currently gets sent out in 2.0. This info should be shown in the attachment, not in the email itself.
The language for the email to which the feedback reports are attached.
See attached feedback report templates. All the header and table information should update based on the specific submission (e.g., facility name, Feedback Status Level, date, etc.).
The Feedback Report text should update based on the file type submitted (MP, QA, EM) and the Feedback Status Level (No Errors, Crit 1, etc.).
The report layout/formatting doesn't have to look exactly like the attachments-- it should be based on the existing 2.0 layout/formatting.
Acceptance Testing: Make submissions, or find recent ones, that fulfill the following criteria. Ensure the email text and Feedback Report attachment text is correct based on the specific submission information.
Questions/Confirmations
select fac.Oris_Code,
fac.Facility_Name,
coalesce( unt.Unitid, stp.Stack_Name ) as Location_Name
from camcecmps.MONITOR_PLAN_LOCATION mpl
join camdecmps.MONITOR_LOCATION loc
on loc.Mon_Loc_Id = mpl.Mon_Loc_Id
left join camd.UNIT unt
on unt.Unit_Id = loc.Unit_Id
left join camdecmps.STACK_PIPE stp
on stp.Stack_Pipe_Id = loc.Stack_Pipe_Id
join camd.PLANT fac
on fac.Fac_Id in ( unt.Fac_Id, stp.Fac_Id )
where mpl.Mon_Plan_Id = @monPlanId
Made the following changes as part of this ticket:
Problem:
When an MP, Test summary, TEE, and QCE are submitted together, only the MP seems to be successfully submitted (and the rest seem to be ignored).
Observation:
In easey-camd-services, when queueing the submission, it creates submission set and submission queue records for each file type that is submitted. The order of the processing is: MP, test summary, qce, tee, emissions, and mats. The queuing fails when processing test summary because the logic expects there to be data in the camdecmpswks.qa_supp_data table for the submitted testSumId. This causes an exception and the qce, tee, emissions, and mats submissions are never processed.
Solution
Short term: I put in a check to prevent an exception if the expected test summary, qce, tee, emissions, or mats records are not found.
Long term: @djw4erg will look into why the camdecmpswks.qa_supp_data table is missing an entry for that testSumId. An evaluation action should have created a record in the camdecmpswks.qa_supp_data table.
I just noticed that the sample feedback reports have an additional table for QA/Cert and TEE. I had only noticed the Table 2 for emissions. Do you know if there is a stored procedure or view that has this data I can reuse?
ECMPS.Reports.GetFeedbackReportDataQA.sql.txt
QAT_QCE_and_TEE_Feedback_Report.pdf
Hi Dwayne, while you are looking at my question above, I have one more The ticket and your notes all imply that we should only have MP, EM, and QA (test, cert, and tee) in the submission queue table. MATS is not mentioned anywhere (and also the feedback email samples also only refer to MP, EM, and QA submissions. However, I see that there are MATS entries in the submission queue table (select * from camdecmpsaux.submission_queue sq where sq.process_cd = 'MATS').
So, the question is, should I be ignoring MATS records when processing for feedback emails? If I should include them (meaning send a separate email for MATS records just like the others), then where can I get the feedback report examples for those?
The ticket only talks about MP, EM, and QA in the Submission Queue table because they are the only types of submissions included on the report. That does not mean that the Submission Queue should not contain the MATS submissions. In fact the Submission Queue table definitely should include MATS and the report should ignore MATS. MATS submissions are treated differently from Part 75 submissions. Part 75 is the CAPD (Clean Air and Power Division) rule, while MATS is an OAQPS (Office of Air Quality Planning and Standards) rule. OAQPS pulls our MATS submissions and they are responsible for any notifications.
Yonatan Data Source Question from Teams Chat
I just noticed that the sample feedback reports have an additional table for QA/Cert and TEE. I had only noticed the Table 2 for emissions. Do you know if there is a stored procedure or view that has this data I can reuse?
Response
The attached ECMPS 1.0 stored procedure, GetFeedbackReportDataQA, returns the data for the report.
- VW_RPT_FEEDBACK Section: Returns Table 1 data and Severity specific text.
- VW_RPT_QATEST_FEEDBACK Section: Returns QAT Evaluation Results data.
- VW_RPT_QA_CERT_EVENT_FEEDBACK Section: Returns QCE Evaluation Results data.
- VW_RPT_TEST_EXTENSION_EXEMPTION_FEEDBACK Section: Returns TEE Evaluation Results data.
- VW_RPT_QATEST_LIST Section: Returns QAT Table 2 data.
- VW_RPT_QA_CERT_EVENT_LIST Section: Returns QCE Table 2 data.
- VW_RPT_TEST_EXTENSION_EXEMPTION_LIST Section: Returns TEE Table 2 data.
The following ECMPS 1.0 feedback reports show versions of the feedback reports for submissions that contain at least one each of QAT, QCE and TEE.
- The attached QAT_QCE_and_TEE_Feedback_Report.pdf feedback report shows the format when the submission contains QAT, QCE, and TEE data, each with some errors.
- The attached QAT_Errors_With_QCE_and_TEE_Feedback_Report.pdf feedback report shows the format when the submission contains QAT with errors, and QCE and TEE without errors.
- The attached QCE_Errors_With_QAT_and_TEE_Feedback_Report.pdf feedback report shows the format when the submission contains QCE with errors, and QAT and TEE without errors.
- Note: The situation to produce the first was created, but the latter two were existing reports. I did not find an example for TEE with errors, and QAT and QCE without errors.
Stored Procedure GetFeedbackReportDataQA
ECMPS.Reports.GetFeedbackReportDataQA.sql.txt
Example Feedback Reports
QAT_QCE_and_TEE_Feedback_Report.pdf
Hi @djw4erg, ECMPS.Reports.GetFeedbackReportDataQA.sql.txt stored procedure references vw_rpt_feedback_check_log which I am not able to locate in the dev database or in easey-db-scripts. I am suspecting this has not been ported to postgres yet. Can you please attach this file and any referenced by it?
From Dwayne:
Here is the SQL Server script for VW_RPT_FEEDBACK_CHECK_LOG.
USE [ECMPS] GO
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[VW_RPT_FEEDBACK_CHECK_LOG]')) DROP VIEW [dbo].[VW_RPT_FEEDBACK_CHECK_LOG] GO
CREATE VIEW [dbo].[VW_RPT_FEEDBACK_CHECK_LOG]
AS
SELECT DISTINCT cs.CHK_SESSION_ID,
cs.SESSION_BEGIN_DATE,
cs.SESSION_END_DATE,
cl.CHK_LOG_ID,
cl.RULE_CHECK_ID,
cs.PROCESS_CD,
rc.CATEGORY_CD,
catcd.CATEGORY_CD_DESCRIPTION,
IsNull(cl.RESULT_MESSAGE, cl.CHK_LOG_COMMENT) AS [MESSAGE],
cl.TEST_SUM_ID,
cl.MON_LOC_ID,
cs.MON_PLAN_ID,
cs.RPT_PERIOD_ID,
dbo.ConcatMonitorPlanLocations(cs.MON_PLAN_ID) AS MP_LOCATIONS,
cc.CHECK_TYPE_CD + '-' + CAST(cc.CHECK_NUMBER AS varchar) + '-' + cl.CHECK_RESULT AS CHECK_IDENTIFIER,
cl.CHECK_RESULT,
cc.CHECK_TYPE_CD,
cc.CHECK_NUMBER,
cl.SEVERITY_CD,
sc1.SEVERITY_CD_DESCRIPTION,
cs.SEVERITY_CD as SESSION_SEVERITY_CD,
sc2.SEVERITY_CD_DESCRIPTION as SESSION_SEVERITY_CD_DESCRIPTION,
cs.EVAL_SCORE_CD,
cl.BEGIN_DATE,
cl.OP_BEGIN_DATE,
cl.OP_BEGIN_HOUR,
cl.OP_END_DATE,
cl.OP_END_HOUR,
rc.CHECK_CATALOG_ID
FROM CHECK_SESSION cs
LEFT OUTER JOIN CHECK_LOG cl ON cl.CHK_SESSION_ID = cs.CHK_SESSION_ID
LEFT OUTER JOIN SEVERITY_CODE sc1 ON sc1.SEVERITY_CD = cl.SEVERITY_CD
LEFT OUTER JOIN SEVERITY_CODE sc2 ON sc2.SEVERITY_CD = cs.SEVERITY_CD
LEFT OUTER JOIN RULE_CHECK rc ON rc.RULE_CHECK_ID = cl.RULE_CHECK_ID
LEFT OUTER JOIN CATEGORY_CODE catcd ON catcd.CATEGORY_CD = rc.CATEGORY_CD
LEFT OUTER JOIN CHECK_CATALOG cc ON cc.CHECK_CATALOG_ID = rc.CHECK_CATALOG_ID
GO
Here is the SQL Server script for the ConcatMonitorPlanLocations function.
USE [ECMPS] GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[ConcatMonitorPlanLocations]') and type in (N'FN', N'IF', N'TF', N'FS', N'FT')) DROP FUNCTION [dbo].[ConcatMonitorPlanLocations] GO
SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO
CREATE FUNCTION [dbo].[ConcatMonitorPlanLocations](@Mon_Plan_Id [dbo].[DB_ID_KEY]) RETURNS varchar WITH EXECUTE AS CALLER AS begin declare @Units varchar(max) declare @StackPipes varchar(max) declare @result varchar(max)
select @StackPipes = ltrim(rtrim(dbo.ConcatMonitorPlanStackPipes(@Mon_Plan_Id))) select @Units = ltrim(rtrim(dbo.ConcatMonitorPlanUnits(@Mon_Plan_Id)))
if (@StackPipes <> '' and @Units <> '') select @result = @StackPipes + ', ' + @Units else if( @StackPipes <> '' ) select @result = @StackPipes else select @result = @Units
return @result end GO
-- Permissions GRANT REFERENCES ON [dbo].[ConcatMonitorPlanLocations] TO [ECMPS_DBUser] GRANT EXECUTE ON [dbo].[ConcatMonitorPlanLocations] TO [ECMPS_DBUser] GO
Note that ConcatMonitorPlanLocations puts the Stack/Pipes before the Units. I believe that ECMPS 2.0 tends to put the units before the stack/pipes.
The following is what I usually use for the same thing when looking at data. It puts the stack/pipes before the units.
MP Locations Example
SQL select fac.oris_code, fac.facility_name, ( select string_agg( coalesce( unt.unitid, stp.stack_name ), ', ' order by case when unt.unitid is null then 0 else 1 end, coalesce( unt.unitid, stp.stack_name ) ) from camdecmps.MONITOR_PLAN_LOCATION mpl join camdecmps.MONITOR_LOCATION loc on loc.mon_loc_id = mpl.mon_loc_id left join camd.UNIT unt on unt.unit_id = loc.unit_id left join camdecmps.STACK_PIPE stp on stp.stack_pipe_id = loc.stack_pipe_id where mpl.mon_plan_id = pln.mon_plan_id ) as locations, pln.mon_plan_id, pln.fac_id from camd.PLANT fac join camdecmps.MONITOR_PLAN pln on pln.fac_id = fac.fac_id order by oris_code, locations
Change: order by case when unt.unitid is null then 0 else 1 end, coalesce( unt.unitid, stp.stack_name )
To: order by case when unt.unitid is null then 1 else 0 end, coalesce( unt.unitid, stp.stack_name )
In the string_agg's order by to list Units first.
_Data seems to be missing from core tables. 1) for test summary, chk_session_id values in check_log do not match those in the test_summary 2) for QCE, the qa_cert_event_id value in submission queue is missing from qa_cert_event table. 3) for TEE, the test_extension_exemption_idvalue in submission queue is missing from test_extension_exemption table._
@yonatan-dp Just resubmitting a QA test with admin overrides using RATA test 2017-SO2 for ORIS 3470 MS1, MS2, WAP8 at 9:17. The test evaluated with the following check results
ECMPS shows Informational Message as the Eval Status which looks like a separate issue.
Still waiting on the submission confirmation email
@lgiannini1, these changes have not yet been merged into the code base and deployed. There are further changes to be made yet based on Dwayne's investigations. He will update these ticket with his findings and the changes to be made.
ECMPS 1.0 generates Feedback Reports on the ECMPS Client pre-submission, not the ECMPS Host post-submission. This bypasses the fact that CRIT 1 submissions are not actually loaded into the Host tables for ECMPS 1.0, which would make it difficult to pull data on the Host for CRIT 1 submissions.
ECMPS 2.0 should produce the Feedback Report from CAMDECMPSWKS data as part of the submission process.
@yonatan-dp
ORIS 147, K-7 A 2023 Q3 linearity was submitted (ND7-Q3-2023-1) with no errors and does not appear in table 2 of the feedback report
ORIS 628, 2GTA a 2023 Q1 RATA (CI2A-RNOX-0223) and QCE were submitted with informational messages and no check results are displayed in the evaluation results. Also, the RATA and QCE do not show up in table 2.
ORIS 147, K-7 a 2024 Q1 TEE was submitted with a critical 1 error. The TEE does not show up in table 2.
ORIS 628, 2GTB a 2023 Q3 Linearity was submitted with a critical 2 error, but the email text and feedback report are for critical 1 errors.
ORIS 147, K-7 A 2023 Q3 linearity was submitted (OD7-Q3-2023-1) with admin overrides and does not appear in table 2 of the feedback report. The admin override LINEAR-23-A check result does not appear in the evaluation results
ORIS 147, K-7 2023 Q3 emissions were submitted with no errors and table 2 does not display the cumulative data summary values.
ORIS ORIS 55409, CT1 2023 Q3 emissions were submitted with informational messages. Table 2 does not display the cumulative data summary values or check results in the evaluation results.
ORIS 55409, CT1 2023 Q3 emissions were submitted with a critical 2 error, but the email text and feedback report are for critical 1 errors
ORIS 7900, SH2 2023 Q3 emissions were submitted with admin overrides (HOURCV-37-A and HOURDHV-14-B). Table 2 does not display the cumulative data summary values or the check results in the evaluation results.
Verified in test for the following:
Silverhawk - ORIS 55841 Config A01
Comanche - ORIS 470 config 2
Fort Meyers - ORIS 612 Config FMCT2A
During the 1/25/2024 weekly ECMPS Support meeting with EPA, there was a discussion on what to do with Feedback Report Maintenance in CAT.
The PDF feedback report that is included with 1.0 submission confirmation emails is not currently included in 2.0. This could be due to the new CDX process.
The only users that would have access to submission related information from CDX - Submission History would be the submitter themselves.
Need to determine if: