example SQL file with dbi included in comment
[MojoFacets.git] / README
1 Mojo Facets - server side facet browsing using Mojolicious and jQuery UI
2
3
4 Data sources:
5
6 Put JSON file from Simile Exhibit project in data/ with extension .js or .json
7
8 Alternative format is pipe (|) separated text files with extension .txt
9 First column is always header with field names
10 Multi-line values should be wrapped in ^multi-line-text^
11
12 If you save bounch of html files with table in directory with .html extension, they will
13 we all read as single data set, allowing easy analysys of search results, for example.
14
15 CSV files with .csv extension are parsed using , as delimiter. Encoding is utf8
16 and can be specified in filename, before extension like this: data.encoding.csv
17
18 CouchDB data can be imported using files which contain full url to CouchDB database
19 or url to CouchDB view to import. URL's filename should end in *.couchdb
20
21
22 Start with:
23
24     LANG=hr_HR.utf8 ./script/mojo_facets daemon --reload
25
26
27 Changing tabular data:
28
29 Just double click on any table cell and click outside or focus out to save change.
30
31
32 Data action and changes:
33
34 There are two kinds of audit log in MojoFacets:
35
36 1. actions stored in /tmp/actions are clicks on user interface with parameters,
37    they will probably be erased on next reboot since they are in /tmp
38
39 2. changes in data/database.changes are more structured, including old value
40    and unique identifiers for that row
41
42 Changes can be applied on any dataset currently in memory.
43
44 Whole idea of changes is to create audit log which is detailed enough to recostruct
45 current state of dataset from source file and list of changes. However, to speed
46 up operations, you can periodically save your in-memory data to /tmp/ in perl
47 storeable format using save link in interface.
48
49
50 Data replication:
51
52 Actions can be replicated to other hosts using MASTER enviroment variable
53 or config menu
54
55     # slave
56     MASTER=http://localhost:4444 ./script/mojo_facets daemon --reload
57
58
59 Code console to modify data using perl snippets:
60
61 Experimental REPL console supports perl snippets which get $row hash which is one
62 element from your dataset.
63
64 If you want to create or update values, you will have to use $update hash to set
65 new values.
66
67 If you want to report something from your dataset (also called reduce in map/reduce
68 terminology) you can use $out hash to store values which will be used to generate
69 new dataset using $key and $value for column names.
70
71 All values are repetable, but if you create just a scalar, magic(tm) inside MojoFacets
72 will try to upgrade it to [ $scalar ] so you don't have to do it explicitly.
73
74 Code examples are stored in public/code
75
76 They use column1,column2.description.pl notatition so only snippets which have applicable
77 column will be shown.
78
79
80 Facet code eval:
81
82 Code snippet will be executed for each facet $value and will report $count and $checked state.
83 You can also update $checked to programatically select part of facet values.
84
85
86 Export data:
87
88 All exported data is stored in public/export/database/
89
90 There you can find saved filters and items generated with export checkbox
91
92     filter.column_name.optional_description
93         items.column1.column2.column3
94
95