Do It Yourself Reporting Get what you want, when you want it. Tex Ritter Sierra Nevada Regional DCSS Destiny Gerringer Stanislaus County DCSS Ryan Gruver Sierra Nevada Regional DCSS Finally, be able to say “Yes” to the question: IS IT POSSIBLE? Say “Yes” to the request ■ Is it possible to get a list of our current interstate cases? ■ How about formerly assisted cases with non-cooperating CPs? ■ What if I wanted to see our recent history of new orders and their types? ■ How about tying in performance to order type over time? ■ Phone call activity by caseworker? Tied to performance? ■ What about an auto-dialer list of cases where the dependent’s birthday is approaching? ■ How about demographic factors tied to performance statewide? ■ What if I want to know if an NCP is more likely to stipulate in the month of their astrological sign? ■ How do the movements of celestial bodies tie in to performance? ■ Is there a correlation between hair color and performance? ■ Are left handed people more likely to pay with cash? Okay, so aside from a repository of data, what is: THE DATA REPOSITORY What is CSE? ■ What we see of CSE is basically an interface that accesses underlying database tables. What is the Data Repository? ■ The Data Repository is a snapshot of some of the CSE Tables ✷ Plus some additional data such as 1257, CSLN, etc. ■ Currently the data is updated monthly. The Data Repository Tables Where does the Data Repository live? ■ The Data Repository is hosted on DCSS Otech servers, running the SQL Server platform. ■ Each month data is downloaded from CSE tables, processed, and posted on the DCSS servers for LCSAs to access. Who administers the Data Repository? ■ The Data Repository is currently administered by the DCSS Data Analysis forum. ■ Requests for access or assistance can be sent to the Data Analysis mailbox at: DCSSDataAnalysis@dcss.ca.gov How can LCSAs access the Data Repository? ■ Login instructions and credentials can be requested from the DCSS Data Analysis mailbox. ■ LCSAs generally query the Data Repository using either Microsoft Access, or TOAD For SQL Server. ■ TOAD for SQL Server has a freeware version available for download at: http://www.toadworld.com/Freeware/ ToadforSQLServerFreeware/tabid/562/Default.aspx Access through Access TOAD Software TOAD PopUps Sounds great, but what if I was an: ENGLISH MAJOR When you think of the DR, don’t think like this: Scary!!!! Think like this: Court Order Type Relationship to Current and Arrears Performance 80.00% 76.72% 75.71% 58.62% 60.52% 55.39% 54.59% 61.69% 40.00% BY UNCONTESTED HEARING 52.04% 50.00% 77.03% 60.00% 72.43% 70.00% BY COURT HEARING APPEARANCE BY WRITTEN STIPULATION WITHOUT COURT APPEARANCE JUDGMENT ENTERED BY DEFAULT 30.00% OTHER 20.00% 10.00% 0.00% Current % Arrears % Then begin with the basics SELECT ✷ What you want. The specific columns FROM ✷ Where to get it. The table that contains your columns. WHERE ✷ Criteria. The criteria under which to return the data, such as managed by your county, open case, etc. Everything else is a variation on these concepts. Start with the FROM: Writing a basic query SELECT C_CASE_EXTID ,OU_T_ORG_UNIT_NM ,IU_LOGIN_NM FROM CASE_CAS WHERE C_MNG_CNTY_FIPS_CD IN (057,091) AND C_CRNT_STAT_CD='OPN Basic Query and Results Basic Query Example results C_CASE_EXTID SELECT C_CASE_EXTID ,OU_T_ORG_UNIT_NM ,IU_LOGIN_NM FROM CASE_CAS WHERE C_MNG_CNTY_FIPS_CD IN (057,091) AND C_CRNT_STAT_CD='OPN' OU_T_ORG_UNIT_NM IU_LOGIN_NM 0571111111-01 HD2 frey.cyndy 0571111112-01 CASE MGMT A purwin.angie 0571111113-01 CASE MGMT C richmond.andrea 0571111114-01 CASE MGMT A kennard.cindy 0571111115-01 CASE MGMT B morgan.mechelle 0571111116-01 CASE MGMT B morgan.mechelle 0911111111-01 CASE MGMT ramos.sandra 211111111111111 CASE MGMT A kennard.cindy 0571111118-01 CASE MGMT A burns.jennifer Etc. Etc. Etc. Join the party ■ Sometimes you may want data from multiple tables. To do this you use a JOIN ■ Joins are a way of linking together tables using common fields. ■ For example, most case level tables have a Case ID field. ■ The DR Diagram can assist you in planning your joins. DR Diagram - Joins Join the party SELECT C_CASE_EXTID ,OU_T_ORG_UNIT_NM ,IU_LOGIN_NM ,COURT_CASE.CC_COURT_CASE_EXTID ,LEGAL_ACTIVITY.LA_FILE_DT JOIN CASE_COURT_CASE ON C_CASE_ID=CCC_CASE_ID JOIN COURT_CASE ON CC_COURT_CASE_ID=CCC_COURT_CASE_ID JOIN LEGAL_ACTIVITY ON LA_COURT_CASE_ID=CCC_COURT_CASE_ID FROM CASE_CAS WHERE C_MNG_CNTY_FIPS_CD IN (057,091) AND C_CRNT_STAT_CD='OPN' AND LA_LGL_ACTV_TYPE_CD='SUP' AND LA_STAT_CD='ACT' Join the party C_CASE_EXTID OU_T_ORG_UNIT_NM IU_LOGIN_NM CCC_COURT_CASE_ID LA_FILE_DT 0571111111-01 HD2 frey.cyndy FL00001 3/29/2011 12:00:00 AM 0571111112-01 CASE MGMT A purwin.angie FL00002 3/29/2011 12:00:00 AM 0571111112-01 CASE MGMT A purwin.angie FL00002 8/12/2003 12:00:00 AM 0571111114-01 CASE MGMT A kennard.cindy FL00004 3/29/2011 12:00:00 AM 0571111115-01 CASE MGMT B morgan.mechelle FL00005 3/29/2011 12:00:00 AM 0571111116-01 CASE MGMT B morgan.mechelle FL00006 3/29/2011 12:00:00 AM 0911111111-01 CASE MGMT ramos.sandra FL00007 3/29/2011 12:00:00 AM 211111111111111 CASE MGMT A kennard.cindy FL00008 3/29/2011 12:00:00 AM 0571111118-01 CASE MGMT A burns.jennifer FL00009 3/29/2011 12:00:00 AM Etc. Etc. Etc. Etc. Etc. Aggregates ■ Aggregates allow you to perform functions on your results. ✷ ✷ ✷ ✷ SUM AVG MAX Etc ■ Place the field on which you’re performing an aggregate in parentheses: ,MAX(LEGAL_ACTIVITY.LA_FILE_DT) Aggregates SELECT C_CASE_EXTID ,OU_T_ORG_UNIT_NM ,IU_LOGIN_NM ,MAX(LEGAL_ACTIVITY.LA_FILE_DT) JOIN CASE_COURT_CASE ON C_CASE_ID=CCC_CASE_ID JOIN COURT_CASE ON CC_COURT_CASE_ID=CCC_COURT_CASE_ID JOIN LEGAL_ACTIVITY ON LA_COURT_CASE_ID=CCC_COURT_CASE_ID FROM CASE_CAS WHERE C_MNG_CNTY_FIPS_CD IN (057,091) AND C_CRNT_STAT_CD='OPN' AND LA_LGL_ACTV_TYPE_CD='SUP' AND LA_STAT_CD='ACT‘ GROUP BY C_CASE_EXTID ,OU_T_ORG_UNIT_NM ,IU_LOGIN_NM Aggregate Results C_CASE_EXTID OU_T_ORG_UNIT_NM IU_LOGIN_NM 0571111111-01 HD2 frey.cyndy 3/29/2011 12:00:00 AM 0571111112-01 CASE MGMT A purwin.angie 3/29/2011 12:00:00 AM 0571111113-01 CASE MGMT C richmond.andrea 3/29/2011 12:00:00 AM 0571111114-01 CASE MGMT A kennard.cindy 3/29/2011 12:00:00 AM 0571111115-01 CASE MGMT B morgan.mechelle 3/29/2011 12:00:00 AM 0571111116-01 CASE MGMT B morgan.mechelle 3/29/2011 12:00:00 AM 0911111111-01 CASE MGMT ramos.sandra 3/29/2011 12:00:00 AM 211111111111111 CASE MGMT A kennard.cindy 3/29/2011 12:00:00 AM 0571111118-01 CASE MGMT A burns.jennifer 3/29/2011 12:00:00 AM Etc. Etc. Etc. Etc. If you need something: SO DOES SOMEBODY ELSE Don’t Reinvent the Wheel ■ We all work in the same system. Chances are if you have a reporting need, so does someone else. ■ It’s quite possible someone has already developed the report you need, or similar! Data Analysis Forum ■ SQL Library ■ Query SQL Library Spreadsheet ■ Request/Submission Forms ■ Data Dictionary ■ Other materials SQL Library ■ DR Submissions list author ■ Purpose ■ Description ■ SQL ■ Customize, and ask for help if needed Query SQL Request Form ■ Submit the form to the Data Analysis Mailbox: DCSSdataanalysis@dcss.ca.gov Other Materials ■ Data Repository reference materials such as the Data Repository Diagram are located under the Other Materials section of the Data Analysis Forum page. If you have a problem: SOMEONE HAS ALREADY FIXED IT Free Resources ■ There are several free resources on the net for learning and troubleshooting SQL ■ The easiest thing to do is simply Google “SQL” ■ There are two main varieties of SQL: ✷ ✷ SQL Server – This is what you want Oracle – slightly different Web Resources ■ W3 Schools SQL Tutorial ■ Coding Horror ■ Microsoft SQL Sever blogs ■ Etc. SQL/Data Repository Tutorial ■ As a companion to this training, a SQL/Data Repository tutorial has been created. ✷ ✷ ✷ The tutorial is designed to start from the most basic level, and progress in complexity using specific examples from the DR. As you progress you will develop an increasingly complex query and learn the different concepts. The end result is a customizable query template that you can employ to develop future queries without reinventing the wheel. Troubleshooting ■ If you have a problem someone else has already solved it! ■ Google is an awesome resource for solving SQL problems. There are many online message boards where people discuss and solve SQL problems. ■ Just Google the what you’re trying to do, plus “SQL” “Google It” ■ If it’s possible, you’ll find it eventually. I get by with a little help from my friends ■ Another great resource, as already discussed is the Data Analysis Forum. ✷ ✷ ✷ If you’re having SQL or Data Repository problems you can email them to DCSSDataAnalysis@dcss.ca.gov The Data Analysis forum farms out questions to LCSA Subject Matter Experts Other counties are willing to help, and may even have already dealt with similar problems/needs. I just don’t have: THE TIME Don’t Start from Scratch ■ Use the Data Repository SQL Library ✷ ✷ If another county has done something similar to what you’re after, it’s pretty easy to modify and tweak to get what you want. If you’re stuck, try to ask the original author for help ■ Save your own queries, and use them as starting points for future queries. Query Template ■ A good place to start is to develop a basic query that returns your caseload. ■ Then as you develop other queries, use the caseload query as a starting point. ■ SQL commenting allows you to inactivate or activate certain portions of code. ■ When you expand your original caseload query, save your additional code, and inactivate it with comment code so that if you need it in the future, all you have to do is reactivate it. Query Template Example ■ Quick example, by using comments you can change the criteria in a query to alter the results. Dashes inactivate code ■ You can do this with single lines or whole sections SQL/Data Repository Tutorial ■ As previously noted, the SQL/Data Repository Tutorial walks you through creating a query that can then be used as a template for future queries. ■ The tutorial also includes tips and tricks for saving time. ANY_QUESTIONS?