source: main/trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/view/Page.xslt @ 18320

Last change on this file since 18320 was 18320, checked in by GarthBraithwaite_STG, 5 years ago

view - json updates to quote all keys. css tweaks, fixed dual IP report data sources.

File size: 16.5 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet version="3.0" 
4        xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" 
5        xmlns:xs  ="http://www.w3.org/2001/XMLSchema"
6        xmlns:ibis="http://www.ibisph.org"
7
8        exclude-result-prefixes="ibis xs xsl"
9>
10        <xsl:import href="../../../../xml/Interactive.xslt"/>
11        <xsl:import href="../../../../json/Dataset.xslt"/>
12        <xsl:import href="../../../../json/Kendo.xslt"/>
13        <xsl:import href="../../../../json/LeafletMap.xslt"/>
14        <xsl:import href="../../../Graphic.xslt"/>
15        <xsl:import href="../Indicator.xslt"/>
16        <xsl:import href="../Page.xslt"/>
17
18
19        <ibis:doc>
20                <name>html/indicator/profile/view/Page</name>
21                <summary>Interactive indicator profile view page</summary>
22                <description>
23                        Specific XSLT used to create the indicator profile view page.
24                </description>
25        </ibis:doc>
26
27
28        <xsl:param name="Page.pageTitle" ibis:doc="Page's title text based on the 'INDICATOR/TITLE' element.">
29                Health Indicator Report - <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
30        </xsl:param>
31        <xsl:param name="Page.sectionsTitle" ibis:doc="Page's content block title text based on the 'INDICATOR/TITLE' element.">
32                Health Indicator Report of <xsl:value-of select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
33        </xsl:param>
34
35        <xsl:param name="Page.comparisonDimensionName"  select="'GeoState'"/>
36        <xsl:param name="Page.comparisonDimensionValue" select="'35'"/>
37
38        <xsl:param name="Page.showMap" ibis:doc="Exposed so that SS can access."
39                select="ibis:Graphic.showMap(
40                        $indicatorView/MAP_NAME,
41                        $indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='category']/NAME,
42                        $indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[USAGE='series']/NAME,
43                        $Indicator.dimensions
44                )"
45        /> 
46        <xsl:param name="Page.showChart" select="ibis:Graphic.showChart($indicatorView/CHART_NAME)"/>
47
48        <xsl:param name="Indicator.contentBlockType" select="'fixed'"/>
49        <xsl:param name="Indicator.contentBlockTitleLevel" select="3"/>
50
51
52        <xsl:template name="Page.sectionsContent" ibis:doc="Main page content template that determines if IP or Surrogate.">
53                <xsl:choose>
54                        <xsl:when test="0 = string-length($indicatorView/SURROGATE_VIEW_URL)">
55                                <xsl:call-template name="Page.interativeContent">
56                                        <xsl:with-param name="indicator"     select="$indicator"/>
57                                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
58                                </xsl:call-template>
59                        </xsl:when>
60                        <xsl:otherwise>
61                                <xsl:call-template name="Page.insertAJAXContent">
62                                        <xsl:with-param name="sourceContentURL" select="$indicatorView/SURROGATE_VIEW_URL"/>
63                                </xsl:call-template>
64                        </xsl:otherwise>
65                </xsl:choose>
66        </xsl:template>
67
68
69        <xsl:template name="Page.interativeContent"
70                ibis:doc="Main interactive sections content template."
71        >
72                <xsl:param name="indicator"/>
73                <xsl:param name="indicatorView"/>
74                <xsl:param name="measure" select="$Indicator.measure"/>
75
76                <xsl:variable name="recordDimensionFields">
77                        <xsl:call-template name="Interactive.getRecordDimensionFields">
78                                <xsl:with-param name="dimensions"      select="$Indicator.dimensions"/>
79                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
80                        </xsl:call-template>
81                </xsl:variable>
82                <xsl:variable name="datasetRecords" select="$indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/RECORDS"/>
83                <xsl:variable name="indicatorViewDatasetRecords">
84                        <xsl:call-template name="Interactive.getIndicatorViewDatasetRecords">
85                                <xsl:with-param name="datasetRecords"  select="$datasetRecords"/>
86                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
87                                <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
88                        </xsl:call-template>
89                </xsl:variable>
90                <xsl:variable name="valueAttributeNames" select="distinct-values($indicatorViewDatasetRecords//VALUE_ATTRIBUTE_NAME)"/>
91
92<style>
93        .Container.Text
94        {
95                background-color: #eee;
96                padding: 0.5em 1.5em 1em 1.5em;
97        }
98        .Graphic.Chart, .Graphic.Map, .Graphic.Grid
99        {
100                margin-top:     1.5em;
101        }
102</style>
103<!--
104                <xsl:call-template name="Indicator.whyImportant"/>
105-->
106                <xsl:if test="$Page.showMap">
107                        <xsl:call-template name="Graphic.mapContainer">
108                                <xsl:with-param name="containerID" select="'map'"/>
109                                <xsl:with-param name="title" select="ibis:getIndicatorViewMapTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
110                                <xsl:with-param name="footerContent" select="$indicatorView/MAP_NARRATIVE"/>
111                        </xsl:call-template>
112                </xsl:if>
113
114                <xsl:if test="$Page.showChart">
115                        <xsl:call-template name="Graphic.chartContainer">
116                                <xsl:with-param name="containerID"   select="'chart'"/>
117                                <xsl:with-param name="footerContent" select="$indicatorView/CHART_NARRATIVE/text()"/>
118                        </xsl:call-template>
119                </xsl:if>
120
121                <xsl:call-template name="Indicator.supplementalImage">
122                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
123                </xsl:call-template>
124
125                <xsl:call-template name="Graphic.gridContainer">
126                        <xsl:with-param name="containerID"   select="'grid'"/>
127                        <xsl:with-param name="valueAttributeNames" select="$valueAttributeNames"/>
128                        <xsl:with-param name="valueAttributes"     select="$Indicator.valueAttributes"/>
129                </xsl:call-template>
130
131                <xsl:call-template name="Indicator.dataNotes">
132                        <xsl:with-param name="title"         select="''"/>
133                        <xsl:with-param name="measure"       select="$measure"/>
134                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
135                </xsl:call-template>
136                <xsl:call-template name="Indicator.dataSources"/>
137                <xsl:call-template name="Indicator.definition"/>
138                <xsl:call-template name="Indicator.howCalculated"/>
139
140                <xsl:call-template name="Indicator.allDates"/>
141
142                <xsl:variable name="ancillaryValueNames" select="distinct-values($indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/ANCILLARY_VALUE_USAGES/ANCILLARY_VALUE_USAGE/NAME)"/>
143                <xsl:variable name="measureValueFormatPattern" select="($Indicator.valueTypes/VALUE_TYPE[NAME = $measure/VALUE_TYPE_NAME]/XSLT_FORMAT_PATTERN)[1]"/>
144                <xsl:call-template name="Graphic.choroplethMapJavaScript"/>
145                <xsl:call-template name="Graphic.leafletKendoScript">
146                        <xsl:with-param name="scriptContainerID"     select="concat($indicatorView/NAME, '_script')"/>
147                        <xsl:with-param name="dimensions"            select="$Indicator.dimensions"/>
148                        <xsl:with-param name="datasetRecords"        select="$indicatorViewDatasetRecords"/>
149                        <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
150                        <xsl:with-param name="recordAncillaryValueFields">
151                                <xsl:call-template name="Interactive.getIndicatorRecordAncillaryValueFields">
152                                        <xsl:with-param name="indicator"     select="$indicator"/>
153                                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
154                                        <xsl:with-param name="ancillaryValueNames" select="$ancillaryValueNames"/>
155                                        <xsl:with-param name="ancillaryValues" select="$Indicator.ancillaryValues"/>
156                                        <xsl:with-param name="valueTypes"      select="$Indicator.valueTypes"/>
157                                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
158                                </xsl:call-template>
159                        </xsl:with-param>
160
161                        <xsl:with-param name="measure" select="$measure"/>
162                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
163
164                        <xsl:with-param name="showMap"        select="$Page.showMap"/>
165                        <xsl:with-param name="mapName"        select="$indicatorView/MAP_NAME"/>
166                        <xsl:with-param name="geoJSONName"    select="$indicatorView/MAP_DIMENSION_NAME"/>
167                        <xsl:with-param name="geoIDFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
168                        <xsl:with-param name="geoIDFieldValuePrefixToRemove" select="concat($indicatorView/MAP_DIMENSION_NAME, '.')"/>
169                        <xsl:with-param name="geoTypeTitle"  select="ibis:getDimensionTitle($indicator//DIMENSIONS/DIMENSION[NAME = $indicatorView/MAP_DIMENSION_NAME])"/>
170                        <xsl:with-param name="mapComparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
171
172                        <xsl:with-param name="showChart"     select="$Page.showChart"/>
173                        <xsl:with-param name="chartName"     select="$indicatorView/CHART_NAME"/>
174                        <xsl:with-param name="chartTitle"    select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
175
176                        <xsl:with-param name="showGrid"      select="true()"/>
177                        <xsl:with-param name="showValueAttributeColumn" select="0 != count($valueAttributeNames)"/>
178                        <xsl:with-param name="showLabelColumn"          select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
179<!-- never show this...
180                        <xsl:with-param name="showNoteColumn"           select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/>
181-->
182
183                        <xsl:with-param name="baseExportFilename" select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
184                </xsl:call-template>
185        </xsl:template>
186
187
188
189
190<!--
191==========================================================================
192==========================================================================
193==========================================================================
194
195
196                                // Hack for vert bar charts to fill the width of the container.
197                                // Kendo charts have an issue filling when the container is hidden.
198                                // For some reason on my system need to wait 2 seconds for it
199                                // to work.
200                                // If set width then it's that size no matter what the window is
201                                // resized to.  Only 100% sure fire way is to have open or fire
202                                // some script when opened.
203//                              setTimeout(resizeKendoChart, 1000);
204                                var chartContainerWidth = $(".ExpandableContent").innerWidth();
205//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
206//                              $("#chart").width = $(".ExpandableContent").innerWidth();
207                                $kendoChart.getKendoChart().resize();
208                        });
209
210                        function resizeKendoChart()
211                        {
212//                              var chartContainerWidth = $(".ExpandableContent").innerWidth();
213//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
214                                $kendoChart.getKendoChart().resize();
215//                              $kendoChart.resize($("#chart"));
216                        };
217
218function myFunction() {
219                                kendoDataSource.read();
220                                $kendoChart.getKendoChart().resize();
221                                $kendoChart.getKendoChart().refresh();
222                                $kendoChart.getKendoChart().redraw();
223                                $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
224}
225
226/*                     
227// none of these have any effect on the chart!!!
228//                              $kendoGrid.getKendoGrid().refresh();
229//                              $kendoChart.width(1000);
230//                              $kendoChart.chartArea.width(1000);
231//                              $kendoChart.getKendoChart().resize();
232//                              $kendoChart.getKendoChart().refresh();
233//                              $kendoChart.getKendoChart().redraw();
234
235$kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
236                                $kendoGrid.getKendoGrid().refresh();
237                                $kendoChart.getKendoChart().redraw();
238*/
239
240/* GARTH TODO:
241$("#grid tr[role='row']").on("mouseenter mouseover", function () {
242        var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered
243        chart.toggleHighlight(true,
244                function(point)
245                {
246                        return point.dataItem.Id === row.rowID;
247                }
248        ); //show the tooltip for the point where the Ids match
249
250
251
252
253GARTH TODO:
254
255// var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0);
256// alert("first slot width" + firstSlot.width());
257
258<xsl:variable name="geoDimensionName" select="
259        if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME))
260        then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME
261        else ($Indicator.dimensions/DIMENSION[
262                        exists(GEOGRAPHY_FLAG)
263                        and
264                        NAME = $indicatorView//DIMENSION_USAGE/NAME
265                ])[1]/NAME"
266/>
267
268<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
269<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
270<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
271<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/>
272<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
273<xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/>
274
275<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
276<xsl:message select="$Page.comparisonDimensionName"/>
277<xsl:message select="$Page.comparisonDimensionValue"/>
278<xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
279
280Stuff to try when doing dashboard
281function dataSource_change(e) {
282  console.log(e);
283}
284kendoDataSource.bind("change", dataSource_change);
285select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
286
287**********************************************
288
289PROBLEM: "CATEGORY":"GeoCnty.4"
290                                                <xsl:with-param name="geoJSONName"      select="$indicatorView/MAP_DIMENSION_NAME"/>
291                                               
292******************
293probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area.
294
295************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1
296
297The IP and QM dimension files are all 1..31
298
299So, need the field name then use the geotype and parse the .XXX from the end.
300Then in the QM will need to build the JSON fields the same way as we do with
301the IP - which is the right way to do it anyway so fields can be combined???
302
303*** also have issues with if 2d and 3d...
304        if mult series then drop down for that.
305        if mult constants then drop down for that as well.
306        when changed regen map.
307        Need to specify the category field name and value
308        Need to specify the series field name and value
309        Need to specify the constant field name and value
310       
311        GeoJSON GeoID Prefix to add when doing comparison???
312
313        <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/>
314        <xsl:variable name="communityDataset"  select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/>
315        <xsl:variable name="stateRecord"       select="$communityDataset/RECORDS/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $stateDimensionName)     and (VALUE = $stateDimensionValue)]     and DIMENSION[(NAME = $periodName) and (VALUE = $periodValue)]]]"/>
316
317
318GARTH TODO:
319        <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
320<xsl:message select="$indicatorViewDatasetRecords[1]"/>
321
322
323
324<xsl:with-param name="dimensionFieldInclusionCriteria">
325records have the field names to filter.
326to include need field name and value.
327
328specifies the records held constant - This is to filter out not matching constant records
329
330for mouse overs, the title needs specifics - dimension title and dimension value title.
331        <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION>
332        <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION>
333</xsl:with-param>
334
335==========================================================================
336<xsl:message select="$indicatorViewDatasetRecords/RECORD"/>
337
338<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
339<xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/>
340<xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
341
342==========================================================================
343==========================================================================
344==========================================================================
345-->
346
347</xsl:stylesheet>
348<!-- ============================= End of File ============================= -->
Note: See TracBrowser for help on using the repository browser.