added two examples of perl code to eval on data
[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
16 Start with:
17
18   LANG=hr_HR.utf8 ./script/mojo_facets daemon --reload
19
20
21 Data replication:
22
23   # master
24   ./script/mojo_facets daemon --listen 'http://*:4444' --reload
25
26   # slave
27   MASTER=http://localhost:4444 ./script/mojo_facets daemon --reload
28
29
30 Turning actions into changes:
31
32 There are two kinds of audit log in MojoFacets:
33
34 1. actions stored in /tmp/actions are clicks on user interface with parameters
35
36 2. changes are more structured, including old value and unique values from
37    edit of one value in dataset
38
39 If you want to create changes which can be applied again on original dataset or
40 any other dataset which has same unique values you can use helper script:
41
42   $ ./script/actions-to-changes /data/mojo_facets/*
43
44
45 Modify your data using perl snippets
46
47 Experimental REPL console supports perl snippets which get $rec hash which is one
48 element from your dataset. All values are repetable, so you always have to create
49 array of values if you are creating new columns, even for single value.
50
51 * generate new columns with number of elements in some other column
52
53   $rec->{count} = [ $#{ $rec->{original} } + 1 ];
54
55 * generate century column from year
56
57   foreach my $year ( @{ $rec->{Year} } ) {
58     push @{ $rec->{century} }, int($year/100)+1;
59   }
60