Test-ParserFunctions-in-ExternalData: Difference between revisions

From sandbox
Jump to navigation Jump to search
(create page)
 
No edit summary
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==TEST==
==Testing combined use of GetExternalData and ParserFunctions extensions==


==Management Organization==
This page was created to test a variety of methods for combining the functionality of the GetExternalData extension with the ParserFunctions extension. Initial attempts to use the two extensions together failed. Though the documentation isn't entirely clear, it appears that since both extensions use the MediaWiki template functionality (using curly braces "{ }" that there is some incompatibility.  
Sandbox is managed by small staff and a larger team of volunteer Managers and Advisors.


===Staff, Volunteer Managers, and Advisers ===
The reason we need to use ParserFunction extension is to allow us to make minor changes of the data imported by GetExternalData. For example, the data contains a column named 'Role' that describes the person's role, whether they are a Manager, Staff, or Advisor. Managers are unpaid volunteers while Staff and Advisers are paid. Using ParserFunction conditionals we can group Staff and Advisers together under the label 'Non Volunteer' while Managers are labelled 'Volunteer'
*'''Staff''' The current Sandbox staff is made up of:
**  One full-time faculty assistant.
** Several part-time student employees.


*'''Volunteer Managers''' are the core of the Sandbox workforce. They assist makerspace visitors with a wide-range of functions. For more information about the roles and responsibilities of managers, [[Manager Responsibilities| click here]]
Another important reason for conditional testing relates to the need to handle a field differently for different rows. For example, not all Managers have created a user page. We don't keep track of this in the spreadsheet. When we create a link to the user page for each Manager, we can test for the existence of that page and not create a link if the page doesn;t exist.  
*'''Advisers''' contribute to the space by leading workshops. For more information about the roles and responsibilities of Advisors, click here


=== Current Roster ===
Testing will continue but for the immediate future, we have found that using the Display_External_Table format option does work. This option requires the creation of a template for each query and the presence of variable names in both the wiki page and the template makes maintenance somewhat confusing.


