Using Web Discoverer with AQS ADVANCED Way Poteat & Fletcher Clover USEPA – National Air Data Group 2012 AQS Conference – August 24, 2012 Providence, Rhode.

Slides:



Advertisements
Similar presentations
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Advertisements

Discoverer Web for AQS. 2 Goals for this class Introduce Discoverer Plus Learn About the Data in AQS Practice Finding Data Using Discoverer Have Fun!
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 10 – Designing.
AQS Data Handling (Under the Hood) AQS Conference August 23, 2012 Robert Coats.
Chapter 11 Group Functions (up to p.402)
Query Manager. QM is a collection of tools you can use to obtain information from the AS/400 database Used to –select, arrange, and analyze information.
M.S. Access Module CAS 133 Russ Erdman. M.S. Access Module Assignment Overview Two options for the unit: All students complete Units A, B and C In class.
Databases Lab 5 Further Select Statements. Functions in SQL There are many types of functions provided. The ones that are used most are: –Date and Time.
3-1 Chapter 3 Data and Knowledge Management
Introduction to Oracle9i: SQL1 Selected Single-Row Functions.
1 Databases. 2 Simple selects The full syntax of the SELECT statement is complex, but the main clauses can be summarized as: SELECT select_list [INTO.
AQS Concepts. In This Section We Will Talk About AQS Concepts 2 AQS Background History AQS as part of a monitoring program Types of Information in AQS.
Attribute databases. GIS Definition Diagram Output Query Results.
State of Connecticut Core-CT Project Query 4 hrs Updated 1/21/2011.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Database Programming Sections 5– GROUP BY, HAVING clauses, Rollup & Cube Operations, Grouping Set, Set Operations 11/2/10.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Single-Row Functions. SQL Functions Functions are a very powerful feature of SQL and can be used to do the following: Perform calculations on data Modify.
STAT02 - Descriptive statistics (cont.) 1 Descriptive statistics (cont.) Lecturer: Smilen Dimitrov Applied statistics for testing and evaluation – MED4.
AMP255 – Precision and Bias Data Report 2008 AQS Conference The AMP255 Precision and Bias Data Report August 22, 2008 Presented by Jonathan Miller EPA.
Oracle FUNCTIONS. Comment ScreenShot (in 10g) General Example of null Foreign Key: create table deptcs( deptno NUMBER(4) primary key, hiredate DATE,
AQS Development and Enhancement Plans AQS Development and Enhancement Plans AQS CONFERENCE Jake Summers June 9, 2010.
Introduction to Standard Reports. Standard Reports 2 How to get information out of AQS Standard Reports Site / Monitor Metadata Detail Data Reports “
Ts_print in a few easy steps There are four screens: Entities, Data Items, Date, and Report Format.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
PHP meets MySQL.
 Continue queries ◦ You completed two tutorials with step-by-step instructions for creating queries in MS Access. ◦ Now must apply knowledge and skills.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character.
HPRP: New Reports HPRP new reports and data entry reporting review April 2010.
MIT5314: Database ApplicationsSlide # 1 More SQL Dr. Peeter KirsFall, 2003 More SQL (With a little more on Database Design)
Ts_print IN A FEW EASY STEPS. C L E A N, Q U A L I T Y D A T A F O R E X C E L L E N C E I N R E S E A R C H ts_print is CRSP’s flexible report writer.
Examining data using Microsoft Access Queries Using Criteria and Calculations SESSION 3.2 This section covers specifying an exact match condition in a.
Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! With Microsoft ® Office 2007 Intermediate Chapter.
Appendix A: Calculations for Data Quality Assessment QC check statistics Precision calcs Bias calcs PM stats Reporting: quarterly and annual.
 Agenda 2/20/13 o Review quiz, answer questions o Review database design exercises from 2/13 o Create relationships through “Lookup tables” o Discuss.
1 Agenda – 10/24/2013 Answer questions from lab on 10/22. Present SQL View database object. Present SQL UNION statement.
Single Row Functions Week 2. Objectives –Describe types of single row functions in SQL –Describe and use character, number, date, general and conversion.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Chapter 3 Selected Single-Row Functions and Advanced DML & DDL.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
1 Chapter 3: Customize, Analyze, and Summarize Query Data Exploring Microsoft Office Access 2007.
Conversion Functions.
Single Row Functions. Objectives –Use character, number, and date functions –Use conversion functions –Describe types of single row functions in SQL.
DATA RETRIEVAL WITH SQL Goal: To issue a database query using the SELECT command.
1 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Aliya Farheen October 29,2015.
Access Queries Agenda 6/16/14 Review Access Project Part 1, answer questions Discuss queries: Turning data stored in a database into information for decision.
Session id: Darrell Hilliard Senior Delivery Manager Oracle University Oracle Corporation.
PeopleSoft Financials Advanced Query Training Financial Information Systems and Reporting Controller’s Division
QUERY CONSTRUCTION CS1100: Data, Databases, and Queries CS1100Microsoft Access1.
5 Copyright © 2008, Oracle. All rights reserved. Testing and Validating a Repository.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
TOPSpro Special Topics TOPSpro Special Topics Data Detective I: Tracking Your Pre- and Post-test Results.
Single Row Functions Part I Week 2. Objectives –Describe types of single row functions in SQL –Describe and use character, number and date SQL functions.
Data Virtualization Tutorial: Introduction to SQL Script
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Using Structured Query Language (SQL) (continued)
More Selections BIS1523 – Lecture 9.
Sirena Hardy HRMS Trainer
Date Functions Farrokh Alemi, Ph.D.
Creating Noninput Items
M1G Introduction to Database Development
Creating complex queries using nesting
Lecture 5 SQL FUNCTIONS.
Trainer: Bach Ngoc Toan– TEDU Website:
Introduction to SQL Server and the Structure Query Language
Temporal Data Part V.
Presentation transcript:

Using Web Discoverer with AQS ADVANCED Way Poteat & Fletcher Clover USEPA – National Air Data Group 2012 AQS Conference – August 24, 2012 Providence, Rhode Island

Items to be Covered Thinking About Discoverer −What is it Trying to Do? −How Do I Make it do What I Want it to Do? SQL Functions −General SQL Functions −Discoverer-Specific Functions −User Parameters Working With the EUL −What Folder to Use −What Filters to Keep in Mind Exceptional Events, Pollutant Standard IDs, and Discoverer Fixing Old Queries Fan Traps −What are they? −How do I Work With / Around them? Where to Get Additional Help

Thinking About Discoverer Question: What is it Trying to Do? Answer: Build a Structured Query Language (SQL) Query −A SQL Query has “Select” Clause (What to Show) “From” Clause (Where to Find the Information May Have a “Where” Clause (What to Filter) May Have a “Group By” Clause (if Doing Aggregate Functions) −Knowing a Little SQL Can Help You a LOT!!

Hints to Building a Query in Discoverer STEP 1: FORM A GOOD QUESTION −The Right Question Let’s You Know: The Items to Select (the “SELECT”) The Appropriate Places to Find that Data (the “FROM”) The Filters that Will be Required (the “WHERE”) −Don’t Be Afraid to be Annoying With Lots of Follow-up Questions! STEP 2: Make Sure You and the Requestor Understand What is Being Selected −What is Meant by “Active Monitors”? −For Ozone, do you mean the Season or the Year? −Is the Data You Want Based on Daily Maximums or All the Data? −How do You Want to Handle Events?

What is a Function? A Piece of Code in the Database That Can Take in Pieces of Information and Transform it Into Something Else Some Functions Work Differently Depending on the Types of Data They Receive Functions Can Be General or Custom Built for the Application −Currently, the AQS EUL only Supports the “General” Types of Functions −Example of AQS Specific Function: GET_NEXT_SCHED_DATE −Input: a Date and a Collection Frequency Code −Output: The next expected date for a sample to be taken with the Provided Collection Frequency Code Based on the NAMS Schedule.

Where Can I Use Functions in Discoverer? Create Calculation Create Condition −Conditions Can Be Based on Items Values You Supply Parameters (User Supplies Values at Runtime) Calculations

SQL Functions String Functions Math Functions Date Functions Discoverer-Specific Functions −COUNT_DISTINCT

String Functions || −StateCode||‘-’||CountyCode||‘-’||SiteID = INITCAP(String) −INITCAP(‘hello’) = Hello INSTR(String, set [, start [, occurrence] ]) −INSTR(‘Find it’, ‘i’, 1, 2) = 6 LENGTH(String) −LENGTH(‘Find it’) = 7 LOWER(String) / UPPER(String) −LOWER(‘Jonathan Miller’) = jonathan miller −UPPER(‘Jonathan Miller’) = JONATHAN MILLER LPAD(String, Length [, ‘set’]) / RPAD(String, Length [, ‘set’]) −LPAD(‘Example’, 10, ‘-’) = ---Example −RPAD(‘Example’, 10, ‘-’) = Example--- SUBSTR(String, Start [,count]) −SUBSTR( ‘Find it’, 3, 4) = nd i

Math Functions ABS – Absolute Value CEIL / FLOOR – Smallest Integer Above / Below Value −CEIL(1.6) = 2 −FLOOR(1.6) = 1 POWER / SQRT −POWER(6,2) = 36 −SQRT(4) = 2 ROUND/TRUNC −ROUND(3.859,2) = 3.86 −TRUNC(3.8, 1) = 3.8

Date Functions TO_CHAR −Allows You to Format a Date Into Any Format You Want −TO_CHAR(sysdate, ‘DD-MON-YYYY’) = 08-JUN-2010 TO_DATE −Converts a String Into a Date with a Defined Format −TO_DATE(‘ ’, ‘YYYYMMDD’) Date “Math” −Subtract a Date From a Date Gives You the Number of Days BETWEEN the Date (Non-Inclusive) −A Date + a Number (x) Gives You the Date “x” Days in the Future TO_CHAR(SYSDATE + 1, ‘DD-MON-YYYY’) = 09-JUN-2010 −You Can TRUNC or ROUND a Date Returns Midnight Time Default is to the Day, but Can Be Done for a Calendar Month, Quarter, or Year as Well TRUNC(sysdate) = June 8, 2010 TRUNC(sysdate, ‘MM’) = June 1, 2010 TRUNC(sysdate, ‘YYYY’) = January 1, 2010

Other Date Functions ADD_MONTHS – Move a date x months into the future −ADD_MONTHS(sysdate, 2) = August 8, 2010 LAST_DAY – Returns the date that is the last day of the month for the supplied month −LAST_DAY(sysdate) = June 30, 2010 MONTHS_BETWEEN – Number of months between 2 dates −MONTHS_BETWEEN (TO_DATE(‘30-JUN-2010’, ‘DD-MON-YYYY’), sysdate) =

Discoverer Specific Functions COUNT_DISTINCT −Allows You to Count Distinct Occurrences of a Field −Example: How Many Sites Operated a PM 10 Sampler Last Year per State? −Since PM 10 Sites can be Collocated, We Don’t Want to Double-Count Those Sites. −We’ll Cover this Question in the Class Exercise

Class Example How Many Sites Operated a PM 10 Sampler Last Year per State?

User Parameters Specific Values to Use for Filters at the Time the Query is Executed Most Useful When Creating a Query for a Non- Discoverer User Who Will Use the Query Over and Over

The End User Layer

Working With the EUL The Existing EUL is Roughly Based on the AQS Data Model (One Folder Mapping to One Table in the Oracle Database) Know the Type of Data You Want & Where to Go to Get It Understand How the Data You Want Fits Into the Overall Database Structure −This Let’s You Know How to Get There −Might Be a Better Place to Go Understand What Elements Make a Record Unique in that Table −Can Cause You to Get More Records Than You Expected

Possible Project? How Would You Organize the Data to be More Useful? −Would Pollutant Specific Folders be More Useful? −Thinking of Going With Fewer Folders & More Items per Folder Are There Types of Data That you Need to Access that You Can’t Currently in Discoverer? Current Structure: High Flexibility / High Complexity −Would an EUL With Few Options be Desirable? −What are the Most Common Types of Things You Would Want to See?

Know the Type of Data You Want Location Information  Sites Monitor Description Information  Monitors −Lots of Monitor Subordinate Information is Located “Under” Monitors Sample Periods – When the Monitor is “Active” Monitor Type Assignments – What Networks / Programs Applied Agency Roles – Reporting Organizations, PQAO Required Collection Frequency – How Frequently a Monitor is Required to Collect Monitor Protocols – Description as to How (Instrumentation) the Data Were Collected Audit Information  Precision / Accuracy Sample Data −Summarized Data Annual  Annual Summaries Quarterly  Quarterly Summaries Month (Coming Soon!!)  Monthly Summaries for Pb & PM2.5 Daily  Daily Summaries −Raw Data  Raw Data

Basic Data Structure Sites Monitors Sample Periods Monitor Types Agency Roles Monitor Protocols Raw Data Precision / Accuracy Data Daily Summaries Quarterly Summaries Annual Summaries Summary Maximums Summary Percentiles Summary Protocols Tangent Streets

Know How to Join Generally, You Want to Join by the “Parent” in the Structure Sometimes There are Multiple Ways to Join Between Tables. Choose the Higher “Level” Right One

Filters to Keep in Mind: Sites −State + County + Site ID Monitors −Sites + Parameter + POC Summary Records −Monitor ID + Time Period + Duration + Exceptional Data Type + Pollutant Standard ID −Time Period Depends on the Type of Summary: Annual: Year Quarter: Year + Quarter Month: Year + Month Daily: Sample Date Raw Data −Monitor ID + Sample Date/Time P & A Data −Monitor ID + Audit Date Monitor Subordinate Records -Sample Periods -Monitor ID + Sampling Begin Date -Only 1 in Effect at any Given Time -Monitor Type Assignments -Monitor ID + Monitor Type + MT Begin Date -Multiple Monitor Types in Effect at a Given Time -Agency Roles -Monitor ID + Role + Role Begin Date -Only One Role per Monitor can be in Effect at a Given Time -Roles: -REPORTING -PQAO -ANALYZING -COLLECTING

Exceptional Events Two Pieces to the Exceptional Events −Exceptional Data Type (EDT) 0: No Exceptional Events Present 1: Exceptional Events Present and Excluded 2: Exceptional Events Present and Included 5: Exceptional Events Present and Regionally Concurred Events Excluded −Pollutant Standard ID Events Are Associated With a Specific Standard Some Pollutants Have Multiple Standards (PM 2.5 for Example) Make Sure That You are Assuming the Correct Standard When Running Your Queries Not all Standards Apply to All Pollutant – Duration Combinations

Pollutant Standards Pollutant Standard (PS) is Pollutant – Duration – Time Dependent Most Pollutants Have 1 PS Record at the Most per Duration −Exceptions: SO2 Data −24 Hour Standard (#6) – Applies to Duration 7 & X −Annual Standard (#7) – Applies to Duration 7 & 1 8-Hour Ozone (Applies Only to Duration W Data) −1997 Standard (#10) −2008 Standard (#11) PM 2.5 (Can Apply to Duration 7 or Duration X) −24 hour Standard (#16) −Annual Standard (#18)

Fixing Old Queries If You Have Queries That Reference Summary Data (Any Level), You May Need to Account for the Pollutant Standard ID or You Could End Up With Multiple Rows (One Instance for Each Standard) Create a Condition Where PollutantStandardID = {Appropriate Standard ID Number}

What is a “Fan Trap”? −Your Query has Multiple “Many-to-Many” Relationships How Do I Work With / Around Them? −Question: Do you Really Want to Disable This? −If “Yes”  Disable the Option in Discoverer Tools  Options  “Advanced” Tab  Disable Fan Trap Detection −Set Your Filters On Items to Make Sure the Right Records Are Associated Together This Usually Means That You Need to Adjust the Date Ranges to Fall Within Each Other Could Mean Additional Filtering Based on the Type of Information Requested Fan Traps

Example Show the Following Items −AQS Site ID −POC −The Monitor Type(s) −The PQAO in Effect −The Year of Data −The Annual Arithmetic Mean Filter By −Years Between 2008 & 2010 −Pollutant = NO 2 −State = Colorado

Back to the Structure: A “Fan Trap” Is When You Want Items from Multiple the Same Level Sites Monitors Sample Periods Monitor Types Agency Roles Monitor Protocols Raw Data Precision / Accuracy Data Daily Summaries Quarterly Summaries Annual Summaries Summary Maximums Summary Percentiles Summary Protocols Tangent Streets Discoverer Wants to Use Only One Folder per Level

Fan Trap Example – Selected Items

Results Without Resolving Fan Traps

Results After Resolving Fan Traps

How Did the Fan Traps Get Resolved? Need to Make Sure the Agency Roles and the Monitor Type Assignments Are Only Applicable for the Retrieved Annual Summary How? Make Sure the Role / Monitor Type Was in Effect During the Year in Question by Using the “Begin” and “End” Dates The Fields are Dates, and the Annual Summary Year is a Number, so we Need to Convert…

How Did the Fan Trap Get Resolved? TO_NUMBER(TO_CHAR(Agency Role Begin Date, ‘YYYY’)) TO_NUMBER(TO_CHAR(NVL(Agency Role End Date, SYSDATE), ‘YYYY’))

Group Exercises