Zana Documentation

User logs:

Logs are grouped by date, showing how many unique users are for that day.

http://zana.com/log/showLogsGroupedByUser

then for each date a view with all users is shown, then for each user a view of all logs is shown

Refernce in elastic search https://www.elastic.co/guide/en/elasticsearch/guide/current/cardinality.html Cardinality field is eqauivalent to COUNT(distinct) in sql, used to count number of unique visitors for each day.

ES Query

   GET zanalog/log/_search?size=0
            {
                "aggs" : {
                 "top_tags" : {
                    "date_histogram" : {
                        "field" : "content_date",
                        "interval" : "1d"
                    },
                    "aggs": {
                       "user_for_that_date": {
                            "cardinality": {
                                "field": "session.keyword"
                           }
                        }
                    }
                }
            }
          }

In logs we save Templates that Zana sends to the user:

oneItemTemplate

When a template with one article and group of buttons refering to related articles is send to the user we call it oneItemTemplate: for example: What is anaphylaxis? A tempalte with a photo, a title, a summary, a link, an image and related articles, if there is any is send to the user.

listTemplate

This template is rendered when Zana sends to the user a list of conditions, and for each of them an image, alink to webpage and a short summaray button which when clicled displays the oneItemTemplate of that particular condition. for example: "What are the causes of ulcers?"

quickReplyTemplate

This template is rendered with a message and some buttons and is called in create profile flow, in general fallback, in terms of agreement and in dedicated topics.

To show these templates in user logs, we use bootstrap cards

Basically we read the saved templates from zanalog/log index and show them as cards in user logs.