Report Models

advertisement
DR Reporting Made Easy
with SQL Server BI Tools
MUSE International Tuesday Workshop – Session 805
June 2, 2010, 1:00P – 3:30P
Glen D’Abate & Jamie McDonald
Introductions

Instructors

Acmeware

Course Participants
Course Overview
Objective
The objective of this workshop is to provide an overview and
demonstration of SQL Server 2005’s Business Intelligence
capabilities, specifically with Report Models and the Report Builder
tools. We will construct SSRS Report Models and that allow nontechnical staff to dynamically develop ad-hoc MEDITECH reports
using the SSRS Report Builder application.
Workshop Overview


Overview of DR reporting strategies in context of Report
Builder
Identification of DR data and strategies for extracting to a
Report Model datamart

SSRS Report Model Projects

Creating Data Source Views

Creating Report Models

Using Report Builder to access Report Model, reporting basics
and saved reports

Filtering and grouping

Formatting and developing a tabular report

Advanced filters, creating formulas, and Help

Matrix and graph reports (time permitting)
Glossary of Terms

MEDITECH Application database –

Data Repository (DR) –

SQL Server Databases (livedb, testdb, livefocdb, testfocdb) –
Proprietary database structures (NPR
or Advanced Technology - AT) in which MEDITECH applications directly file data
Replications of data from Application Database into
an open (ODBC or OLE DB) accessible SQL Server RDMS
DR databases in which application data (test or live, NPR or AT) is stored

SQL Server Reporting Services (SSRS) –

Datamart –
Feature of SQL Server RDMS
that allows reports to be designed, developed and deployed for consumption
Extraction, transformation, filtering, and indexing of data into
structures specifically formatted for construction of Report Models

SSRS Report Manager –

SSRS Report Models –
Data structure on which the Report Builder tool runs

SSRS Report Builder –
Tool for non-technical staff to develop ad hoc reports
Web based application for hosting and managing
reports. Also the application from which the Report Builder tool is launched.
Course Format

Modular sections




Lecture on topic with slide presentation
Provide example demonstration building Report Models
and reports as we go
Each section builds on previous section
We encourage interactive discussion throughout!
Review of Alternative DR Report
Development Options

Microsoft Access 2007

Crystal Reports 2008

SQL T-SQL Downloads to .CSV Files

SQL Server Analysis Services (OLAP Cubes)


