Preload data with nested and multiple values: Difference between revisions

From Visual Data Wiki
Jump to navigation Jump to search
(VisualData update)
(VisualData update)
 
(12 intermediate revisions by the same user not shown)
Line 56: Line 56:
|preload-data?belongs to = {{PAGEID}}
|preload-data?belongs to = {{PAGEID}}
}}
}}
[{{canonicalurl:Help:Available_data_classes}} See Available data classes]
[{{canonicalurl:Help:Available_data_classes}} See available class sets]




Line 63: Line 63:
{{#visualdataform: Page classes
{{#visualdataform: Page classes
|title = Add class sets to page
|title = Add class sets to page
|action = create
|action = edit
|edit-page = {{FULLPAGENAME}}
|return-page = {{FULLPAGENAME}}
|return-page = {{FULLPAGENAME}}
|view = popup
|view = popup
|popup-size = larger
|popup-size = larger
|css-class =  
|css-class =  
|pagename-formula = <unique title>
|edit-freetext = false
|edit-freetext = false
|edit-categories = false
|edit-categories = false
Line 74: Line 74:
|edit-target-slot = false
|edit-target-slot = false
|layout-align = top
|layout-align = top
|popup-help = true
}}
}}


Line 107: Line 106:
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
}}
}}
<div><small>{{#advancedlink:{{{pagetitle}}}?slot=jsondata|JSON data}}</small></div>
{{#if:{{#visualdataquery:[[belongs to::{{PAGEID}}]]|?belongs to|schema = Dataset|format = raw}}||
<div class="webmo-float-button webmo-float-button-edit">
{{#visualdataform: Indicator key data, Page classes
|title = {{int:webmo-select-data-classes}}
|action = edit
|edit-page = {{{pagetitle}}}
|return-page = {{FULLPAGENAME}}
|view = popup
|popup-size = larger
|css-class =
|edit-freetext = false
|edit-categories = false
|edit-content-model = false
|edit-target-slot = false
|layout-align = top
|popup-help = true
|submit-button-text =
|layout =
|submit-button-text =
|validate-button-text =
|selected-schema = Page classes
}}</div>
<div class="webmo-add-button webmo-add-classes">
{{#visualdataform: Data classes
|title = {{int:webmo-create-data-classes}}
|action = create
|edit-page =
|return-page = {{FULLPAGENAME}}
|view = popup
|popup-size = larger
|css-class = form-classes
|pagename-formula = <unique title>
|edit-freetext = false
|edit-categories = false
|edit-content-model = false
|edit-target-slot = false
|target-slot = main
|default-categories = classes
|default-content-model = json
|layout-align = top
|popup-help = true
|submit-button-text =
|layout =
|submit-button-text =
|validate-button-text =
}}
[{{canonicalurl:Help:Available_data_classes}} See Available data classes]</div>
}}<!-- end if -->
<div class="card webmo-dataset-table">
{{#invoke: Indicator_datasets_table
|generateTable
|dateFormat = {{#time: xg }}
|articleids = {{#visualdataquery:[[belongs to::{{PAGEID}}]]|?articleid|schema = Dataset|format = template|template = Webmo comma separartor}}
|entity = {{#visualdataprint:[[articleid::{{PAGEID}}]]|?entity|schema = Page classes|format = raw}}
}}
</div>
<!-- {{#visualdataquery:[[belongs to::{{PAGEID}}]]
|?articleid
|schema = Dataset
}}
-->
<!--
{{#visualdataquery:[[belongs to::{{PAGEID}}]]
|?date
|?dataset type
|?classes/class name
|?classes/sub-classes/sub-class name
|?classes/sub-classes/sub-sub-classes/sub-sub-class name
|?classes/sub-classes/sub-sub-classes/value
|schema = Dataset
|format = template
|template = Webmo datasets table
|template?classes = Webmo datasets table classes
|template?classes/sub-classes = Webmo datasets table sub-classes
|template?classes/sub-classes/sub-sub-classes = Webmo datasets table sub-sub-classes
}}
-->
<!--<div class="webmo-add-button webmo-add-dataset">
{{#visualdataform: Dataset 1
|title = {{int:webmo-add-dataset}} 1
|action = create
|edit-page =
|return-page = {{FULLPAGENAME}}
|view = popup
|popup-size = full
|css-class = form-dataset
|pagename-formula = <unique title>
|edit-freetext = false
|edit-categories = false
|edit-content-model = false
|edit-target-slot = false
|target-slot = main
|preload-data?belongs to = {{PAGEID}}
|preload-data?classes/$/class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|default-categories =
|default-content-model = json
|layout-align = top
|popup-help = true
|submit-button-text =
|layout =
|submit-button-text =
|validate-button-text =
}}
</div>
<div class="webmo-add-button webmo-add-dataset">
{{#visualdataform: Dataset 2
|title = {{int:webmo-add-dataset}} 2
|action = create
|edit-page =
|return-page = {{FULLPAGENAME}}
|view = popup
|popup-size = full
|css-class = form-dataset
|pagename-formula = <unique title>
|edit-freetext = false
|edit-categories = false
|edit-content-model = false
|edit-target-slot = false
|target-slot = main
|preload-data?belongs to = {{PAGEID}}
|preload-data?classes/$/class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|default-categories =
|default-content-model = json
|layout-align = top
|popup-help = true
|submit-button-text =
|layout =
|submit-button-text =
|validate-button-text =
}}
</div>-->
<div class="webmo-add-button webmo-add-dataset">
{{#visualdataform: Dataset
|title = {{int:webmo-add-dataset}}
|action = create
|edit-page =
|return-page = {{FULLPAGENAME}}
|view = popup
|popup-size = full
|css-class = form-dataset
|pagename-formula = <unique title>
|edit-freetext = false
|edit-categories = false
|edit-content-model = false
|edit-target-slot = false
|target-slot = main
|preload-data?belongs to = {{PAGEID}}
|preload-data?classes/$/class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|default-categories =
|default-content-model = json
|layout-align = top
|popup-help = true
|submit-button-text =
|layout =
|submit-button-text =
|validate-button-text =
}}
</div>
jsondata
Line 2: Line 2:
     "schemas": {
     "schemas": {
         "Page classes": {
         "Page classes": {
             "classes": "535",
             "classes": "594",
             "sub-classes": "535",
             "add sub-classes": "true",
            "sub-classes": "596",
            "add sub-sub-classes": "true",
             "sub-sub-classes": "535"
             "sub-sub-classes": "535"
         }
         }
     }
     }
}
}

Latest revision as of 06:30, 16 May 2024

Syntax[edit | edit source]

This example shows a concept, how to handle the VisualData form parameter 'preload-data' with nested and multiple values. This makes it possible to generate dynamical forms, e.g. to collect data differentiated by district, gender and age categories:

...
|preload-data?classes/$/class name = District 1@@@@District 2@@@@District 3
|preload-data?classes/$/sub-classes/$/sub-class name = female@@@@male@@@@diverse
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = 0 - 14@@@@15 - 29@@@@30 - 44@@@@45 - 59@@@@60 +
...

Notice the placeholder $ and the value separator @@@@. The value separator can be set in VisualData queries, see below.

Required json-diff library is not installed. Run composer in the extension folder to enable preload-data
form is loading...

See corresponding form Data Classes

(For styling see MediaWiki:Common.css)

Workflow example[edit | edit source]

Step 1: Define one or more statistical class sets[edit | edit source]

Required json-diff library is not installed. Run composer in the extension folder to enable preload-data
form is loading...

See available class sets


Step 2: Attach class sets to this page[edit | edit source]

form is loading...


Step 3: Add datasets to this page[edit | edit source]

...
|preload-data?classes/$/class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
...
Required json-diff library is not installed. Run composer in the extension folder to enable preload-data
form is loading...