Commit b60fe912 authored by dave griffiths's avatar dave griffiths

Merge branch 'master' of github.com:nebogeo/symbai

parents ff97b3c8 8dd940f8
......@@ -212,6 +212,40 @@
r))
'() ktvlist))
;; redundant second pass to syncronise files - independant of the
;; rest of the syncing system
(define (sync-files server-list)
(let ((local-files (dir-list "/sdcard/symbai/files/")))
;; search for all local files in server list
(append
(foldl
(lambda (file r)
;; send files not present
(if (find file server-list)
r (cons
(http-upload
(string-append "upload-" file)
"http://192.168.2.1:8889/symbai?fn=upload"
(string-append "/sdcard/symbai/files/" file)) r)))
local-list)
;; search for all server files in local list
(foldl
(lambda (file r)
;; request files not present
(if (find file local-list)
r (cons
(http-download
(string-append "download-" file)
(string-append "http://192.168.2.1:8889/files/" file)
(string-append "/sdcard/symbai/files/" file)) r)))
server-list))))
(define (start-sync-files)
(http-request
(string-append "file-list")
(string-append "http://192.168.2.1:8889/")
;; spit all dirty entities to server
(define (spit db table entities)
(foldl
......@@ -317,6 +351,19 @@
'()
version-data))
(define (mark-unlisted-entities-dirty! db table version-data)
;; load all local entities
(let ((ids (all-unique-ids db table))
(server-ids (map car version-data)))
;; look for each one in data
(for-each
(lambda (id)
(when ((not (find id server-ids)))
(msg "can't find " id " in server data, marking dirty")
;; mark those not present as dirty for next spit cycle
(update-entity-dirty db table id)))
ids)))
;; repeatedly read version and request updates
(define (suck-new db table)
(debug! "Requesting new entities")
......@@ -326,6 +373,9 @@
(string-append url "fn=entity-versions&table=" table)
(lambda (data)
(let ((new-entity-requests (build-entity-requests db table data)))
(alog "suck-new: marking dirty")
(mark-unlisted-entities-dirty! db table data)
(alog "suck-new: done marking dirty")
(cond
((null? new-entity-requests)
(debug! "No new data to download")
......@@ -470,20 +520,30 @@
50 (layout 'fill-parent 'wrap-content 1 'centre 5)))
(define (medit-text id type fn)
(vert
(text-view 0 (mtext-lookup id)
30 (layout 'wrap-content 'wrap-content -1 'centre 0))
(edit-text (symbol->id id) "" 30 type
(layout 'fill-parent 'wrap-content -1 'centre 0)
fn)))
(linear-layout
(make-id (string-append (symbol->string id) "-container"))
'vertical
(layout 'fill-parent 'wrap-content 1 'centre 20)
(list 0 0 0 0)
(list
(text-view 0 (mtext-lookup id)
30 (layout 'wrap-content 'wrap-content -1 'centre 0))
(edit-text (symbol->id id) "" 30 type
(layout 'fill-parent 'wrap-content -1 'centre 0)
fn))))
(define (medit-text-scale id type fn)
(vert
(text-view 0 (mtext-lookup id)
30 (layout 'wrap-content 'wrap-content 1 'centre 0))
(edit-text (symbol->id id) "" 30 type
(layout 'fill-parent 'wrap-content 1 'centre 0)
fn)))
(linear-layout
(make-id (string-append (symbol->string id) "-container"))
'vertical
(layout 'fill-parent 'wrap-content 1 'centre 20)
(list 0 0 0 0)
(list
(text-view 0 (mtext-lookup id)
30 (layout 'wrap-content 'wrap-content 1 'centre 0))
(edit-text (symbol->id id) "" 30 type
(layout 'fill-parent 'wrap-content 1 'centre 0)
fn))))
(define (mspinner id types fn)
(vert
......@@ -496,25 +556,30 @@
(lambda (c) (fn c)))))
(define (mspinner-other id types fn)
(horiz
(vert
(text-view (symbol->id id)
(mtext-lookup id)
30 (layout 'wrap-content 'wrap-content 1 'centre 10))
(spinner (make-id (string-append (symbol->string id) "-spinner"))
(map mtext-lookup types)
(layout 'wrap-content 'wrap-content 1 'centre 0)
(lambda (c)
;; dont call if set to "other"
(if (< c (- (length types) 1))
(fn c)
'()))))
(vert
(mtext-scale 'other)
(edit-text (make-id (string-append (symbol->string id) "-edit-text"))
"" 30 "normal"
(layout 'fill-parent 'wrap-content 1 'centre 0)
(lambda (t) (fn t))))))
(linear-layout
(make-id (string-append (symbol->string id) "-container"))
'horizontal
(layout 'fill-parent 'wrap-content 1 'centre 5)
(list 0 0 0 0)
(list
(vert
(text-view (symbol->id id)
(mtext-lookup id)
30 (layout 'wrap-content 'wrap-content 1 'centre 10))
(spinner (make-id (string-append (symbol->string id) "-spinner"))
(map mtext-lookup types)
(layout 'wrap-content 'wrap-content 1 'centre 0)
(lambda (c)
;; dont call if set to "other"
(if (< c (- (length types) 1))
(fn c)
'()))))
(vert
(mtext-scale 'other)
(edit-text (make-id (string-append (symbol->string id) "-edit-text"))
"" 30 "normal"
(layout 'fill-parent 'wrap-content 1 'centre 0)
(lambda (t) (fn t)))))))
(define (mspinner-other-vert id text-id types fn)
(linear-layout
......@@ -631,20 +696,36 @@
(list-ref d 5)))))
(define (do-gps display-id key-prepend)
(let ((loc (get-current 'location '(0 0))))
(entity-set-value! (string-append key-prepend "-lat") "real" (car loc))
(entity-set-value! (string-append key-prepend "-lon") "real" (cadr loc))
(list
(update-widget
'text-view
(get-id (string-append (symbol->string display-id) "-lat"))
'text
(number->string (car loc)))
(update-widget
'text-view
(get-id (string-append (symbol->string display-id) "-lon"))
'text
(number->string (cadr loc))))))
(list
(alert-dialog
"gps-check"
(mtext-lookup 'gps-are-you-sure)
(lambda (v)
(cond
((eqv? v 1)
(list
(alert-dialog
"gps-check2"
(mtext-lookup 'gps-are-you-sure-2)
(lambda (v)
(cond
((eqv? v 1)
(let ((loc (get-current 'location '(0 0))))
(entity-set-value! (string-append key-prepend "-lat") "real" (car loc))
(entity-set-value! (string-append key-prepend "-lon") "real" (cadr loc))
(list
(update-widget
'text-view
(get-id (string-append (symbol->string display-id) "-lat"))
'text
(number->string (car loc)))
(update-widget
'text-view
(get-id (string-append (symbol->string display-id) "-lon"))
'text
(number->string (cadr loc))))))
(else '()))))))
(else '()))))))
(define (mupdate-gps display-id key-prepend)
(let ((lat (entity-get-value (string-append key-prepend "-lat")))
......
......@@ -64,11 +64,10 @@
(define tribes-list '(khasi other))
(define subtribe-list '(khynriam pnar bhoi war other))
(define education-list '(illiterate literate primary middle high secondary university))
(define married-list '(ever-married currently-married currently-single seperated))
(define education-list '(primary middle high secondary university))
(define married-list '(currently-married currently-single seperated))
(define residence-list '(birthplace spouse-village))
(define gender-list '(male female))
(define occupation-list '(agriculture gathering labour cows fishing other))
(define house-type-list '(concrete tin thatched other))
(define social-types-list '(friendship knowledge prestige))
......@@ -87,6 +86,7 @@
(list
(ktv "name" "varchar" (mtext-lookup 'default-household-name))
(ktv "num-pots" "int" 0)
(ktv "num-children" "int" 0)
(ktv "house-lat" "real" 0) ;; get from current location?
(ktv "house-lon" "real" 0)
(ktv "toilet-lat" "real" 0)
......@@ -103,6 +103,7 @@
(ktv "child" "int" 0)
(ktv "age" "int" 0)
(ktv "gender" "varchar" "")
(ktv "literate" "int" 0)
(ktv "education" "varchar" "")
(ktv "head-of-house" "varchar" "")
(ktv "marital-status" "varchar" "")
......@@ -120,7 +121,12 @@
(ktv "num-residence-changes" "int" 0)
(ktv "village-visits-month" "int" 0)
(ktv "village-visits-year" "int" 0)
(ktv "occupation" "varchar" "")
(ktv "occupation-agriculture" "int" 0)
(ktv "occupation-gathering" "int" 0)
(ktv "occupation-labour" "int" 0)
(ktv "occupation-cows" "int" 0)
(ktv "occupation-fishing" "int" 0)
(ktv "occupation-other" "varchar" "")
(ktv "contribute" "int" 0)
(ktv "own-land" "int" 0)
(ktv "rent-land" "int" 0)
......@@ -166,9 +172,9 @@
(append
(cond
((get-current 'sync-on #f)
(when (zero? (random 10))
(msg "mangling...")
(mangle-test! db "sync" entity-types))
; (when (zero? (random 10))
; (msg "mangling...")
; (mangle-test! db "sync" entity-types))
(msg "one")
(set-current! 'upload 0)
(set-current! 'download 0)
......@@ -178,7 +184,11 @@
(append
(list (toast "sync-cb"))
(upload-dirty db)
(if (have-dirty? db "sync") '() (suck-new db "sync"))))))
;; important - don't receive until all are sent...
(if (have-dirty? db "sync") '()
(append
(suck-new db "sync")
(start-sync-files)))))))
(else '()))
(list
(delayed "debug-timer" (+ 10000 (random 5000)) debug-timer-cb)
......@@ -529,9 +539,21 @@
(let ((id-text (symbol->string id)))
(horiz-colour
(if shade colour-one colour-two)
(mtoggle-button-scale
id (lambda (v)
(entity-set-value! id-text "int" v) '()))
(linear-layout
0 'vertical (layout 200 'wrap-content -1 'left 0)
(list 0 0 0 0)
(list
(text-view (symbol->id id)
(mtext-lookup id)
30 (layout 'wrap-content 'wrap-content -1 'left 0))
(mtoggle-button-scale
(string->symbol (string-append id-text "-in-village"))
(lambda (v)
(entity-set-value! id-text "int" v)
(list (update-widget
'edit-text
(get-id (string-append id-text "-closest-access-container"))
(if (eqv? v 1) 'hide 'show) 0))))))
(medit-text-scale
(string->symbol (string-append id-text "-closest-access"))
"normal" (lambda (v) (entity-set-value!
......@@ -550,10 +572,15 @@
(let ((id-text (symbol->string id)))
(append
(list
(mupdate 'toggle-button id id-text)
(mupdate 'toggle-button (string->symbol (string-append id-text "-in-village")) id-text)
(mupdate 'edit-text
(string->symbol (string-append id-text "-closest-access"))
(string-append id-text "-closest-access")))
(string-append id-text "-closest-access"))
(update-widget
'edit-text
(get-id (string-append id-text "-closest-access-container"))
(if (eqv? (entity-get-value id-text) 1)
'hide 'show) 0))
(mupdate-gps
(string->symbol (string-append id-text "-gps"))
(string-append id-text "-gps")))))
......@@ -780,7 +807,9 @@
(build-activity
(horiz
(medit-text 'household-name "normal" (lambda (v) (entity-set-value! "name" "varchar" v) '()))
(medit-text 'num-pots "numeric" (lambda (v) (entity-set-value! "num-pots" "int" v) '())))
(vert
(medit-text 'num-pots "numeric" (lambda (v) (entity-set-value! "num-pots" "int" v) '()))
(medit-text 'num-children "numeric" (lambda (v) (entity-set-value! "num-children" "int" v) '()))))
(horiz
(vert
(mtext 'location)
......@@ -827,7 +856,8 @@
(list
(update-list-widget db "sync" "individual" "individual" arg)
(mupdate 'edit-text 'household-name "name")
(mupdate 'edit-text 'num-pots "num-pots"))
(mupdate 'edit-text 'num-pots "num-pots")
(mupdate 'edit-text 'num-children "num-children"))
(mupdate-gps 'house "house")
(mupdate-gps 'toilet "toilet")))
......@@ -906,7 +936,9 @@
(mspinner-other 'sub-tribe subtribe-list (lambda (v) (entity-set-value! "subtribe" "varchar" (spinner-choice subtribe-list v)) '()))
(horiz
(medit-text 'age "numeric" (lambda (v) (entity-set-value! "age" "int" v) '()))
(mspinner 'gender gender-list (lambda (v) (entity-set-value! "gender" "varchar" (spinner-choice gender-list v)) '()))
(mspinner 'gender gender-list (lambda (v) (entity-set-value! "gender" "varchar" (spinner-choice gender-list v)) '())))
(horiz
(mtoggle-button-scale 'literate (lambda (v) (entity-set-value! "literate" "int" v) '()))
(mspinner 'education education-list (lambda (v) (entity-set-value! "education" "varchar" v) '())))
)
(lambda (activity arg)
......@@ -924,6 +956,7 @@
(mupdate 'image-view 'photo "photo")
(mupdate 'edit-text 'age "age")
(mupdate-spinner 'gender "gender" gender-list)
(mupdate 'toggle-button 'literate "literate")
(mupdate-spinner 'education "education" education-list)
)))
(lambda (activity) '())
......@@ -953,7 +986,12 @@
(vert
(mspinner 'head-of-house gender-list (lambda (v) (entity-set-value! "head-of-house" "varchar" (spinner-choice gender-list v)) '()))
(mspinner 'marital-status married-list (lambda (v) (entity-set-value! "marital-status" "varchar" (spinner-choice married-list v)) '()))
(medit-text 'times-married "numeric" (lambda (v) (entity-set-value! "times-married" "int" v) '())))
(medit-text 'times-married "numeric"
(lambda (v)
(entity-set-value! "times-married" "int" v)
(list
(update-widget 'linear-layout (get-id "residence-after-marriage-container")
(if (equal? v "0") 'hide 'show) 0)))))
(build-person-selector 'spouse "id-spouse" (list) spouse-request-code)
)
......@@ -1069,16 +1107,24 @@
(activity
"income"
(build-activity
(mspinner 'occupation occupation-list
(lambda (v) (entity-set-value! "occupation" "varchar"
(spinner-choice occupation-list v))
'()))
(vert
(mtitle 'occupation)
(horiz
(mtoggle-button-scale 'occupation-agriculture (lambda (v) (entity-set-value! "occupation-agriculture" "int" v) '()))
(mtoggle-button-scale 'occupation-gathering (lambda (v) (entity-set-value! "occupation-gathering" "int" v) '()))
(mtoggle-button-scale 'occupation-labour (lambda (v) (entity-set-value! "occupation-labour" "int" v) '())))
(horiz
(mtoggle-button-scale 'occupation-cows (lambda (v) (entity-set-value! "occupation-cows" "int" v) '()))
(mtoggle-button-scale 'occupation-fishing (lambda (v) (entity-set-value! "occupation-fishing" "int" v) '()))
(medit-text 'occupation-other "normal" (lambda (v) (entity-set-value! "occupation-other" "varchar" v) '()))))
(horiz
(mtoggle-button-scale 'contribute (lambda (v) (entity-set-value! "contribute" "int" v) '()))
(mtoggle-button-scale 'own-land (lambda (v) (entity-set-value! "own-land" "int" v) '())))
(horiz
(mtoggle-button-scale 'rent-land (lambda (v) (entity-set-value! "rent-land" "int" v) '()))
(mtoggle-button-scale 'hire-land (lambda (v) (entity-set-value! "hire-land" "int" v) '())))
(mtext 'crops-detail)
(build-list-widget
db "sync" 'crops "crop" "crop" (lambda () (get-current 'individual #f))
(lambda () crop-ktvlist))
......@@ -1107,7 +1153,12 @@
(mupdate-spinner-other 'house-type "house-type" house-type-list)
(list
(update-list-widget db "sync" "crop" "crop" (get-current 'individual #f))
(mupdate-spinner 'occupation "occupation" occupation-list)
(mupdate 'toggle-button 'occupation-agriculture "occupation-agriculture")
(mupdate 'toggle-button 'occupation-gathering "occupation-gathering")
(mupdate 'toggle-button 'occupation-labour "occupation-labour")
(mupdate 'toggle-button 'occupation-cows "occupation-cows")
(mupdate 'toggle-button 'occupation-fishing "occupation-fishing")
(mupdate 'edit-text 'occupation-other "occupation-other")
(mupdate 'toggle-button 'contribute "contribute")
(mupdate 'toggle-button 'own-land "own-land")
(mupdate 'toggle-button 'rent-land "rent-land")
......@@ -1347,14 +1398,7 @@
(vert
(text-view (make-id "sync-title") "Sync database" 40 fillwrap)
(mtext 'sync-dirty "...")
(horiz
(mtoggle-button-scale 'sync-all (lambda (v) (set-current! 'sync-on v) '()))
(mbutton-scale 'sync-syncall
(lambda ()
(let ((r (append
(spit db "sync" (dirty-and-all-entities db "sync"))
(spit db "stream" (dirty-and-all-entities db "stream")))))
(cons (toast "Uploading data...") r)))))
(mtoggle-button-scale 'sync-all (lambda (v) (set-current! 'sync-on v) '()))
(mtitle 'export-data)
(horiz
(mbutton-scale 'sync-download
......
test-num,1,1,1,
test-text, I am test text, I am test text, I am test text,
test-num,1,1,1,
test-text, I am test text, I am test text, I am test text,
one, one, ,,
two, two, ,,
three, three, ,,
......@@ -10,17 +10,17 @@ individual, Individual, ,,
individuals, Individuals, ,,
add-item-to-list,0, ,,
default-village-name, New village, ,,
title, Symbai, Symbai, Symbai,
sync, Sync, Sync, Sync,
languages, Choose language, Choose language, Choose language,
english, English, English, English,
khasi, Khasi, Khasi, Khasi,
hindi, Hindi, Hindi, Hindi,
user-id, Your user ID, User ID, User ID,
save, Save, Save, Save,
back, Back, Back, Back,
off, Off, Off, Off,
villages, Villages, Villages, Villages,
title, Symbai, Symbai, Symbai,
sync, Sync, Sync, Sync,
languages, Choose language, Choose language, Choose language,
english, English, English, English,
khasi, Khasi, Khasi, Khasi,
hindi, Hindi, Hindi, Hindi,
user-id, Your user ID, User ID, User ID,
save, Save, Save, Save,
back, Back, Back, Back,
off, Off, Off, Off,
villages, Villages, Villages, Villages,
list-empty, List empty, ,,
delete, Delete, ,,
delete-are-you-sure, Are you sure you want to delete this?, ,,
......@@ -29,7 +29,7 @@ quick-name, New person name, ,,
quick-add, Quick add, ,,
find-individual, Find individual, ,,
filter, Filter, ,,
off, Off, Off, Off,
off, Off, Off, Off,
name, Name, ,,
sync-all, Sync me!, ,,
sync-syncall, Sync everything, ,,
......@@ -40,9 +40,9 @@ email-local, Email local DB, ,,
debug, Debug, ,,
sync-back, Back, ,,
sync-prof, Profile, ,,
village-name, Village name, Village name, Village name,
block, Block, Block, Block,
district, District, District, District,
village-name, Village name, Village name, Village name,
block, Block, Block, Block,
district, District, District, District,
car, Accessible by car, ,,
household-list, Household list, ,,
amenities, Amenities, ,,
......@@ -52,31 +52,31 @@ closest-access, Closest place of access, ,,
house-gps, GPS, ,,
toilet-gps, GPS, ,,
school, School, ,,
school-closest-access, Access, ,,
school-closest-access, Closest access, ,,
school-gps, GPS, ,,
hospital, Hospital/Health care centre, ,,
hospital-closest-access, Access, ,,
hospital-closest-access, Closest access, ,,
hospital-gps, GPS, ,,
post-office, Post Office, ,,
post-office-closest-access, Access, ,,
post-office-closest-access, Closest access, ,,
post-office-gps, GPS, ,,
railway-station, Railway station, ,,
railway-station-closest-access, Access, ,,
railway-station-closest-access, Closest access, ,,
railway-station-gps, GPS, ,,
state-bus-service, Inter-state bus service, ,,
state-bus-service-closest-access, Access, ,,
state-bus-service-closest-access, Closest access, ,,
state-bus-service-gps, GPS, ,,
district-bus-service, Inter-village/district bus service, ,,
district-bus-service-closest-access, Access, ,,
district-bus-service-closest-access, Closest access, ,,
district-bus-service-gps, GPS, ,,
panchayat, Village Panchayat Office, ,,
panchayat-closest-access, Access, ,,
panchayat-closest-access, Closest access, ,,
panchayat-gps, GPS, ,,
NGO, Presence of NGO's working with them, ,,
NGO-closest-access, Access, ,,
NGO-closest-access, Closest access, ,,
NGO-gps, GPS, ,,
market, Market, ,,
market-closest-access, Access, ,,
market-closest-access, Closest access, ,,
market-gps, GPS, ,,
household-name, Household name, ,,
default-household-name, A household, ,,
......
(define i18n-text
(list
(list 'test-num (list "1" "1" "1" "" ))
(list 'test-text (list "I am test text" "I am test text" "I am test text" "" ))
(list 'one (list "one" "" ))
......@@ -11,7 +12,7 @@
(list 'households (list "Households" "" ))
(list 'individual (list "Individual" "" ))
(list 'individuals (list "Individuals" "" ))
(list 'add-item-to-list (list "+" "" ))
(list 'add-item-to-list (list "0" "" ))
(list 'default-village-name (list "New village" "" ))
(list 'title (list "Symbai" "Symbai" "Symbai" "" ))
(list 'sync (list "Sync" "Sync" "Sync" "" ))
......@@ -54,32 +55,41 @@
(list 'closest-access (list "Closest place of access" "" ))
(list 'house-gps (list "GPS" "" ))
(list 'toilet-gps (list "GPS" "" ))
(list 'school-in-village (list "In Village" ))
(list 'school (list "School" "" ))
(list 'school-closest-access (list "Access" "" ))
(list 'school-closest-access (list "Closest access" "" ))
(list 'school-gps (list "GPS" "" ))
(list 'hospital-in-village (list "In Village" ))
(list 'hospital (list "Hospital/Health care centre" "" ))
(list 'hospital-closest-access (list "Access" "" ))
(list 'hospital-closest-access (list "Closest access" "" ))
(list 'hospital-gps (list "GPS" "" ))
(list 'Post-office-in-village (list "In Village" ))
(list 'post-office (list "Post Office" "" ))
(list 'post-office-closest-access (list "Access" "" ))
(list 'post-office-closest-access (list "Closest access" "" ))
(list 'post-office-gps (list "GPS" "" ))
(list 'railway-station-in-village (list "In Village" ))
(list 'railway-station (list "Railway station" "" ))
(list 'railway-station-closest-access (list "Access" "" ))
(list 'railway-station-closest-access (list "Closest access" "" ))
(list 'railway-station-gps (list "GPS" "" ))
(list 'State-bus-service-in-village (list "In Village" ))
(list 'state-bus-service (list "Inter-state bus service" "" ))
(list 'state-bus-service-closest-access (list "Access" "" ))
(list 'state-bus-service-closest-access (list "Closest access" "" ))
(list 'state-bus-service-gps (list "GPS" "" ))
(list 'District-bus-service-in-village (list "In Village" ))
(list 'district-bus-service (list "Inter-village/district bus service" "" ))
(list 'district-bus-service-closest-access (list "Access" "" ))
(list 'district-bus-service-closest-access (list "Closest access" "" ))
(list 'district-bus-service-gps (list "GPS" "" ))
(list 'Panchayat-in-village (list "In Village" ))
(list 'panchayat (list "Village Panchayat Office" "" ))
(list 'panchayat-closest-access (list "Access" "" ))
(list 'panchayat-closest-access (list "Closest access" "" ))
(list 'panchayat-gps (list "GPS" "" ))
(list 'NGO-in-village (list "In Village" ))
(list 'NGO (list "Presence of NGO's working with them" "" ))
(list 'NGO-closest-access (list "Access" "" ))
(list 'NGO-closest-access (list "Closest access" "" ))
(list 'NGO-gps (list "GPS" "" ))
(list 'market-in-village (list "In Village" ))
(list 'market (list "Market" "" ))
(list 'market-closest-access (list "Access" "" ))
(list 'market-closest-access (list "Closest access" "" ))
(list 'market-gps (list "GPS" "" ))
(list 'household-name (list "Household name" "" ))
(list 'default-household-name (list "A household" "" ))
......@@ -154,34 +164,30 @@
(list 'village-visits-year (list "Number of times you have visited another village in the last year (i.e. betwen last summer and this summer)" "" ))
(list 'occupation (list "Occupation" "" ))
(list 'occupation (list "Occupation" "" ))
(list 'agriculture (list "Agriculture" "" ))
(list 'gathering (list "Gathering" "" ))
(list 'labour (list "Labour" "" ))
(list 'cows (list "Cows" "" ))
(list 'fishing (list "Fishing" "" ))
(list 'num-people-in-house (list "People living in house" "" ))
(list 'contribute (list "Contribute to family earnings?" "" ))
(list 'own-land (list "Own land?" "" ))
(list 'rent-land (list "Rent out your land?" "" ))
(list 'hire-land (list "Hire land?" "" ))