Friday, May 3, 2024

Lloyd's Name Identifier Helper App for the EQ Web Sort Tool

Although the name of this blog is Learning LiveCode, this project has all been about relearning LiveCode. I didn't learn anything new with LiveCode in this project, but I found myself having to remember or relearn things I had previously learned.

The main programming task here is very straightforward... look for a string of text, then search for another string that relates to the first and display the results. LiveCode easily handles this type of list processing. Once that was accomplished, I added a few other functions that also needed some relearning.

Why the Need for a Helper App?

Ok, so what was this project all about? I have been studying, teaching, and using a research approach called Q methodology for about 13 years. I've written in previous posts about an app I built called Lloyd's Q Sort Tool (click here for a list of project posts). My app works great, but it must be downloaded and installed on a Macintosh or Windows computer. This is no problem when I use Q in my teaching because I ask students to download and install the app at the beginning of the term so we can use it throughout the course. However, for a typical Q research project each participant does one and only one Q sort. They don't want to download and install anything. Instead, they just want a Web link where they can go and complete the Q sort online. As it turns out, I've been doing more and more of these "one and done" Q projects lately. As a result, I've begun using a wonderful web-based Q sort tool created by Shawn Banasick called EQ Web Sort Tool. It's a marvelous tool with an outstanding design and I've been encouraging my students to check it out. The data are stored in a JSON file on a Google Firebase database. I then import the JSON file in a specialized statistical software package for analyzing the Q sort data that Shawn also built called Ken-Q (the version I use is the desktop edition called KADE). The data are factor analyzed to produce clusters of Q sorts that are related (correlated) in some way. 

Here is a part of a JSON file containing the data for a single person. I've highlighted two text strings in green. The second is obviously my name. The first is just part of a random code assigned to my data. (I've also highlighted a string of numbers in yellow for reasons I will explain below.) The task I need LiveCode task to do is find the random code and then return the real name associated with it:

"-NvrE75qmAgUnhCDock-": {
    "column4_1": "no response",
    "column4_2": "no response",
    "columnN4_1": "no response",
    "columnN4_2": "no response",
    "dateTime": "19/4/2024 @ 12:14:31",
    "nneg": 9,
    "nneu": 9,
    "npos": 15,
    "partId": "Lloyd Rieber",
    "projectName": "Faculty Viewpoints of WEIT Strategic Planning",
    "randomId": "faadcd78-29e",
    "sort": "-1|1|-4|-1|2|2|1|0|0|4|-4|-3|-2|3|-2|0|2|0|0|-1|-1|-1|1|-3|-2|1|4|2|3|-2|1|3|-3",
    "timeLanding": "00:00:07",
    "timePostsort": "00:00:24",
    "timePresort": "00:04:45",
    "timeSort": "00:22:18",
    "urlUsercode": "not_set"
  },

Ken-Q produces an Excel file that includes a factor loadings chart that shows the random code, but not the individual's name. However, when I'm analyzing the data I need to know the name of the person associated with the Q sort. Ok, no big deal, all I need to do is manually scan the JSON file to find the name of the person that matches the random code. I can then add a column to include the person's name, as shown here:


(And yes, I'm often mistaken for a cartoon character.)

This plan works fine when I'm back in my office after collecting the data and I have plenty of time to do this work. However, I've been using Q sorts in faculty workshops. This means I'm analyzing the data while the faculty are on a short break. After the break, I use the results to design a faculty discussion based on the results. So, I need to associate the name with the code very quickly with 100% accuracy. I don't know about you, but I don't always work well under pressure. 

So, how does my app help? I paste the JSON file into one field and the list of identifying codes from Ken-Q in another field. I click a button and the app finds the corresponding name. Total time, including the time it takes to copy and paste, is about 60 seconds with accuracy guaranteed. Here's a screenshot:



A Couple of More Features

After I conduct the workshop, I sometimes find that a person wants to have a copy of their responses to the Q sort. Although that data is included in the JSON file, it is not in a form that is easily interpreted. That's the string of numbers I've highlighted in yellow above. Each number in that string corresponds to the rating the person gave each statement in order of the statement. So, I added the option to show each statement and the rating each participant gave to it. 

To do this, I must first copy and paste the Q sort statements in the window on the right in the screen shot above, then click on the button "Display Individual Q Sorts." This brings up a second page with the names of the participants copied from the first page (shown below). All I need to do is click on any of the participant's names on the left and their Q sort ratings are shown:


To do this, I had to remember how to create a clickable list. Luckily, it's a short lesson:
  • Add a text field (scrollable or not)
  • Enable "List behavior" and "Multiline hilites"
Then, add the code for what should happen when a line is clicked. Here is the key bit of script that uses the property "hilitedLine:

put the hilitedLine of me into varLine

This puts the number of the line clicked into the variable of your choice (varLine, in my case). Then, I can easily put whatever is in that line into another object, such as a variable or field:

put line varLine of me into [ some variable or field name ]

I also added the option to sort the Q sort list in order of the rating or the statement number. I had to relearn how to do this with radio buttons. In short, you add two radio buttons and name them. Then, you group them together and make sure the option "Hilite one radio button at a time" is enabled. Then, you add script to each radio button using the property "hilite" to determine if the radio button is selected: 

if the hilite of me is true then [ do something ]

I also added the option to increase or decrease the text size. I had to look up the correct property to use: textsize

1:  on mouseup  
2:    put textsize of field "q sort" into varTSZ  
3:    add 1 to varTSZ  
4:    set the textsize of field "q sort" to varTSZ  
5:  end mouseup  

This script notes the current size of the text, then adds 1 to it. It's sister radio button subtracts one from it. (The default text size was 12.)

Finally, I added a text field to the far right that displays the grid statement pattern. The version of KADE I've been using for a few years auto-detects the grid pattern, but Shawn has updated KADE and the newest version no longer auto-detects the pattern. Interestingly, since I created the Q sort I should know the grid pattern easily, but one's memory is short and the time it takes to look it up is longer than you would think. The script looks at the Q sort results (for Popeye, in this case, but it could be anybody) and simply counts the number of ratings, such as two 4s, three 3s, etc. If I switch to Shawn's new version of KADE, this will save me many minutes.

Final Thought

The last thing I'll say is that I was working on the Q sort the night before the faculty workshop and I started making this app around 10 pm. I realized at that moment how little time I was going to have during the break the next day to connect the random code to each person's name, so I launched LiveCode to build the basics of this app. It only took about 20 minutes despite my sleepy state. 

No comments:

Post a Comment