Приложения канала
[Разметка Markdown] 

Faculty-Development: Home

Faculty Development Questionnaires

In order to simplify old scripts, I thought of a convention for keeping all the questionnaire data: the text for questions and responses, the numbers for responders and frequencies, all in one text file. I used to share code (and pictures 1) like this through a Diaspora* account, and the attempts are still accessible through WriteFeely. 2 Eventually I should follow the model of pollen.rkt and work through the scirpt with Racket's 'lp2' literate programming language. I got started with gitlab pages 3 a while ago but it was overwhelming. With a lot of time and practice it might be possible to explain the code in a literate program while evaluating small instructional examples. But it's a lot of detail and learning to tackle all at once, so I didn't get very far. 3

image

Data in Text File

Registered,98
Responded,37

5,Very Much Agree
4,Agree Somehwat
3,Can't Say
2,Disagree Somewhat
1,Completely Disagree

7,The teacher's voice was audible during class.
7,14,19,3,1,0

8,"Classroom slides, materials, and boardwork were understandable."
8,10,24,2,1,0

9,The teacher verified student reactions while advancing the class.
9,18,15,4,0,0

10,The teacher worked with enthusiasm.
10,23,14,0,0,0

11,The teacher was started and ended class on time.
11,17,19,1,0,0

12,The teacher told students how to prepare and review.
12,19,17,1,0,0

Racket Script

#! /usr/bin/env racket
#lang racket
;; From the Command line:
;;; ./Anketo-result-format-to-visualizations.rkt Anketo-Results-format-ja.txt ja
;; ; or default to Q-results-format.txt and no additions to Q-number

(define formatted-results
  (if (< 0 (vector-length (current-command-line-arguments)))
      (vector-ref (current-command-line-arguments) 0)
      "Q-results-format.txt"))

(define f-name-adjust
  (if (< 1 (vector-length (current-command-line-arguments)))
      (vector-ref (current-command-line-arguments) 1)
      ""))

(require csv-reading)

(define (make-plot-filename str)
  (string-append str f-name-adjust))

(define text-string (file->string formatted-results))
;; text-string ; ok!
(define text-sections-list
  (string-split text-string "\n\n"))
;; text-sections-list ; ok!
(define responder-turnout-list (csv->list (first text-sections-list)))
;;  responder-turnout-list ; ok!
(define-values (registered responded)
  (values (string->number (second (first responder-turnout-list)))
         (string->number (second (second responder-turnout-list)))))
;; (list registered responded) ; ok!
(define results-key-list (csv->list (second text-sections-list)))
;; results-key-list ;ok!
(define Q-results-list (map csv->list (drop text-sections-list 2)))
;; Q-results-list ; ok!
;;(define Q-1-list (first Q-results-list))
;;Q-1-list

(require plot)

(define p-label-txt-size 16)
(define p-label-num-size 14)
(define line-width 10)

(define (regi-line-end-label x y num str )
  (list
   (point-label (vector x y) num
                #:anchor 'bottom-right #:point-size 0 #:size p-label-num-size)
   (point-label (vector x y) str
                #:anchor 'top-right #:color "black" #:point-size 0 #:size p-label-txt-size)))

(define (label-question q-str)
  (point-label (vector 0 (+ 2 (length Q-results-list))) q-str
              #:anchor 'left #:point-size 0 #:size (+ 2 p-label-txt-size)))

(define (response-line result-num y response-string)
  (list
   (lines (list (vector 0 y)(vector result-num y))
          #:color "Cornflower Blue" #:width line-width)
   (point-label (vector result-num y)
                (string-append
                 (number->string result-num) " "
                 response-string)
                #:anchor 'left #:point-size 0 #:size p-label-num-size)))

(define (response-lines-w-qstn resp-list qstn-rslt-list)
  (define resp-txt-list (map second resp-list))
  (define q-str (second (first qstn-rslt-list)))
  (define rslts-freq-list (map string->number ;; frequencies
                         (rest (second qstn-rslt-list))))
  (define ys (range 3 (+ 3 (length resp-list))))
  (list
   (map response-line rslts-freq-list ys resp-txt-list)
   (label-question q-str)))


(define x-max-add (* .02 registered))

(define (plot-q-bitmap q-results)
  (define f-name (path-add-extension
                  (make-plot-filename (first (first q-results)))
                  ".png"))
  (define p-btmp
    (parameterize
        ((plot-decorations? #f)
         (plot-width 800)
         (plot-height 290)

         )
      (plot-bitmap
       (list
        (vrule 0 0 (+ 2 (length Q-results-list)))
        (vrule (+ x-max-add registered) 0 (+ 2 (length Q-results-list)))
        (hrule 0)
        ;; show registered line
        (lines (list (vector 0 1) (vector registered 1))
               #:color "light gray" #:width line-width)
        (regi-line-end-label registered 1
                             (second (first responder-turnout-list))
                             (first (first responder-turnout-list))
                             )
        ;; show reponded line
        (lines (list (vector 0 2)(vector responded 2))
               #:color "dark gray" #:width line-width)
        (regi-line-end-label responded 2
                             (second (second responder-turnout-list))
                             (first (second responder-turnout-list))
                             )
        (response-lines-w-qstn results-key-list  q-results)
        ;;(response-line 14 3 "Very Much Agree")
        ;; show question
        #;(point-label (vector 0 9) "Question Text."
                       #:anchor 'left #:point-size 0 #:size 18)
        )
       #:x-min 0 #:x-max (+ registered x-max-add)
       #:y-min 0 #:y-max (+ 3 (length Q-results-list)))))
    (send p-btmp save-file f-name 'png)

  );; end of plot-q-btmp

;; (plot-q-bitmap (fourth Q-results-list)) ; ok!

(for-each plot-q-bitmap Q-results-list)


  1. https://tiksi.net/photos/bsmall2/album/ebae81aa-86fe-480c-b9d0-b0daa7b927a8 ↩︎

  2. https://write.as/bs2facdev/ ↩︎

  3. https://bzmall2.gitlab.io/essay-racket/ ↩︎ ↩︎