bs2facdev

Racket

Questionnaire Visualization

It:s that time of year again. We got the results for the Faculty Development questionnaires handed out to students in our classrooms. I haven't been programming much, but I think reading the Pollen docs, aoc-racket, and some of the scribble documentation code is helping re-write scripts for readability. During the “make-it-work” stage I get so busy reading documentation and on-line pages (stackoverflow always seems to have a discussion that helps). The re-discovery of Perl Best Practices and a quick reading of the chapter about naming variables is helping too: the general idea of naming variables so that they structure reads smoothly when you use them later.

Universty Questionnaire Result Visualization

Read more...

If I can figure out how to give each plot-pict a name, I'll be able to use pin-over and rt-find to annotate questions. For now only the title text is named. With the title pict named inset let me place the response table without relying on coordinates discovered from a bitmap in GIMP.

plot pict appends

The code and data are below.

Read more...

This code was broken for a while, the .png-generation portion is still too repetitive. The code takes questionnaire results and provides a faceted (R ggplot2-like) view with an .html page that list questions with a visualization of their results for the individual, the individual's department(faculty), and the department's(faculty's) university.

Faceted-like view in Browser

Experience with Racket's path utilities over the past weeks (and today's discovery that regexp-replace works with paths!) helped to clean up the part that filters plot images.

Filtering plot images is better with paths

Other work demands attention and time, but it's awful to leave code in a broken state.

Example of a  generated .png file

code

Read more...

D.R.Y. for Teachers

If it wasn't for SJIS (or some sort of MS Windows Encoding Page) troubles, this script would probably be useful and reliable. I'm fudging the possible encoding issues by, using “key” and “value” as backups when assoc doesn't find what it should in an associative list (alist, als). Playing with Scheme/Racket gives you the confidence to deal with any problem, if some detail isn't working, just throw in an if or cond statement, and maybe the results will help you figure out where the trouble is. DrRacket is great for showing where errors are, it even produces bright red lines that trace the errors for you...

There is a pattern, where I develop the script to generate useful pages to process one data file and then adapt it to handle several files in a directory. After the script seems to work for one data file, I get all the define definitions used to transform data (not those used to make functions) from the original file, and put those definitions into a let* expression (or clause) within a procedure that is used with for-each to go through a list of data files. Some definitions remain global, but all the definitions that rely on the data file go into a let* clause.

This code is re-working of earlier code (fn:1) that, from one .csv data file generated three files: a racket data file, a browser page to print roll sheets, and a browser page to print a seating chart. To get code that will generate three useful files (a rkt data file, a roll sheet, and a seating chart) for each .csv data file in a directory, I just had to see what belongs in a let* clause of the function that is mapped (with for-each for the side-effects and the list-generation) over a list of file paths.

