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

Last change on this file since 19916 was 19916, checked in by GarthBraithwaite_STG, 4 years ago

db, view - fixed prev other topic name. Implemented topic ip list. Cleaned up and moved _commity.css to Community. XML services and model map cleanup and better descrips. Removed extra "/" from dynamic IP paths when building filename. Renamed IP page.options to page.contentOptions to be consist.

File size: 18.2 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="../../../DataViz.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.contentTitle" ibis:doc="Page's content block title text based on the 'INDICATOR/TITLE' element.">
32                <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:DataViz.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:DataViz.showChart($indicatorView/CHART_NAME)"/>
47
48        <xsl:param name="Indicator.contentBlockType" select="'fixed'"/>
49
50
51
52        <xsl:template name="Page.contentBody" ibis:doc="Main page content template that determines if IP or Surrogate.">
53
54                <!-- if no external content or external content AND a dest selector then call the default page. -->
55                <xsl:if test="(0 = string-length($indicatorView/EXTERNAL_CONTENT_URL)) or (0 != string-length($indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR))">
56                        <xsl:call-template name="Page.interativeContent">
57                                <xsl:with-param name="indicator"     select="$indicator"/>
58                                <xsl:with-param name="indicatorView" select="$indicatorView"/>
59                        </xsl:call-template>
60                </xsl:if>
61
62                <!-- if external content of any sort e.g. complete replacement or section. -->
63                <xsl:if test="(0 != string-length($indicatorView/EXTERNAL_CONTENT_URL))">
64                        <xsl:call-template name="Page.insertAJAXContent">
65                                <xsl:with-param name="sourceContentURL"            select="$indicatorView/EXTERNAL_CONTENT_URL"/>
66                                <xsl:with-param name="sourceContentJQuerySelector" select="$indicatorView/EXTERNAL_CONTENT_SELECTOR"/>
67                                <xsl:with-param name="destContentJQuerySelector" 
68                                        select="if(0 != string-length($indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR))
69                                                then $indicatorView/EXTERNAL_CONTENT_DEST_SELECTOR
70                                                else 'sectionsContainer'"
71                                />
72                        </xsl:call-template>
73                </xsl:if>
74        </xsl:template>
75
76
77        <xsl:template name="Page.interativeContent"
78                ibis:doc="Main interactive sections content template."
79        >
80                <xsl:param name="indicator"/>
81                <xsl:param name="indicatorView"/>
82                <xsl:param name="measure" select="$Indicator.measure"/>
83
84                <xsl:variable name="recordDimensionFields">
85                        <xsl:call-template name="Interactive.getRecordDimensionFields">
86                                <xsl:with-param name="dimensions"      select="$Indicator.dimensions"/>
87                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
88                        </xsl:call-template>
89                </xsl:variable>
90                <xsl:variable name="datasetRecords" select="$indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/RECORDS"/>
91
92                <xsl:variable name="indicatorViewDatasetRecords">
93                        <xsl:call-template name="Interactive.getIndicatorViewDatasetRecords">
94                                <xsl:with-param name="datasetRecords"  select="$datasetRecords"/>
95                                <xsl:with-param name="dimensionUsages" select="$indicatorView/DIMENSION_USAGES"/>
96                                <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
97                        </xsl:call-template>
98                </xsl:variable>
99                <xsl:variable name="valueAttributeNames" select="distinct-values($indicatorViewDatasetRecords//VALUE_ATTRIBUTE_NAME)"/>
100
101<!--
102<xsl:message select="'INDICATOR VIEW DSR.  IP DS Names, IV DS Names, Count of all possible, count of matched, actual matched DSRs'"/>
103<xsl:message select="$indicator/DATASETS/DATASET/NAME"/>
104<xsl:message select="$indicatorView/DATASET_NAMES/DATASET_NAME"/>
105<xsl:message select="count($datasetRecords/RECORD)"/>
106<xsl:message select="count($indicatorViewDatasetRecords/RECORD)"/>
107<xsl:message select="$indicatorViewDatasetRecords"/>
108
109                <xsl:call-template name="Indicator.whyImportant"/>
110-->
111
112                <xsl:call-template name="Page.contentOptions">
113                        <xsl:with-param name="title">Indicator Report Data View Options</xsl:with-param>
114                        <xsl:with-param name="pageType" select="'view'"/>
115                </xsl:call-template>
116
117                <xsl:if test="$Page.showMap">
118                        <xsl:call-template name="DataViz.mapContainer">
119                                <xsl:with-param name="containerID" select="'map'"/>
120                                <xsl:with-param name="title" select="ibis:getIndicatorViewMapTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
121                                <xsl:with-param name="footerContent" select="$indicatorView/MAP_NARRATIVE"/>
122                        </xsl:call-template>
123                </xsl:if>
124
125                <xsl:if test="$Page.showChart">
126                        <xsl:call-template name="DataViz.chartContainer">
127                                <xsl:with-param name="containerID"   select="'chart'"/>
128                                <xsl:with-param name="footerContent" select="$indicatorView/CHART_NARRATIVE/text()"/>
129                        </xsl:call-template>
130                </xsl:if>
131
132                <xsl:call-template name="Indicator.externalDataViz">
133                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
134                </xsl:call-template>
135
136                <xsl:call-template name="DataViz.gridContainer">
137                        <xsl:with-param name="containerID"   select="'grid'"/>
138                        <xsl:with-param name="valueAttributeNames" select="$valueAttributeNames"/>
139                        <xsl:with-param name="valueAttributes"     select="$Indicator.valueAttributes"/>
140                </xsl:call-template>
141
142                <xsl:call-template name="Indicator.whyImportant"/>
143                <xsl:call-template name="Indicator.definition"/>
144
145                <xsl:call-template name="Indicator.dataNotes">
146                        <xsl:with-param name="title"         select="'Data Notes'"/>
147                        <xsl:with-param name="measure"       select="$measure"/>
148                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
149                </xsl:call-template>
150                <xsl:call-template name="Indicator.dataSources"/>
151                <xsl:call-template name="Indicator.howCalculated"/>
152
153                <xsl:call-template name="Indicator.relatedIndicators"/>
154                <xsl:call-template name="Indicator.relatedQueries"/>
155                <xsl:call-template name="Indicator.relatedTopics"/>
156
157                <xsl:call-template name="Indicator.allDates"/>
158
159                <xsl:variable name="ancillaryValueNames" select="distinct-values($indicator/DATASETS/DATASET[NAME = $indicatorView/DATASET_NAMES/DATASET_NAME]/ANCILLARY_VALUE_USAGES/ANCILLARY_VALUE_USAGE/NAME)"/>
160                <xsl:variable name="measureValueFormatPattern" select="($Indicator.valueTypes/VALUE_TYPE[NAME = $measure/VALUE_TYPE_NAME]/XSLT_FORMAT_PATTERN)[1]"/>
161                <xsl:call-template name="DataViz.choroplethMapJavaScript"/>
162                <xsl:call-template name="DataViz.leafletKendoScript">
163                        <xsl:with-param name="scriptContainerID"     select="concat($indicatorView/NAME, '_script')"/>
164                        <xsl:with-param name="dimensions"            select="$Indicator.dimensions"/>
165                        <xsl:with-param name="datasetRecords"        select="$indicatorViewDatasetRecords"/>
166                        <xsl:with-param name="recordDimensionFields" select="$recordDimensionFields"/>
167                        <xsl:with-param name="recordAncillaryValueFields">
168                                <xsl:call-template name="Interactive.getIndicatorRecordAncillaryValueFields">
169                                        <xsl:with-param name="indicator"     select="$indicator"/>
170                                        <xsl:with-param name="indicatorView" select="$indicatorView"/>
171                                        <xsl:with-param name="ancillaryValueNames" select="$ancillaryValueNames"/>
172                                        <xsl:with-param name="ancillaryValues" select="$Indicator.ancillaryValues"/>
173                                        <xsl:with-param name="valueTypes"      select="$Indicator.valueTypes"/>
174                                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
175                                </xsl:call-template>
176                        </xsl:with-param>
177
178                        <xsl:with-param name="measure" select="$measure"/>
179                        <xsl:with-param name="measureValueFormatPattern" select="$measureValueFormatPattern"/>
180
181                        <xsl:with-param name="showMap"        select="$Page.showMap"/>
182                        <xsl:with-param name="mapName"        select="$indicatorView/MAP_NAME"/>
183                        <xsl:with-param name="geoJSONName"    select="$indicatorView/MAP_DIMENSION_NAME"/>
184                        <xsl:with-param name="geoIDFieldName" select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
185                        <xsl:with-param name="geoIDFieldValuePrefixToRemove" select="concat($indicatorView/MAP_DIMENSION_NAME, '.')"/>
186                        <xsl:with-param name="geoTypeTitle"  select="ibis:getDimensionTitle($indicator//DIMENSIONS/DIMENSION[NAME = $indicatorView/MAP_DIMENSION_NAME])"/>
187                        <xsl:with-param name="mapComparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
188                        <xsl:with-param name="mapDimensionFieldInclusionCriteria">
189                        <xsl:if test="false()">
190                                <DIMENSION>
191                                        <NAME></NAME>
192                                        <VALUE></VALUE>
193                                        <TITLE></TITLE>
194if view map dim name
195maybe simply use the view's first series dim and value and const dim and value???
196constant and series field names and values
197                        select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"
198                                </DIMENSION>
199</xsl:if>
200                        </xsl:with-param>
201
202                        <xsl:with-param name="showChart"     select="$Page.showChart"/>
203                        <xsl:with-param name="chartName"     select="$indicatorView/CHART_NAME"/>
204                        <xsl:with-param name="chartTitle"    select="ibis:getIndicatorViewChartTitle($indicator, $indicatorView, $Indicator.dimensions)"/>
205
206                        <xsl:with-param name="showGrid"      select="true()"/>
207                        <xsl:with-param name="showValueAttributeColumn" select="0 != count($valueAttributeNames)"/>
208                        <xsl:with-param name="showLabelColumn"          select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(LABEL)])"/>
209<!-- never show this...
210                        <xsl:with-param name="showNoteColumn"           select="exists($indicatorViewDatasetRecords/RECORD[0 != string-length(NOTE)])"/>
211-->
212
213                        <xsl:with-param name="baseExportFilename" select="ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $Indicator.dimensions)"/> 
214                </xsl:call-template>
215        </xsl:template>
216
217
218
219
220<!--
221==========================================================================
222==========================================================================
223==========================================================================
224
225
226                                // Hack for vert bar charts to fill the width of the container.
227                                // Kendo charts have an issue filling when the container is hidden.
228                                // For some reason on my system need to wait 2 seconds for it
229                                // to work.
230                                // If set width then it's that size no matter what the window is
231                                // resized to.  Only 100% sure fire way is to have open or fire
232                                // some script when opened.
233//                              setTimeout(resizeKendoChart, 1000);
234                                var chartContainerWidth = $(".ExpandableContent").innerWidth();
235//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
236//                              $("#chart").width = $(".ExpandableContent").innerWidth();
237                                $kendoChart.getKendoChart().resize();
238                        });
239
240                        function resizeKendoChart()
241                        {
242//                              var chartContainerWidth = $(".ExpandableContent").innerWidth();
243//                              $kendoChart.getKendoChart().options.chartArea.width = chartContainerWidth;
244                                $kendoChart.getKendoChart().resize();
245//                              $kendoChart.resize($("#chart"));
246                        };
247
248function myFunction() {
249                                kendoDataSource.read();
250                                $kendoChart.getKendoChart().resize();
251                                $kendoChart.getKendoChart().refresh();
252                                $kendoChart.getKendoChart().redraw();
253                                $kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
254}
255
256/*                     
257// none of these have any effect on the chart!!!
258//                              $kendoGrid.getKendoGrid().refresh();
259//                              $kendoChart.width(1000);
260//                              $kendoChart.chartArea.width(1000);
261//                              $kendoChart.getKendoChart().resize();
262//                              $kendoChart.getKendoChart().refresh();
263//                              $kendoChart.getKendoChart().redraw();
264
265$kendoGrid.getKendoGrid().dataSource.sort({field: "CategorySortOrder", dir: "asc"});
266                                $kendoGrid.getKendoGrid().refresh();
267                                $kendoChart.getKendoChart().redraw();
268*/
269
270/* GARTH TODO:
271$("#grid tr[role='row']").on("mouseenter mouseover", function () {
272        var row = $("#grid").data("kendoGrid").dataItem(this); //get the data item attached to this row being hovered
273        chart.toggleHighlight(true,
274                function(point)
275                {
276                        return point.dataItem.Id === row.rowID;
277                }
278        ); //show the tooltip for the point where the Ids match
279
280
281
282
283GARTH TODO:
284
285// var firstSlot = $kendoChart.getKendoChart()._plotArea.axes[0].getSlot(0);
286// alert("first slot width" + firstSlot.width());
287
288<xsl:variable name="geoDimensionName" select="
289        if(0 != string-length($indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME))
290        then $indicatorView/DEFAULT_GEOGRAPHY_DIM_NAME
291        else ($Indicator.dimensions/DIMENSION[
292                        exists(GEOGRAPHY_FLAG)
293                        and
294                        NAME = $indicatorView//DIMENSION_USAGE/NAME
295                ])[1]/NAME"
296/>
297
298<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
299<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
300<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME])"/>
301<xsl:message select="exists($indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[DIMENSION_NAME = $Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]])"/>
302<xsl:message select="$Indicator.dimensions/DIMENSION[exists(GEOGRAPHY_FLAG)]/NAME"/>
303<xsl:message select="concat('Interactive - Show Map: ', $showMap, ', geoDimensionName:', $geoDimensionName)"/>
304
305<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
306<xsl:message select="$Page.comparisonDimensionName"/>
307<xsl:message select="$Page.comparisonDimensionValue"/>
308<xsl:with-param name="comparisonValue" select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
309
310Stuff to try when doing dashboard
311function dataSource_change(e) {
312  console.log(e);
313}
314kendoDataSource.bind("change", dataSource_change);
315select="$indicatorViewDatasetRecords/RECORD[ DIMENSIONS[ (2 = count(DIMENSION)) and DIMENSION[(NAME = $Page.comparisonDimensionName)     and (VALUE = $Page.comparisonDimensionValue)]]]/MEASURE/VALUE"/>
316
317**********************************************
318
319PROBLEM: "CATEGORY":"GeoCnty.4"
320                                                <xsl:with-param name="geoJSONName"      select="$indicatorView/MAP_DIMENSION_NAME"/>
321                                               
322******************
323probably need to geojson to have the geodim name + . + geodim value to uniquely ID the area.
324
325************ PROBLEM is that the QM only returns 1..31 and not GeoCnty.1
326
327The IP and QM dimension files are all 1..31
328
329So, need the field name then use the geotype and parse the .XXX from the end.
330Then in the QM will need to build the JSON fields the same way as we do with
331the IP - which is the right way to do it anyway so fields can be combined???
332
333*** also have issues with if 2d and 3d...
334        if mult series then drop down for that.
335        if mult constants then drop down for that as well.
336        when changed regen map.
337        Need to specify the category field name and value
338        Need to specify the series field name and value
339        Need to specify the constant field name and value
340       
341        GeoJSON GeoID Prefix to add when doing comparison???
342
343        <xsl:variable name="communityDatasets" select="$indicator/DATASETS/DATASET[DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[not(DIMENSION_2/NAME) and DIMENSION_1/NAME = $communityDimensionName]]"/>
344        <xsl:variable name="communityDataset"  select="$communityDatasets[(MEASURE_NAME = $measureName) and DIMENSION_COMBINATIONS/DIMENSION_COMBINATION[PERIOD_DIMENSION/NAME = $periodName]]"/>
345        <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)]]]"/>
346
347
348GARTH TODO:
349        <xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
350<xsl:message select="$indicatorViewDatasetRecords[1]"/>
351
352
353
354<xsl:with-param name="dimensionFieldInclusionCriteria">
355records have the field names to filter.
356to include need field name and value.
357
358specifies the records held constant - This is to filter out not matching constant records
359
360for mouse overs, the title needs specifics - dimension title and dimension value title.
361        <DIMENSION><NAME>CONSTANT</NAME><VALUE>YearAll.2014</VALUE><TITLE>Year</TITLE><VALUE_TITLE>2014</VALUE_TITLE></DIMENSION>
362        <DIMENSION><NAME>SERIES</NAME><VALUE>Sex.1</VALUE><TITLE>Sex</TITLE><VALUE_TITLE>Male</VALUE_TITLE></DIMENSION>
363</xsl:with-param>
364
365==========================================================================
366<xsl:message select="$indicatorViewDatasetRecords/RECORD"/>
367
368<xsl:message select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX interact.xslt'"/>
369<xsl:message select="$indicatorView/MAP_DIMENSION_NAME"/>
370<xsl:message select="$recordDimensionFields/RECORD_DIMENSION_FIELD[DIMENSION_NAMES/DIMENSION_NAME = $indicatorView/MAP_DIMENSION_NAME]/NAME"/> 
371
372==========================================================================
373==========================================================================
374==========================================================================
375-->
376
377</xsl:stylesheet>
378<!-- ============================= End of File ============================= -->
Note: See TracBrowser for help on using the repository browser.