====== Visualytics In Depth ======
{{/dokuwiki/lib/images/smileys/icon_exclaim.gif|:!:}} This article is currently under construction and we are currently trying to make it better every day {{/dokuwiki/lib/images/smileys/icon_biggrin.gif|:-D}} {{/dokuwiki/lib/images/smileys/icon_exclaim.gif|:!:}}
===== Summary =====
Visualytics communicates with all our Python APIs via endpoints in a middleware called **OSA** and you can find more information about OSA [[start#onsight_analytics_osa|here]].
===== In-Depth =====
==== Project/Folder Structure ====
The most important folders/files in Visualytics are the following:
* inc/
* pages/
* templates/
* index.php
=== index.php ===
Is the “entry point” of the application. First of all it includes the files **inc/logic.php** and **inc/req.php**. Both files are used to make, let's say, 90% of the application. You will find more details about both below. Here it's checked also if the user is logged in or not, call some functions to render the template, set user language and so on.
=== inc folder ===
The most important files here are the **inc/logic.php** and **inc/req.php**. In **logic.php** you will find all code that, let's say, implement the “frontend logic”, almost everything that will be rendered have your logic here. For example: the navbar items based on user role, the notifications and which page will be rendered (which template file will be rendered from templates folder). In **req.php** you will find all endpoints (calls) that Visualytics uses to communicate with OSA (//and some endpoints communicates with PCI also, but only a few, for example, login//). All endpoints are described also below in details.
=== pages folder ===
All pages that you see in the URL params are here. For example: index.php?**page=dash** that **page=dash** is rendered because there's **dash.php** stored here. So if you have a problem with a specific page, you should look for it here.
=== templates folder ===
There's where all the HTML things are stored and overwritten with the logic from **logic.php**.
==== OSA Endpoints (req.php) ====
{{/dokuwiki/lib/images/smileys/icon_exclaim.gif|:!:}} **NOTICE** {{/dokuwiki/lib/images/smileys/icon_exclaim.gif|:!:}}
UNDER CONSTRUCTION, PLEASE, IF YOU CAN/WANT, YOU COULD ALSO CONTRIBUTE. IF YOU HAVE DONE AN API FOR VISUALYTICS, YOU COULD ADD HERE SO MANY DETAILS AS YOU WANT. LINKING IT HERE WOULD ALSO BE COOL!
=== Common Functions ===
*
function request: used to send all requests to PCI
*
function request_onsight_post: used to send POST requests to OSA
*
function request_onsight_get: used to send GET requests to OSA
=== APIs Functions (to be done) ===
== Notifications API ==
*
function get_notifications: get all unread notifications
*
function set_notification_as_read: set a notification as read