A typo(bug) that disturbed my flow made me appreciate first and second in place of car and cadr. I had build-path errors that confused me for a while. when I moved the define cls-als (class associative list: alist: als) into the let* clause, I forgot the a in cadr. In place of a one-key one-value associative list, I ended up with, not a string, but a long list as the value. Without the string, I could build paths for file-generation. I imagine using first and second could make it easier to spot a mistake like that. But cddr is probably still useful instead of (rest (rest ....

There is another bug, where the first seat is taken up by the keys for associative list, or what could be viewed as column headers in a table of data. If there is time I'll see where in the chart-generation process to intervene, and get rid of the header intrusion. But the bug could be a feature, it can be nice to have an open table at the front of the room for returning papers, for set-up. With the Graded Direct Method teachers haul a lot of “realia” into the classroom, and tend to need tables and seats for demonstrations...

code

Read more...

It might be easier to share Dont' Repeat Yourself (D.R.Y. or OnceAndOnlyOnce) techniques if I get the Guile Scheme scripts(fn:1) to work in DrRacket(fn:2). If Convention Over Configuration principles can direct teachers toward a directory in their home-directory, and toward keeping their .csv data in particular folders, and to look for useful pages in particular folders… Given all that, a script like this could be useful for other people too.

Screenshot of Generated Pages: Roll Sheet and Seating Chart in Firefox Windowshttps://snap.as/bsmall2/racket-facdev/Binke65

I got a Guile script go through a directory of .csv data files (encoded in SJIS) and produce three useful files (encoded in UTF-8) for each data file. The next step is to get DrRacket to do the process below for several .csv files. And then another script should make it possible to use an edited ~-roll-data.rkt file to produce another seating chart. Sometimes the class needs a different ordering of seats: for example, people with hearing trouble might do better at the front of the class. And some class-rooms demand a wider row, in stead of a six-person row, a large class might need a ten-person row. But for now, this code, with build-path is probably more portable than my first attempt in Guile Scheme. (fn:1)

And comparing this Racket Script with the Guile Script is a chance to see differences among regexp-replace\* and regexp-substitute/global, scribble\html\html with its output-xml and sxml simple with its sxml->xml. I enjoyed the oppornity to practice quasiquote while learning to work with sxml->xml, but for the pages I generate here scribble\html and output-xml seems simpler. My regular expression needs are met by the simpler regexp-replace\* , but with more complex processes the pre andpost approach for regexpt![img](images/SJIS-csv-to-RollSheet-SeatingChart-1.png) -substitute/global might be helpful.

A Screenshot of DrRacket with the code used to generate  Roll Sheet and Seating Chart pages https://snap.as/bsmall2/racket-facdev/SNzGnvo

code

Read more...

While rushing to finish pasting .png files into a word processor document, I noticed that plots need a title for context. Maybe if I was able to completely avoid office software and stay with generated html pages it wouldn't matter as much, but while pasting images into documents it was hard to see which semester the plots belonged too.

The generated html page was ok when printed from firefox with the Landscape setting but the “float” layout broke with my laptop screen. Looking over css grid again helped with that issue. Printing to .pdf from Firefox is helpful but the files got really big for my recent pages with plot images..

Read more...

The code needs editing, but I like this view of questionnaire data where “factor” responses of 1 and 2 are negative, 3 is seemingly neutral, and 4 and 5 are positive. It seems possible to see things with this view that might not be possible with an average/mean of the responses.

Synoptic View of Positive and Negative Responses for a Questionnaire

The visualization needs to be on a page with the full text for the questions, the symbols for the numbered responses, the tables for the data, and an attempt to explain the visualization.

Screenshot of the page output by the code below, includes the image above

Read more...

While using questionnaire data to learn plotting, questions come to mind. Averages don't make sense for “ranked” “factors”, for numbered responses to questions about how much a person agrees or disagrees with a question. Maybe seeing the percentage and number of positive responses versus negative responses will help in the search for meaning in the data.

Top of Browser page showing first two question-result sections

With Racket it is possible to transform and view the data however you like. It's nice to be able to implement a view out of curiosity. I'm hoping the stacked lines with their labels provide enough hints for people to figure out that they are combinations of responses of 4 and 5 in a positive direction, and 1 and 2 in a negative direction.

Negative responses were most frequent for the question about student speaking, questioning in class

If there is time to go over the code again there must be less repetitive way to stack negative lines after stacking positive lines. Getting started on that gave me a change to use Racket's define to give the pnt-w-lbl procedure an optional argument.

Years ago with gnuplot I plotted “enthused”熱意 results against “satisified”満足 responses. Naomi Klein quoted a Harpers article by a professor that said he refused to be “cool” like a Marshall McLuhan screen.

For now though, I just want to see how Racket can replace two pages oddly scaled visualizations and averages. It's time to move into other work, after adjusting the css styles so that the generated page fits onto two A4 papers.

Here's proof that the code pasted in below worked in DrRacket:

DrRacket Screenshot

Read more...

Developing faculties for designing programs and visualization with Faculty Development Questionnaires. In the spirit of “Nothing about us without us”, ideally, students would design the questionnaires. We would view the data with Racket's help, and get started thinking about what sort of classes, what sort of universities, we need.

Racket plots viewed on output page in Firefox

It was good to get that feeling that capacities/abilities/powers were growing while doing this. Racket's documentation, DrRacket, and Emacs are great for self-directed exploratory learning. With enough time to become the equivalent of a “native speaker” in Racket, developing a Graded Direct Method for learning the language could be one way of developing “effectively capable people”(I.A. Richards).

Read more...

This sort of visualization may let me replace bar charts. The panel or facet approach to interleaved discrete histograms might be good for on-screen browsing, but this sort of plot might be easier on the printer and ink supply.

Discussion in Diaspora* post comments provides motivation to explore more code and presentation. (fn:1~

Now I have to see about getting these separate images aligned into one eye-span for analytical viewing.

code

Read more...