SQL Service Reporting Services (SSRS) Report Models and
Report Builder
SSRS – Report Server Projects (i.e., full use of Visual Studio
Tools for SSRS Report Development
Flexibility / Complexity Trade-off
Too Hot!
SSAS is easiest to use. Drag &
Drop, Slice & Dice. Only provides
numeric analysis. Difficult to
develop & modify data.
Report Builder allows non-technical users to build
Just Right! and format custom ad-hoc reports. Report
developers need not understand data relationships.
Requires IT to build Report Models which limit
available data columns. Complex data analysis /
manipulation is not possible.
Too Cold!
Report Projects require programmer-level technical
skill set to develop reports. Uses Visual Studio
programmer environment for report development.
Most flexibility in report design and can link to
complex T-SQL statements for reports requiring data
manipulation and analysis.
Report Model / Designer Approach
PROs

Allows reports to be dynamically generated by “end-users.” No need
to come to IT for “one more column” on a report

Web-based reports can be nicely designed and formatted

Report Models can be indexed for excellent performance

Report Manager provides secure access to report execution

No software to load / support on developer’s systems
CONs



Requires technical staff to develop and maintain underlying SSRS
Report Models
Another copy of data (in application db, in DR, now in Report Model
datamart)
Cannot address more complex reports (e.g., reports that require
multiple passes at HCIS data to produce result set of interest)
Where Are Reports Developed?
Web Server Hosting SSRS
Report Manager
Launches Report Builder
application. Can open
existing reports or build
new reports from scratch.
Quick Demo of Report Builder UI
Uses “Registration” Report Model
Entities generated from Report Model
Entities are constructed from one or more table in the
data mart via a data source view (.dsv)
Column data available in each entity
Identification of DR
Data & Strategies for
Extracting to a
Datamart
Step by Step Recipe to Report Builder






Identify data-of-interest for end users (typically within one
or a few MEDITECH applications).
Develop data access strategy. We typically recommend
scheduled extraction to a datamart but it is possible to build
Report Model Views directly against the DR using SQL
Tables or SQL Views.
Construct helpful data transformations in datamart extract
logic (e.g., convert text Lab Results values to numeric fields,
convert CDS Response to Datetime datatype, etc.).
Build SSRS Report Views using Datamart tables. This reestablishes “relationships” implicit in the NPR or AT data
structures.
Build SSRS Report Models using Report Views. Internal
fields can be hidden, other fields identified for filter
selection.
Deploy Report Models and Train end user on Report Builder
application.
DR has 6000+ Tables
as well as two Live
Databases in 6.0 +
Identifying the appropriate source of specific application
data from within the DR is one of the most challenging
aspects of any report development using the DR
Data is highly de-normalized in the DR. “Name” in the
AdmVisits table is very different than “Name” in DLabTest
table, and very different than “Name” in MriPatients table.
Many factors determine what data to include in
datamart including focus of Report Model,
inclusion of Inpatients and/or Outpatients,
length of history required and more.
Issues Addressed in SQL Datamart Extract





Multiple related DR tables have data combined
into a single table (e.g., visit level admission and
abstracting data combined)
Default values can be entered where NULL data
(e.g., replaced with “N/A”)
Text values, common in MEDITECH fields are
converted to move useful data types (e.g.,
Numeric Response to SQL Numeric datatype)
Data can be filtered to a smaller set than in the
DR (do you really need the ND test results from
1998?)
Data can be filtered to meet reporting criteria
(e.g., remove confidential patients)
Example of Registration Data Extract
Internal ID fields are not for Report
Builder but used in Report Views
Typical data fields available in Report Model
DR Fields modified to better format
New Age field computed for Report Model
Inpatient or Outpatient Locations
recombined to one field
Visit Provider Type data flattened
for ease-of-use in Model
Data Extract
DR Table
Consolidation
Optional data (using
LEFT JOINs) is included
in Registration Data
Model when available.
Data from many tables in
the DR are combined to
a single table “entity” to
be used in the Report
View and Report Model.
Example of identifying only the
most current entry associated
with a patient visit
Data Extract using Incremental Data
Cancelled Admissions or other filtering
(e.g., remove confidential patients) can
be include in datamart extract
The DR table column RowUpdateDateTime
can be used to identify “changes” to data
for incremental updates
Primary Key Fields and Their Function
Example Datamart Tables
SourceID omitted for sites with
single SourceID throughout DR
There may be multiple AllergyID
entries for any given VisitID
Building Datamart a Indexes
Restricting the volume of data and
highly indexing data, especially at
the Report View highest aggregate
level (i.e., typically visit for
MEDITECH application data) is
highly effective at making report
output very responsive
Datamart for Training Course
Customer Defined Screen queries
and responses (includes multiples)
and time dated repeat results
ADM registration data as well as
some ABS data
Charge, receipt, adjustment, refunds
and other transaction level details
Visit level financial (B/AR) data
ITS Report summary information
(though no text reports yet)
ITS Order details
Laboratory Specimen Tests & Results
Patient Allergy information including
free text descriptions
Creating SSRS Report
Model Projects
What is a Report Model Project



In order to build a Report Model, you need to create
a Report Model Project using Visual Studio 2005 (or
2008)
A Report Model Project contains the components or
objects that are used to build and deploy Report
Models to the Report Manager web site
A Report Model Project is comprised of one or more
Data Source (.ds) files, one or more Data Source
View (.dsv) files, and one or more Report Model file
(.smdl) files
Creating a New BI Report Model Project
OLAP Cubes
What we are working
with today
Give a meaningful Report Model name
Report Server Projects use the
capabilities of the full Visual Studio
IDE for Report Development
Add to existing Solution or Create a new Solution container
Visual Studio IDE
Report Model
Tree View
Output
Messages
Report Model
Detail View
Solutions
Explorer
Properties
Solution Explorer
Solution is simply a
container in which
Projects are loaded
Data Sources
Project contains the
objects (i.e., code)
that comprise the
Report Models
Data Source Views
Data Models
Establishing a Data Source for the
Report Model lets it know where
to go to find data on upon which
Reports will be built
Data Source Designer
DR Server
Select
Datamart database or DR livedb
Establishing a Data Source for the Report
Model lets it know where to go to find
data on upon which reports (using Report
Builder) will be built
Project Properties
Web server
Project Properties
determine where the
Report Models will be
deployed (must be a web
server where the Report
Manager application is
installed)
Creating Data
Source Views
Data Source View Features





A Data Source View is a description of components of
the database to which the Data Source is pointing
This Data Source View describes the selected DR
tables, their contents, and the relationships between
them
Table in a Data Source View MUST have primary keys
defined explicitly to determine uniqueness of records
in the table
Table relationships established in the Data Source
View are critical to the correct output being generated
in Report Builder developed reports
Typically, defined relationships reconstruct the data
relationships that exist in the MEDITECH applications
Adding or Importing a .dsv File
Acmeware typically has a Development
project and a Production project
Add a New or Existing Data Source View
New Data Source View
launches wizard
Allows an existing .dsv file to be
copied into project (e.g., copying
a development .dsv to production)
DSV Wizard – Identify a .ds file
We choose a single .ds file
that points to our datamart
First, the Data Source View must identify one or
more Data Sources (.ds) files to be used to
identify data to be accumulated in the .dsv file
Default .dsv Relationship
Our datamart replicates the
structures in the DR which
lack FK constraints
Selecting this option usually selects the
correct columns but inevitably the
defined relationship will need to be
modified after completing the wizard
While adding foreign key constrains to our datamarts would be ideal, in
practice, this is very difficult since MEDITECH does not ensure the
sequence in which data hits the DR (and therefore the potential order in
which it hits our datamarts). For example, it is technically possible for a
new Lab Test Print # to appear in a patient result before the corresponding
Lab Test Dictionary receives an entry for the Print #.
Select Datamart Tables in a .dsv
The Census data is used in
multiple different .dsv files
One patient visit may have
multiple allergy entries.
One allergy entry may have
many lines of allergy text.
Name the .dsv
Meaningful name to identify .dsv
file when building Report Models
View Default Relationships Are Wrong
Default relationship created by wizard
is often incorrect in the context of
MEDITECH DR (and corresponding
datamart) schema design
Arrows must point from
summary table to detail table
All three keys are required to
identify a unique record in this
table. This is not typical to a
relational database schema.
Relationships Must Be Modified
Summary level data is the “Source”,
Detail level data is the “Destination”
The labels do not seem to make sense
but his configuration has been tested
and appears to be what is required
MEDITECH Schema Often Requires
Multiple Column Relationships
Where two columns are required to uniquely identify the
summary (parent) table records, then both must be included
when defining a relationship to the detail (child) table
Design View of Registration .dsv
Child
Parent
Child
Parent
Child
Enter Friendly Name Property
Properties for selected object
(Registration Data table/entity)
Modifying the FriendlyName Property will default
to the Entity Name in the Report Builder
Creating Report
Models
Report Model Features







A Report Model (.smdl file) provides metadata (data about data)
for the data being referenced by the Data Source View.
When the Report Model file is generated, entities, roles, and fields
are automatically created
Typically, these entities and fields relate back to the datamart
columns and their data within the database
Field properties are automatically generated based on the
system’s analysis of the data in a .dsv field
A Report Model Design wizard steps through each option and
setting required to build a .smdl file from a .dsv file
After running the Report Model Design wizard, the model can be
published to the report catalog, assigned the appropriate role
permissions, and then used in Report Builder
To make it even easier for users to create reports using this
model, it can be further refined after the wizard is completed
Adding a New Report Model
Like .dsv files, Report Models
(.smdl) files can be created as
new its using a wizard or can be
imported as existing Items
We recommend having a Production Project to
which .dsv and .smdl files are only copied (i.e.,
never modify in PROD). If Data Source Name is
the same in DEV and PROD, no changes are
necessary when importing to PROD.
Report Models are Generated for a
Single Data Source View (.dsv) File
A single .dsv file is used by a
single Report Model (.smdl file)
Report Model Generation Options
We have primarily
taken the default
generation rules
Report Model Statistics
Recompile statistics if the .dsv
changed in any way. I typically
always choose the “Update
model statistics” option.
Naming a Report Model
Use a meaningful name as this will be
seen in the Report Builder tool
Do not publish a new model with the same name
because you will invalidate existing reports that
are generated against this model. If you do
create a new model with the same name and try
to publish the model, you will see an error
message. Always work on the same model to
ensure that the IDs remain the same.
Modifying Report Model Properties
Roles can be given
a friendly name
Internal fields should be hidden
This property determines how a
column will be treated when a
filter is applied in Report Builder
Building & Deploying Report Models
A Solution, one or more Projects,
or one or more Report Models
may be built or deployed
Build and deployment Status
Viewing Report Models in Report Manager
Report Models can bee seen in
Report Manager with
appropriate security settings
Launch Report Builder to
develop ad hoc reports using the
Report Models we have created
Report Models in Report Builder
Models available in Report Builder IDE
Reporting Basics and
Saved Reports
Reporting Basics



Report builder is great for simple reports
You’ll need folder organization for security and saving
reports
Fields (data) are dragged onto the table section (you can
also double click) of the report if the field is to be
displayed in the output

Data types can have a big impact on your output

Filtered data need not be displayed in a report




New calculated fields can be created and included in a
report
Fields that are grouped or sorted must be added to the
table section of a report
Whether fields are added one at a time, or as a group
effects that grouping of data in a report
Understanding the data hierarchy of the data models is
critical to designing a report in Report Builder
Navigating to the Report Builder
Launch Report Builder Application
Additional folders can be created here
to save reports developed within the
Report builder
The first time you launch this
application, you will be prompted
to run it
Report Builder Opening Page
Opening Select
Models
Data Model and
Report Layout for a new
report.
Open from Report Server
Open from a File
Loading a Report from a File
Reports are stored as readable XML
files with an extension of *.RDL.
New Table Report
Entities available in chosen Model
Default TB for Report Header
Report Field Table
By default, special TB for
Total Rows and Filter appear
Data fields available to use for
reporting from selected entity
Adding Text Fields to a Report
Drag and drop all fields to table area
Note Grouping Tab
Header defaults
Use <Ctrl> or <Shift> to select
multiple fields at once
Filter Dialogue Box
Define filters
for Report
These fields have various
options that we will show
in the demo
Drag fields (or double
click) to apply filters
* Advanced filter options
discussed later in the presentation
Define Formula Dialogue box – Custom/Calculated Fields
Icon opens the Define formula box for
Custom fields or Custom Field Filters
Field Types
The Field Data Type has
a big influence on
behavior of the field in
the Report Field Table
Sorting Options
Note sorts are defined
by the grouping
Page Setup Options
Default margins
(typically minimum if
report is to be printed)
Max of 84” for Web, but
11 or 17 for printing
Good for alignment,
but better to modify
for crowded reports
Reporting Basics and Saved
Reports
Demo nstration
Filters and Groups
Filtering Result Data






Report Builder provides a Filter Building Dialog Box
that simplifies the construction of report filters
Filtering result data allows a report to contain only
data of interest
Reports can filter on data that is not displayed in the
output
Filters can be on field data as well as computed
fields
Filters can be statically entered in the report design
or dynamically collected through prompts during
report execution
Filter groups are available for sets of ‘OR’
statements
Launching the Filter Dialogue Box
Launch filter dialogue box
Filter Entities
Filters
Filtering “Where” Dropdown Box
Some Report Models fields
provide a unique list of
available entries in a given field
Removing a Filter Condition
Removing Filter condition (right mouse
click to bring up context menu)
Filtering using Dates
Using a fixed from/thru date range
From / Through Dates
Date control is used both when creating
a Filter and when executing reports
Multiple Filters
When adding an OR option, a new Filter
Group is created with the “Any of” option
Filtering with Relative Dates
Date Filters can also be entered as Relative
Dates (there are many useful options)
Query ID List Dialogue
1400 Available QueryIDs
Selecting a single QueryID
from the available data
Grouping Concepts





Grouping make sense in the context of the hierarchical
relationships that exist in MEDITECH data and are
translated to the Report Models
Whenever a “one-to-many” relationship exists, Grouping
on the “one” field and aggregating the “many” field is
possible
You use Grouping whenever you describe a report
specification using the keyword “By”
Grouping can occur on Formula fields as well as Entity
fields
Grouping in the Report Builder requires paying very close
attention to Tabbed Label above the Table. When fields
share a Tab, they are at the same hierarchical level (e.g.,
Account Number, Admit Date, Admit Provider, Count of
Orders)
Example 1 – Grouping on Attending Provider
Note the name of the tab ‘Attending
Provider Name’ – this is important to
your output
The name of the tab indicates the field that
the data will be grouped on
Count of
Patients is a
calculated field
that we will
cover in the
next section
Example 1 - Output and Sorting
Sorting is set by the available tabs and
fields in the report
The two options here are Attending
Provider and Count of Patient
Example 2 – Adds Financial ClassID as
a New Group
Financial ClassID is dropped to the left
of the current tab/table to create a new
group. The summary is now by Provider
and by Financial Class indicated by the
grouping and Total Rows.
Example 2 – Output to include FinClassID
Totals are now grouped
by Financial Class ID and
then Attending Provider
Example 2 – Sorting Options
First choose the group and then
the available fields within the
group
Sorting is not limited to three
fields – new selection boxes are
created as necessary
Example 3 – Grouping on Account Number
and Procedure
Procedure Grouping – Procedure
Description is brought over first
then the aggregate fields are
added to the right
Account Number Grouping – Account Number is
selected from another Entity and brought over to the
left of the current tab
Example 3 - Output
Note Procedures
totals – the
grouped tab
determined this
display
We have totals by Procedure by
Account Number
Filtering and Grouping
Demo nstration
Formatting and
Creating a Tabular
Report
Creating a Census Report
Drag over all four fields at
one time by highlighting with
the <Ctrl> key. Note tab
name.
Adding Textbox and Image
Uploaded image
New Textbox added to report header
Removing a Column
Right mouse click on tab allows you
to delete all columns in that group
Right mouse click on a field brings up context menu
Adding Date Field Types
Date / Time fields also are grouped by in the
Report Model with the listed detail options
Fields from Multiple Entities
This Report includes both patient
registration and financial data
Added Total Balance from
Financial Data Entity – under
Registration Data Tab
Formatting Text Fields
Textbox or Text field
Format option dialogue
boxes
Formatting Date/Time Fields
Many Date & Time format
options are available by default
Custom formats can be created (help
documentation gives examples)
Formatting Numeric Fields
Numeric formatting
Option to show numeric
field sub-totals
Formatting and Creating a
Tabular Report
Demo nstration
Advanced Filters,
Creating Custom
Fields, and How to Get
Help
Advanced Filter Options
Prompts

Prompts are used to allow flexibility in reports

Prompts let the same report answer many different questions

Prompts can filter output and provide default values for input


Prompt data can be used to filter but are NOT treated like other
field objects for the purpose of grouping, sorting, etc.
Often times, dictionary tables values are used for prompt
dropdown lists (IDs are used for multiple lists and do not function
well with prompts)
Group Filters

Group filters are used for large OR statements
Custom Filters

Custom fields can be created to be used as a filter

Sometimes custom fields are needed to be available for a prompt
Example 1 – Systolic BP over 180
Right click on field for
options above
“From and To” standard option is
not available as a prompt therefore
custom fields are needed
Example 1 – Systolic BP over 180
Query is setup as a list in the Report
Model and is not available to set as a
prompt. These types can only be
hardcoded.
Example 1 – Systolic BP over 180
Date Range Prompts
Multiple Filters and Relative date options
You can
default values
with a prompt
When adding an OR option, a new Filter
Group is created with the “Any of” option
Lab Result with Abnormal Flag Filter
Fields built as a
dropdown create a
combo box when
set as a prompt and
“in a list” is set.
Lab Results for In and Outpatients with Abnormal Flags
Dropdown list
with (Select All)
option
Prompt values allow you
to save reports that are
run outside the Report
Builder environment
User-Defined Formula Fields





Formulas allow you to combine, aggregate, filter, and
evaluate both numeric and text data. You can create
formulas and save them as new fields.
All formulas are defined within the context of an entity.
This means that the formula returns a single value for
each item within the entity. For example, suppose you
create a formula within the Registration entity. The
formula returns a single value for each Visit
(Registration).
A formula can contain any or all of the following: user
created fields, functions, operators, and constants.
You will need to create fields for specific types of
information such as the count of records or the count of
any item. This is not something that can be prepopulated.
From and through date ranges will need to be created if
you want to set those values as a prompt.
Date Functions – LOS Computation
Creating a new user defined field within a entity
Inpatients with >= 365 Days LOS
Example to compute the actual LOS
based on Admit and Discharge Dates
User created fields show up at the top of the entity
field list with the appropriate field data type icon
Formula Dialogue – Date/Time Function
Formula Builder
Dialogue Box
Formula Builder provides a brief
description of what should go in
each function parameter
Date Function “DateDiff( )” is used to
compute a number of increments
between two dates. In this case, the
increment is days.
LOS Formula used in Filter
Note DateDiff( ) function
returns numeric field type
Inpatients with >= 365 Days LOS
User-defined fields can be used in
the Filter dialogue box very much
like Report Model entity fields
Text Function – Extract Last Name
Multiple user-defined fields
Text Function – Doc Last Name Only
Formulas to Extract Last Name
Comma position is the numeric location
of the comma in the ProviderName field
The CommaPosition user-defined field is now
used within the formula to extract the Attending
Provider’s last name using the Text LEFT( )
Provider Last Name Output
Text Function – Doc Last Name Only
This works for Provider Names with a comma
Condition Functions – Switch Fx( )
Switch Function is essentially an IF /
THEN / ELSE conditional function
Switch Function to Grade A1c Results
This report example uses the Switch function to
categorize A1C Lab Test results into three
buckets (1, 2, or 3) based on the result value
Conditional Switch Function
IF function is a simplified
version of Switch with only one
Boolean expression allowed
Must use Lab Test NumericResult
for numeric comparison
The Switch function has parameters: Boolean
expression, value, Boolean expression, value,
Boolean expression, value… The first value after
the first “true” Boolean expression is returned.
A1c Lab Test Result Graded Output
Switch Function to Grade A1c Results
Graded A1C Result Output
Math Fx( ) – Balance Computation
Use arithmetic operators to compute a patient
balance and compare to the MEDITECH Balance field
Math Function – Computed Balance
Balance can be computed from an Account’s Total
Charges, Receipts, Adjustments and Refunds
Balance Expression Computations
First we created a user-defined field for
the total of receipts and adjustments
Then we created the Computed
Balance user-defined field
subtracting the Adjust/Receipts
field from the Charge Total
Patient Balance Integrity Output
Math Function – Computed Balance
Data integrity looks perfect for this slice of
patient financial data in report model
Advanced Filters and Custom
Fields
Demo nstration
Help / Report Builder Help
Help is an excellent resource;
using Google to look up error
messages or other Report
Builder issues is also useful.
Help / About Report Builder
Shows Current Version which is
useful when reviewing Microsoft (or
Google identified) documentation
Matrix and Graph
Reports
An Empty New Matrix Table
Matrix Table Report
Matrix tables are like pivot tables
they display data in a three
dimensional view
The data you want
displayed in the first
column (typically the field
with the most values
Total values you want to
display – more than one is
possible but too much can
get confusing.
Columns – typically you don’t
want too many to make your
chart easy to read
Matrix Report Results
Total Columns:
1 = January
2 = February
Filtering and ordering
of the Rows and
Columns will make a
big difference in the
legibility of your
report – it can easily
get too big
Chart Example – Allergies by Severity and Service by Month
Moving the legend at the
bottom of the chart makes a
better fit on one sheet of paper
Chart Example – Allergies by Severity and Service by Month
Count of Allergies by patient
Drag over the three data fields
you want to graph. Select
chart type and define
properties.
Chart formatting options
Chart options give you control
over many options for
formatting
You can select the Chart Type
from the standard Microsoft
chart formats.
Discussion, Questions & Answers
Thank You!

Other Acmeware Sessions





805 DR Reporting Made Easy with SQL Server BI
Tools – Tuesday 1:00pm (Jamie McDonald)
385 Digital Dashboards and Data Repository Thursday 10:00am (Ian Proffer)
382 Report Development in a MEDITECH 6.0+
Environment – Thursday 1:30pm (Glen D’Abate)
384 Security Audits using DR and SQL Tools–
Friday 9:30am (Jamie McDonald)
383 SQL Server Upgrade Issues and Version
Questions for DR – Friday 3:30pm (Ian Proffer)
Download