{{#ifexist: User:Mharrit1 | yes | [[User:{{{WikiUsername}}}]]}}
=== Test Case:  ===
 
Display the current Manager / Staff roster from Google Sheet CSV web feed via the CSV import capability of the GetExternalData extension. Display the Name, email address, Wiki User Name, a link to that person's User page (if it exists), and whether that person is a volunteer or not.
 
Use #ifexist and #ifeq conditionals in the ParserFunctions Extension to "clean up" the import, for example, ensuring that we only show links to a wiki user page if that user page actually exists.
 
 
<!--
==== Test Ifeq & Ifexist Outside ExternalData call, with no variables: ====
 
  Test Ifeq: Result is....  {{#ifeq: Mharrit1 | Mharrit1 | Mharrit1 = Mharrit1 | Mharrit1 != Mharrit1}}
 
  Test IfExist: Result is.... {{#ifexist: User:Mharrit1 | Mharrit1 User Page Exists | No User Page]]}}
 
-->
 
 
GetExternalData provides several ways to display the retrieved data on the wiki page. These are:
 
*Displaying individual values
*Displaying a table of values
# for_external_table
# display_external_table


{{#get_web_data:
{{#get_web_data:
Line 22: Line 40:
}}
}}


{| class="wikitable sortable"
!class=unsortable| Wiki User Page
{{#for_external_table:<nowiki/>
{{!}}-
{{!}}[[User:{{{WikiUsername}}}| {{{WikiUsername}}} Userpage ]]


{{!}} {#ifexist:User:{{{WikiUsername}}} | [[YES User:{{{WikiUsername}}}]]  | [[NO User:{{{WikiUsername}}}]]}
====Use Display External Table ====
}}
 
|}
 


{| class="wikitable sortable"
{| class="wikitable sortable"
! Role  
! Role
! First Name
! First Name
! Last Name
! Last Name
!class=unsortable| Wiki User Page<br> (& Recent Contributions)
!class=unsortable| Wiki User Page
!class=unsortable| Email  
!class=unsortable| Email  
! WikiUsername {{#display_external_table:template=ManagerData|data= Name=Name, Role=Role, Email=Email, WikiUsername=WikiUsername, FirstName=FirstName, LastName=LastName }}
|}
 
ManagerData Template:
{{ManagerData}}
 
==== Try using display_external_table without table markup. ====
 
 
{{#display_external_table:template=ManagerDataNoTable|data= Name=Name, Role=Role, Email=Email, WikiUsername=WikiUsername }}
 
 
{| class="wikitable"
! Name
! Wiki User Page
! Role
! Test
{{#for_external_table:<nowiki/>
{{#for_external_table:<nowiki/>
{{!}}-
{{!}}-
{{!}} {{{Name}}}
{{!}}[[User:{{{WikiUsername}}}| {{{WikiUsername}}} Userpage ]]
{{!}} {{{Role}}}
{{!}} {{{Role}}}
{{!}} {{{FirstName}}}
{{!}} {{#ifexist:User:{{{WikiUsername}}} | YES User:{{{WikiUsername}}} | NO User Page}}
{{!}} {{{LastName}}}
{{!}} [[User:{{{WikiUsername}}} | User Page for {{{WikiUsername}}}]] <br> ([[special:Contributions/{{{WikiUsername}}} | {{{FirstName}}}'s Wiki Contributions ]])
{{!}} [mailto:{{{Email}}} send email ]
}}
}}
|}
|}


====ExternalData without Table====
{{#for_external_table:{{{WikiUsername}}} is {{{Name}}} ["{{{Role}}}" "Staff"]  {{#ifeq: "{{{Role}}}" |  "Staff" | "YES"  | "NO"}} ({{{Role}}}).<p>}}


====ExternalData without wiki table markup====
{{#for_external_table: {{{wikiusername}}}<p>
{{CheckUserPage|1= {{{wikiusername}}} }} <p>
{{ManagerDataNoTable| Name={{{Name}}}|Role={{{Role}}}|email={{{email}}}|wikiusername={{{wikiusername}}}  }} <p> }}


====Use Display External Table ====
{| class="wikitable"
! Name
! Role
! BestEmail
! WikiUsername


{{#display_external_table:template=ManagerData|data=Name=Name, Role=Role, Email=Email, WikiUsername=WikiUsername }}
{{ManagerDataNoTable}}
|}

Latest revision as of 23:30, 24 May 2020

Testing combined use of GetExternalData and ParserFunctions extensions

This page was created to test a variety of methods for combining the functionality of the GetExternalData extension with the ParserFunctions extension. Initial attempts to use the two extensions together failed. Though the documentation isn't entirely clear, it appears that since both extensions use the MediaWiki template functionality (using curly braces "{ }" that there is some incompatibility.

The reason we need to use ParserFunction extension is to allow us to make minor changes of the data imported by GetExternalData. For example, the data contains a column named 'Role' that describes the person's role, whether they are a Manager, Staff, or Advisor. Managers are unpaid volunteers while Staff and Advisers are paid. Using ParserFunction conditionals we can group Staff and Advisers together under the label 'Non Volunteer' while Managers are labelled 'Volunteer'

Another important reason for conditional testing relates to the need to handle a field differently for different rows. For example, not all Managers have created a user page. We don't keep track of this in the spreadsheet. When we create a link to the user page for each Manager, we can test for the existence of that page and not create a link if the page doesn;t exist.

Testing will continue but for the immediate future, we have found that using the Display_External_Table format option does work. This option requires the creation of a template for each query and the presence of variable names in both the wiki page and the template makes maintenance somewhat confusing.


Test Case:

Display the current Manager / Staff roster from Google Sheet CSV web feed via the CSV import capability of the GetExternalData extension. Display the Name, email address, Wiki User Name, a link to that person's User page (if it exists), and whether that person is a volunteer or not.

Use #ifexist and #ifeq conditionals in the ParserFunctions Extension to "clean up" the import, for example, ensuring that we only show links to a wiki user page if that user page actually exists.



GetExternalData provides several ways to display the retrieved data on the wiki page. These are:

  • Displaying individual values
  • Displaying a table of values
  1. for_external_table
  2. display_external_table



Use Display External Table

Role First Name Last Name Wiki User Page Email WikiUsername

ManagerData Template:


|- | {{{Role}}} | {{{FirstName}}} | {{{LastName}}} | User:{{{WikiUsername}}} (Page not created)
([[special:Contributions/{{{WikiUsername}}} | {{{FirstName}}}'s Wiki Contributions]]) | send email

Try using display_external_table without table markup.

Name Wiki User Page Role Test


ExternalData without wiki table markup

{{{Name}}} ({{{Email}}}) is WikiUser {{{WikiUsername}}} ({{{Role}}}) and is not a volunteer User Page Doesn't Exist.