Using Crystal Reports and SQL to Create a Custom Report to Help

Total Page:16

File Type:pdf, Size:1020Kb

Using Crystal Reports and SQL to Create a Custom Report to Help Using Crystal Reports and SQL to Create a Custom Report to Help Close the Care Gaps in Your Practice Steve King North Country HealthCare October 2019 Three Objectives: 1. Learn how to upload a report to Centricity, how to use parameters, and how to use formulas 2. Learn how to use SQL Server Management Studio to explore the data in Centricity 3. Create a report that can close the gaps of care in your practice 1. Mammogram 2. Expand to Diabetes • Session is for Beginner to Immediate Report creators • Assumes you are a CPS 12.X user • And you use clinical content, not CCC • Bonus Content SDID is a filed that is used to link DOCUMENT (where all EHR transactions start) to the various medical tables in the EHR (e.g. PROBLEM, ORDERS, OBS, ALLERGY, MEDICATE) Translating a EHR timestamp date to a normal date: DATEADD(ss, DOCUMENT.CLINICALDATE / 1000000, ‘01/01/1960’) SQL Keywords used in this presentation NULL: there is no value. It is neither true or false, doesn’t have a value. To do a comparison, must use <variable> IS [NOT] NULL, not an equality statement: (this is wrong) <variable> = NULL GETDATE():returns the current date/time ISNULL(var1, var2): If var1 IS NULL, use var2. Also see COALESCE JOIN – join 2 tables or datasets together About me Steve King, North Country HealthCare [email protected] Employed at North Country for over 9 years North Country has 14 access points throughout northern Arizona and parts of central Arizona Main campus is in Flagstaff, AZ 55,000 patients a year 160,000 visits 80 providers Tools to Develop Reports For Centricity Crystal Reports XI I don’t know how to acquire – your VAR should be able to help Crystal Report can be integrated differently in Centricity – this session uses Crystal Reports as a stand-alone application Microsoft SQL Server Management Studio Free with your version of SQL Server Centricity Data Dictionary Download from aethenahealth web site Crystal Report: Objectives 1. Using Parameters 2. Adding parameters to a SQL query 3. Creating formulas to show parameters in Centricity 4. Toggling the footer Upload a Crystal Report Into Centricity The Main Report Parameters in Centricity, Parameters and Formulas in Crystal Reports A footer that toggles visibility Crystal Report: Parameters Because these parameters are used to build formulas in Crystal Report, the Crystal Report data type may not be the same if this was a stand-alone report 1. STARTDATE and ENDATE– although they will be a date in Centricity, for the report they are strings 2. FACILITY and PROVIDER – although these will be used in Centricity as number, for the report they are strings 3. HIDE_FOOTER: used as a number in both Crystal Reports and Centricity Crystal Report: Formulas Formulas are used to 1. Display information 2. Change information 3. Store information For this report we are only displaying the data in the parameters FACILITY_CRITERIA and PROVIDER_CRITERIA Used to show the facility and the provider 1. Because this report requires to choose a facility this formula is different than one that allows the user to choose one or more facilities 'Facility: ' + {?FACILITY} Formulas to show all facilities or selected facilities/providers or selected providers If {?FACILITY} = 'NULL' THEN If {?Provider} = 'NULL' THEN "Facilities: all" “Providers: all" ELSE ELSE "Facilities: " & {?FACILITY} “Providers: " & {?Provider} DATE_CRITERIA Because we force the user to enter dates, we know that there will be a start date and end date "Dates from " & {?STARTDATE} & " to " & {?ENDDATE} Toggle a Report Section in Crystal Reports In Crystal Reports Create a parameter named HIDE_FOOTER Field type: number In the Report footer enter the text you want to show In Section Expert make sure Suppress (No Drill-Down is unchecked and enter this formula: {?HIDE_FOTTER}=1 This can be done for any section you want to hide Report Design Mode Toggle between design mode and report mode Centricity: Parameters To transfer parameters values from Centricity to Crystal Report, usually use text The are different ways use parameters from Centricity to the SQL query Select Boxes: ?CONTROLNAME.ITEMDATA.U? or ?CONTROLNAME.ITEMDATA? “U” shows actual numbers No “U” shows numbers as quoted string Dates To And FROM: ?CONTROLNAME.DATE1? or ?CONTROLNAME.DATE2? Check boxes and radio buttons: ?CONTROLNAME.VALUE? Centricity: Parameters As a Filter in a Query This will let you filter on None, One, or Multiple Providers AND ( (?PROVIDER.ITEMDATA? IS NOT NULL AND a.DoctorID IN (?PROVIDER.ITEMDATA.U?)) OR (?PROVIDER.ITEMDATA? IS NULL) ) Note the use or non-use of “U” AND ( ('2972' IS NOT NULL AND a.DoctorID IN (2972)) OR ('2972' IS NULL) ) Centricity and Crystal Reports: Tying the Parameters Together If {?Provider} = 'NULL' THEN “Providers: all" ELSE “Providers: " & {?Provider} Centricity and Report Dates If your report is date sensitive, always require dates You can use a default statement ISNULL(<entered date>,’01/01/1900’), but then you run the chance of getting too much data We’ve been on Centricity for 10 years – do I really want 10 years of data for an appointment report? RAISERROR You can use a RAISERROR statement if your user enters a wrong date SQL keyword that raises an error, causing the query to stop Centricity has no way to capture the error You get an ID Dispatch error Full use of the keyword is outside of this discussion IF @StartDate <= '12/31/2018' RAISERROR ('StartDate is too small', 16, 1) Centricity SQL Preview Button Lets you see the SQL in the report Don’t Forget to Assign Security! Right click on the Report Assign by Group, not by User Always uncheck the Delete Column Checking Edit will allow user/group to save criteria report Carefully think about allowing that – otherwise your report folders will get cluttered. Exploring Data in Your Database OBSTERMs OBSTERMs (or Observation Terms) are what determines what is shown in the Flowsheet The actual observation lives in the table OBS, or in the view RPTOBS Key fields are OBSDATE, OBSVALUE, PID, and XID OBSHEAD is a table that contains observation codes and descriptions for OBSTERM Key fields are HDID, NAME, and DESCRIPTION OBSTERMs to Close a Gap: Mammogram Three ways to determine if a mammogram was performed: 1. OBSTERMS 2. ICD-10 Codes 3. CPT Codes What to use depends on your clinical workflow – for this example we’re using OBSTERM How to Find The OBSTERM: Clinical Content Find forms where the OBSTERM might be used Start a visit with the form End the visit Click “View Clinical Content” How to Find The OBSTERM: Export a Clinical Kit • Administration > System > Export Clinical Kits > Form Component will bring up the Search Screen • Then click Export Clinical Kit, and save it to your computer Clinical Kit: Includes a Lot of Files • The Microsoft Excel Template file has the OBSTERMS by NAME used in the form • Excel will complain when you open the file – just answer yes • You’ll have to do some detective work to find the possible OBSTERM you’re looking for [This is from the XLT file] /*Function for RUNPROCESS Button Record Mammogram*/ fn fn1151_1503350234_635(){ if (PATIENT._AGEINMONTHS >= 480 and PATIENT._AGEINMONTHS < 600) then fnRecObs_CSF(DOCUMENT.RESULTMAM_1151_1503350234_633,DOCUMENT.DATEMAM_1151_1503350234_634,"MAMMOGRAM","MAMMO DUE",731) else fnRecObs_CSF(DOCUMENT.RESULTMAM_1151_1503350234_633,DOCUMENT.DATEMAM_1151_1503350234_634,"MAMMOGRAM","MAMMO DUE",365) endif View Clinical Content is a lot easier! Finding the OBSTERM HDID OBSHEAD is a table that stores all the OBSTERMs OBSHEAD.NAME is the field that was returned when you clicked View Clinical Content OBSHEAD.HDID is the field that identifies the OBSTERM in OBS To get OBSHEAD.HDID for MAMMOGRAM run a query on OBSHEAD OR do a Join (Shown on next slide) Verifying Your OBSTERM is Being Used SET NOCOUNT ON SET NOCOUNT ON OBS is the actual Table; SELECT SELECT RPTOBS is a view COUNT(*) COUNT(*) AS [Count] , oh.Name , oh.Name , oh.Description , oh.Description FROM OBS o FROM RPTOBS o JOIN OBSHEAD oh ON o.HDID = oh.HDID JOIN OBSHEAD oh ON o.HDID = oh.HDID WHERE (oh.Name = 'MAMMOGRAM') WHERE o.HDID = 71 GROUP BY GROUP BY oh.Name oh.Name , oh.Description , oh.Description That’s a lot of mammograms – Guess we have the correct OBSTERM Verifying Your OBSTERM is Being Used Correctly SET NOCOUNT ON DECLARE @StartDate datetime = '08/01/2019' , @EndDate datetime = '08/31/2019' DECLARE @Lookback date = DATEADD(mm, -14, @EndDate) /* 15 months from end of measurement period. Zero month counts as a month */ SELECT DISTINCT o.OBSVALUE FROM OBS o WHERE (o.HDID = 71) AND (o.OBSDATE >= @Lookback AND o.OBSDATE < DATEADD(d, 1, @EndDate)) Hmm, some of those values don’t look valid Verifying the Correct OBSVALUE Work with your clinical team Some of the results are obviously not valid: Declines Assessment Incomplete After talking to the clinical team, results that are either Normal, Abnormal, or contain the phrase BIRAD are valid mammograms The OBSVALUE is not case sensitive How to Return the Correct OBSVALUE? Hold that thought! Will explain when we look at the report query! Developing a Care Gap Report Thinking ahead… Looking for appointments Looking for patients that meet the denominator for the gaps we are trying to close Numerator include an observation during a measurement period – but do we need to look outside the measurement period? Denominators usually only include medical visits Looking for patients that DON’T meet the numerator for the gaps we are trying to close There could be a lot of appointments, which can impact the performance of Centricity Limit the time of day when the report is ran? Limit the data that is being returned? Understanding the Requirements: What is a Medical Visit? Can use document type (EHR) or CPT code Internally, we decided to use CPT codes Document types are too “fuzzy”, i.e.
Recommended publications
  • Create a Program Which Will Accept the Price of a Number of Items. • You Must State the Number of Items in the Basket
    PROBLEM: Create a program which will accept the price of a number of items. • You must state the number of items in the basket. • The program will then accept the unit price and the quantity for each item. • It must then calculate the item prices and the total price. • The program must also calculate and add a 5% tax. • If the total price exceeds $450, a discount of $15 is given to the customer; else he/she pays the full amount. • Display the total price, tax, discounted total if applicable, as well as the total number of items bought. • A thank you message must appear at the bottom. SOLUTION First establish your inputs and your outputs, and then develop your IPO chart. Remember: this phase is called - Analysis Of The Problem. So what are your inputs & output? : Variable names: Number of items (input & output) Num (Assume there are 4 items) Unit price of each item (input) Price1, Price2, Price3, Price4 Quantity of each item (Input) Quan1, Quan2, Quan3, Quan4 Total price (output) TotPrice Tax amount (output) Tax Discounted total price (output) DiscTotPrice In your IPO chart, you will describe the logical steps to move from your inputs to your outputs. INPUT PROCESSING OUTPUT Price1, Price2, 1. Get the number of items TotPrice, Tax, Price3, Price4, 2. Get the price and quantity of the each item DiscTaxedTotal, Num 3. Calculate a sub-total for each item TaxedTotal Quan1, Quan2, 4. Calculate the overall total Num Quan3, Quan4 5. Calculate the tax payable {5% of total} 6. If TaxedTotal > 450 then Apply discount {Total minus 15} Display: TotPrice, Tax, DiscTaxedTotal, TaxedTotal, Num Else TaxedTotal is paid Display: TotPrice, Tax, TaxedTotal, Num Note that there are some variables that are neither input nor output.
    [Show full text]
  • Database Concepts 7Th Edition
    Database Concepts 7th Edition David M. Kroenke • David J. Auer Online Appendix E SQL Views, SQL/PSM and Importing Data Database Concepts SQL Views, SQL/PSM and Importing Data Appendix E All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Appendix E — 10 9 8 7 6 5 4 3 2 1 E-2 Database Concepts SQL Views, SQL/PSM and Importing Data Appendix E Appendix Objectives • To understand the reasons for using SQL views • To use SQL statements to create and query SQL views • To understand SQL/Persistent Stored Modules (SQL/PSM) • To create and use SQL user-defined functions • To import Microsoft Excel worksheet data into a database What is the Purpose of this Appendix? In Chapter 3, we discussed SQL in depth. We discussed two basic categories of SQL statements: data definition language (DDL) statements, which are used for creating tables, relationships, and other structures, and data manipulation language (DML) statements, which are used for querying and modifying data. In this appendix, which should be studied immediately after Chapter 3, we: • Describe and illustrate SQL views, which extend the DML capabilities of SQL. • Describe and illustrate SQL Persistent Stored Modules (SQL/PSM), and create user-defined functions. • Describe and use DBMS data import techniques to import Microsoft Excel worksheet data into a database. E-3 Database Concepts SQL Views, SQL/PSM and Importing Data Appendix E Creating SQL Views An SQL view is a virtual table that is constructed from other tables or views.
    [Show full text]
  • How to Get Data from Oracle to Postgresql and Vice Versa Who We Are
    How to get data from Oracle to PostgreSQL and vice versa Who we are The Company > Founded in 2010 > More than 70 specialists > Specialized in the Middleware Infrastructure > The invisible part of IT > Customers in Switzerland and all over Europe Our Offer > Consulting > Service Level Agreements (SLA) > Trainings > License Management How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 2 About me Daniel Westermann Principal Consultant Open Infrastructure Technology Leader +41 79 927 24 46 daniel.westermann[at]dbi-services.com @westermanndanie Daniel Westermann How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 3 How to get data from Oracle to PostgreSQL and vice versa Before we start We have a PostgreSQL user group in Switzerland! > https://www.swisspug.org Consider supporting us! How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 4 How to get data from Oracle to PostgreSQL and vice versa Before we start We have a PostgreSQL meetup group in Switzerland! > https://www.meetup.com/Switzerland-PostgreSQL-User-Group/ Consider joining us! How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 5 Agenda 1.Past, present and future 2.SQL/MED 3.Foreign data wrappers 4.Demo 5.Conclusion How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 6 Disclaimer This session is not about logical replication! If you are looking for this: > Data Replicator from DBPLUS > https://blog.dbi-services.com/real-time-replication-from-oracle-to-postgresql-using-data-replicator-from-dbplus/
    [Show full text]
  • Handling Missing Values in the SQL Procedure
    Handling Missing Values in the SQL Procedure Danbo Yi, Abt Associates Inc., Cambridge, MA Lei Zhang, Domain Solutions Corp., Cambridge, MA non-missing numeric values. A missing ABSTRACT character value is expressed and treated as a string of blanks. Missing character values PROC SQL as a powerful database are always same no matter whether it is management tool provides many features expressed as one blank, or more than one available in the DATA steps and the blanks. Obviously, missing character values MEANS, TRANSPOSE, PRINT and SORT are not the smallest strings. procedures. If properly used, PROC SQL often results in concise solutions to data In SAS system, the way missing Date and manipulations and queries. PROC SQL DateTime values are expressed and treated follows most of the guidelines set by the is similar to missing numeric values. American National Standards Institute (ANSI) in its implementation of SQL. This paper will cover following topics. However, it is not fully compliant with the 1. Missing Values and Expression current ANSI Standard for SQL, especially · Logic Expression for the missing values. PROC SQL uses · Arithmetic Expression SAS System convention to express and · String Expression handle the missing values, which is 2. Missing Values and Predicates significantly different from many ANSI- · IS NULL /IS MISSING compatible SQL databases such as Oracle, · [NOT] LIKE Sybase. In this paper, we summarize the · ALL, ANY, and SOME ways the PROC SQL handles the missing · [NOT] EXISTS values in a variety of situations. Topics 3. Missing Values and JOINs include missing values in the logic, · Inner Join arithmetic and string expression, missing · Left/Right Join values in the SQL predicates such as LIKE, · Full Join ANY, ALL, JOINs, missing values in the 4.
    [Show full text]
  • Firebird 3 Windowing Functions
    Firebird 3 Windowing Functions Firebird 3 Windowing Functions Author: Philippe Makowski IBPhoenix Email: pmakowski@ibphoenix Licence: Public Documentation License Date: 2011-11-22 Philippe Makowski - IBPhoenix - 2011-11-22 Firebird 3 Windowing Functions What are Windowing Functions? • Similar to classical aggregates but does more! • Provides access to set of rows from the current row • Introduced SQL:2003 and more detail in SQL:2008 • Supported by PostgreSQL, Oracle, SQL Server, Sybase and DB2 • Used in OLAP mainly but also useful in OLTP • Analysis and reporting by rankings, cumulative aggregates Philippe Makowski - IBPhoenix - 2011-11-22 Firebird 3 Windowing Functions Windowed Table Functions • Windowed table function • operates on a window of a table • returns a value for every row in that window • the value is calculated by taking into consideration values from the set of rows in that window • 8 new windowed table functions • In addition, old aggregate functions can also be used as windowed table functions • Allows calculation of moving and cumulative aggregate values. Philippe Makowski - IBPhoenix - 2011-11-22 Firebird 3 Windowing Functions A Window • Represents set of rows that is used to compute additionnal attributes • Based on three main concepts • partition • specified by PARTITION BY clause in OVER() • Allows to subdivide the table, much like GROUP BY clause • Without a PARTITION BY clause, the whole table is in a single partition • order • defines an order with a partition • may contain multiple order items • Each item includes
    [Show full text]
  • Using the Set Operators Questions
    UUSSIINNGG TTHHEE SSEETT OOPPEERRAATTOORRSS QQUUEESSTTIIOONNSS http://www.tutorialspoint.com/sql_certificate/using_the_set_operators_questions.htm Copyright © tutorialspoint.com 1.Which SET operator does the following figure indicate? A. UNION B. UNION ALL C. INTERSECT D. MINUS Answer: A. Set operators are used to combine the results of two ormore SELECT statements.Valid set operators in Oracle 11g are UNION, UNION ALL, INTERSECT, and MINUS. When used with two SELECT statements, the UNION set operator returns the results of both queries.However,if there are any duplicates, they are removed, and the duplicated record is listed only once.To include duplicates in the results,use the UNION ALL set operator.INTERSECT lists only records that are returned by both queries; the MINUS set operator removes the second query's results from the output if they are also found in the first query's results. INTERSECT and MINUS set operations produce unduplicated results. 2.Which SET operator does the following figure indicate? A. UNION B. UNION ALL C. INTERSECT D. MINUS Answer: B. UNION ALL Returns the combined rows from two queries without sorting or removing duplicates. sql_certificate 3.Which SET operator does the following figure indicate? A. UNION B. UNION ALL C. INTERSECT D. MINUS Answer: C. INTERSECT Returns only the rows that occur in both queries' result sets, sorting them and removing duplicates. 4.Which SET operator does the following figure indicate? A. UNION B. UNION ALL C. INTERSECT D. MINUS Answer: D. MINUS Returns only the rows in the first result set that do not appear in the second result set, sorting them and removing duplicates.
    [Show full text]
  • Constructing Algorithms and Pseudocoding This Document Was Originally Developed by Professor John P
    Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo Purpose: # Describe the method for constructing algorithms. # Describe an informal language for writing PSEUDOCODE. # Provide you with sample algorithms. Constructing Algorithms 1) Understand the problem A common mistake is to start writing an algorithm before the problem to be solved is fully understood. Among other things, understanding the problem involves knowing the answers to the following questions. a) What is the input list, i.e. what information will be required by the algorithm? b) What is the desired output or result? c) What are the initial conditions? 2) Devise a Plan The first step in devising a plan is to solve the problem yourself. Arm yourself with paper and pencil and try to determine precisely what steps are used when you solve the problem "by hand". Force yourself to perform the task slowly and methodically -- think about <<what>> you are doing. Do not use your own memory -- introduce variables when you need to remember information used by the algorithm. Using the information gleaned from solving the problem by hand, devise an explicit step-by-step method of solving the problem. These steps can be written down in an informal outline form -- it is not necessary at this point to use pseudo-code. 3) Refine the Plan and Translate into Pseudo-Code The plan devised in step 2) needs to be translated into pseudo-code. This refinement may be trivial or it may take several "passes". 4) Test the Design Using appropriate test data, test the algorithm by going through it step by step.
    [Show full text]
  • Introduction to Computer Science CSCI 109
    Introduction to Computer Science CSCI 109 China – Tianhe-2 Readings Andrew Goodney Fall 2019 St. Amant, Ch. 5 Lecture 7: Compilers and Programming 10/14, 2019 Reminders u Quiz 3 today – at the end u Midterm 10/28 u HW #2 due tomorrow u HW #3 not out until next week 1 Where are we? 2 Side Note u Two things funny/note worthy about this cartoon u #1 is COBOL (we’ll talk about that later) u #2 is ?? 3 “Y2k Bug” u Y2K bug?? u In the 1970’s-1980’s how to store a date? u Use MM/DD/YY v More efficient – every byte counts (especially then) u What is/was the issue? u What was the assumption here? v “No way my COBOL program will still be in use 25+ years from now” u Wrong! 4 Agenda u What is a program u Brief History of High-Level Languages u Very Brief Introduction to Compilers u ”Robot Example” u Quiz 6 What is a Program? u A set of instructions expressed in a language the computer can understand (and therefore execute) u Algorithm: abstract (usually expressed ‘loosely’ e.g., in english or a kind of programming pidgin) u Program: concrete (expressed in a computer language with precise syntax) v Why does it need to be precise? 8 Programming in Machine Language is Hard u CPU performs fetch-decode-execute cycle millions of time a second u Each time, one instruction is fetched, decoded and executed u Each instruction is very simple (e.g., move item from memory to register, add contents of two registers, etc.) u To write a sophisticated program as a sequence of these simple instructions is very difficult (impossible) for humans 9 Machine Language Example
    [Show full text]
  • Novice Programmer = (Sourcecode) (Pseudocode) Algorithm
    Journal of Computer Science Original Research Paper Novice Programmer = (Sourcecode) (Pseudocode) Algorithm 1Budi Yulianto, 2Harjanto Prabowo, 3Raymond Kosala and 4Manik Hapsara 1Computer Science Department, School of Computer Science, Bina Nusantara University, Jakarta, Indonesia 11480 2Management Department, BINUS Business School Undergraduate Program, Bina Nusantara University, Jakarta, Indonesia 11480 3Computer Science Department, Faculty of Computing and Media, Bina Nusantara University, Jakarta, Indonesia 11480 4Computer Science Department, BINUS Graduate Program - Doctor of Computer Science, Bina Nusantara University, Jakarta, Indonesia 11480 Article history Abstract: Difficulties in learning programming often hinder new students Received: 7-11-2017 as novice programmers. One of the difficulties is to transform algorithm in Revised: 14-01-2018 mind into syntactical solution (sourcecode). This study proposes an Accepted: 9-04-2018 application to help students in transform their algorithm (logic) into sourcecode. The proposed application can be used to write down students’ Corresponding Author: Budi Yulianto algorithm (logic) as block of pseudocode and then transform it into selected Computer Science Department, programming language sourcecode. Students can learn and modify the School of Computer Science, sourcecode and then try to execute it (learning by doing). Proposed Bina Nusantara University, application can improve 17% score and 14% passing rate of novice Jakarta, Indonesia 11480 programmers (new students) in learning programming. Email: [email protected] Keywords: Algorithm, Pseudocode, Novice Programmer, Programming Language Introduction students in some universities that are new to programming and have not mastered it. In addition, Programming language is a language used by some universities (especially in rural areas or with programmers to write commands (syntax and semantics) limited budget) do not have tools that can help their new that can be understood by a computer to create a students in learning programming (Yulianto et al ., 2016b).
    [Show full text]
  • Does Surprisal Predict Code Comprehension Difficulty?
    Does Surprisal Predict Code Comprehension Difficulty? Casey Casalnuovo ([email protected]), Prem Devanbu ([email protected]) Department of Computer Science, University of California, Davis One Shields Avenue, Davis, CA 95616 USA Emily Morgan ([email protected]) Department of Linguistics, University of California, Davis One Shields Avenue, Davis, CA 95616 USA Abstract Appreciation of the similarities and differences between natural and programming languages has led to the adoption Recognition of the similarities between programming and nat- ural languages has led to a boom in the adoption of language of computational language models for code. Language mod- modeling techniques in tools that assist developers. However, els operate by learning probability distributions over text, and language model surprisal, which guides the training and eval- key to training these models is the notion of surprisal. The uation in many of these methods, has not been validated as surprisal of a token is its negative log probability in context as a measure of cognitive difficulty for programming language 1 comprehension as it has for natural language. We perform a captured by the language model . Programming language is controlled experiment to evaluate human comprehension on more repetitive and has lower surprisal than natural language, fragments of source code that are meaning-equivalent but with different surprisal. We find that more surprising versions of i.e. language models find code more predictable than natural code take humans longer to finish answering correctly. We language (Hindle et al., 2012). Moreover, this finding holds also provide practical guidelines to design future studies for across many natural and programming languages, and some code comprehension and surprisal.
    [Show full text]
  • On the Logic of SQL Nulls
    On the Logic of SQL Nulls Enrico Franconi and Sergio Tessaris Free University of Bozen-Bolzano, Italy lastname @inf.unibz.it Abstract The logic of nulls in databases has been subject of invest- igation since their introduction in Codd's Relational Model, which is the foundation of the SQL standard. In the logic based approaches to modelling relational databases proposed so far, nulls are considered as representing unknown values. Such existential semantics fails to capture the behaviour of the SQL standard. We show that, according to Codd's Relational Model, a SQL null value represents a non-existing value; as a consequence no indeterminacy is introduced by SQL null values. In this paper we introduce an extension of first-order logic accounting for predicates with missing arguments. We show that the domain inde- pendent fragment of this logic is equivalent to Codd's relational algebra with SQL nulls. Moreover, we prove a faithful encoding of the logic into standard first-order logic, so that we can employ classical deduction ma- chinery. 1 Relational Databases and SQL Null Values Consider a database instance with null values over the relational schema fR=2g, and a SQL query asking for the tuples in R being equal to themselves: 1 2 1 | 2 SELECT * FROM R ---+--- R : a b WHERE R.1 = R.1 AND R.2 = R.2 ; ) a | b b N (1 row) Figure 1. In SQL, the query above returns the table R if and only if the table R does not have any null value, otherwise it returns just the tuples not containing a null value, i.e., in this case only the first tuple ha; bi.
    [Show full text]
  • SQL Procedures, Triggers, and Functions on IBM DB2 for I
    Front cover SQL Procedures, Triggers, and Functions on IBM DB2 for i Jim Bainbridge Hernando Bedoya Rob Bestgen Mike Cain Dan Cruikshank Jim Denton Doug Mack Tom Mckinley Simona Pacchiarini Redbooks International Technical Support Organization SQL Procedures, Triggers, and Functions on IBM DB2 for i April 2016 SG24-8326-00 Note: Before using this information and the product it supports, read the information in “Notices” on page ix. First Edition (April 2016) This edition applies to Version 7, Release 2, of IBM i (product number 5770-SS1). © Copyright International Business Machines Corporation 2016. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Notices . ix Trademarks . .x IBM Redbooks promotions . xi Preface . xiii Authors. xiii Now you can become a published author, too! . xvi Comments welcome. xvi Stay connected to IBM Redbooks . xvi Chapter 1. Introduction to data-centric programming. 1 1.1 Data-centric programming. 2 1.2 Database engineering . 2 Chapter 2. Introduction to SQL Persistent Stored Module . 5 2.1 Introduction . 6 2.2 System requirements and planning. 6 2.3 Structure of an SQL PSM program . 7 2.4 SQL control statements. 8 2.4.1 Assignment statement . 8 2.4.2 Conditional control . 11 2.4.3 Iterative control . 15 2.4.4 Calling procedures . 18 2.4.5 Compound SQL statement . 19 2.5 Dynamic SQL in PSM . 22 2.5.1 DECLARE CURSOR, PREPARE, and OPEN . 23 2.5.2 PREPARE then EXECUTE. 26 2.5.3 EXECUTE IMMEDIATE statement .
    [Show full text]