summary refs log tree commit diff
path: root/ksh-biometry.el
diff options
context:
space:
mode:
authorArun Isaac2020-12-31 13:45:36 +0530
committerArun Isaac2020-12-31 15:07:21 +0530
commit79da3ff61ffb5d3c825c37002115639ffdd0789f (patch)
tree571c89ed56c73266658b2af880649e5653d7acc8 /ksh-biometry.el
parentc986de298d9ae631c5c70bc66aa4c327f38e6c88 (diff)
downloadksh-reports-79da3ff61ffb5d3c825c37002115639ffdd0789f.tar.gz
ksh-reports-79da3ff61ffb5d3c825c37002115639ffdd0789f.tar.lz
ksh-reports-79da3ff61ffb5d3c825c37002115639ffdd0789f.zip
Combine biometry and report into single file.
* ksh-report-header.el, ksh-biometry.el: Combine into ksh-report.el.
* ksh-scan2.el, ksh-scan3.el: Require ksh-report instead of loading
ksh-report-header.el and ksh-biometry.el.
Diffstat (limited to 'ksh-biometry.el')
-rw-r--r--ksh-biometry.el41
1 files changed, 0 insertions, 41 deletions
diff --git a/ksh-biometry.el b/ksh-biometry.el
deleted file mode 100644
index 0e5f1d7..0000000
--- a/ksh-biometry.el
+++ /dev/null
@@ -1,41 +0,0 @@
-(defun draw-biometry (param-name param param-age percentile)
-  (let ((temp-script-file (make-temp-script
-			   (format "%s %s" param-name param)
-			   param-age (string-to-number percentile))))
-    (message "Drawing %s..." temp-script-file)
-    (shell-command
-     (format "asy -f pdf -o %s %s" (file-name-directory temp-script-file) temp-script-file))
-    (delete-file temp-script-file)
-    (format "%s.pdf" temp-script-file)))
-
-(defun make-temp-script (param param-age percentile)
-  (let ((temp-script-file (make-temp-file "biometry")))
-    (with-temp-file temp-script-file
-      (insert "include \"biometry\";\n")
-      (insert (format
-	       "draw_biometry(\"%s\", \"%s\", %d);"
-	       param param-age percentile)))
-    temp-script-file))
-
-(defun insert-biometry (readings)
-  (princ
-   (format "[[%s]]\n"
-	   (crop-pdf
-	    (combine-pdfs
-	     (mapcar (lambda (reading)
-			  (apply 'draw-biometry
-				 (mapcar 'get-field reading))) readings))))))
-
-(defun combine-pdfs (pdfs)
-  (let ((temp-combination (make-temp-file "pdfjam" nil ".pdf")))
-    (apply 'call-process "pdfjam" nil nil nil
-	   "--nup" "4x1"
-	   "--outfile" temp-combination pdfs)
-    (mapc 'delete-file pdfs)
-    temp-combination))
-
-(defun crop-pdf (pdf)
-  (message "Cropping %s..." pdf)
-  (let ((output-pdf (format "%s-crop.pdf" (file-name-sans-extension pdf))))
-    (shell-command (format "pdfcrop %s %s" pdf output-pdf))
-    (delete-file pdf) output-pdf))