How to use plotly Dash as a dashboard for user specific data - flask

I want to integrate plotly Dash with my web app. I have data regarding a user like
leads found
meeting done
orders found
and other details of users per company.
So I want to pass the company_id and user_id and then get the report for only the specific user. He can filter between dimension or anything but he can't see the data for other users. What I found online is mostly a full dashboard. Is there an option to pass parameters in the api call, and then pass the data to plotly DASH and generate graph?
Please provide any resources if possible.

Not sure but maybe try to give the port:
https://example.com:5000/api/hello

Related

Show dashboard conditionally based on authenticated user in power bi

I have the following use case, and I appreciate that this is probably not how power-bi is intended:
I'd like a template dashboard. For which the data supplied and viewed differs per authenticated user.
A user logs in with a token via oath. This contains information on the type of dashboard he is allowed to view. When he is logged in, a query should be ran and display his data in the template dashboard.
When another user logs in (with another id), the same query is run (with different arguments/params, based on his id), but retrieves different data. It is then displayed against the same template dashboard.
Is this at all a feasible use-case in power-bi. And if it isn't, what tooling does offer this option? It seems like most dashboarding tools are tailored towards having a single set of enterprise users, use the platform for management information.
Sounds like you are after Row-Level Security functionality in Power BI. A good place to start is by reading the documentation:
https://learn.microsoft.com/en-us/power-bi/admin/service-admin-rls

Power BI Embedded Report Picker

I have an embedded site for my users to view a report. I have one master login for Power BI that all customers are routed through.
Authentication and the request are done through a .NET backend using PowerBI.Api.V2. Everything works well when I hardcode a single reportId and embed the fullscreen iframe.
My question is for customers that have multiple reports; Is there a built in report-picker-report that I can embed where the report selection is already handled for me? Or should I work on building an interface after retrieving the list of reports my users can pick from?
No, there are no built-in pickers. Power BI provides an API interface and you must implement these for yourself. Of course, you can build these pickers and make them available for us :)
To get list of workspaces you need to call Get Groups. This will give you a list of user's workspaces. You can show their name property values to the user, but you will need their id (the guid). When you know the id of a workspace, you can list the reports in it by calling Get Reports In Group. The same way you can call Get Dashboards In Group and Get Tiles In Group.

Is there a way to pre-filter a powerBI report server side?

I have uploaded a report, and using the .net SDK I've embedded said report into my website. However we show private data for many organizations. If I edit the reports iframe url to filter the report by the users org id so they can only see data for their organization then that ends up being a URL you can edit in javascript on the client side so a use could put another id there and view some other organizations data.
Is there any way possible to filter the data a report shows before it is sent client side?
I know you can edit the report file it'self but if you have hundreds of organizations, you'd need 100 copies of the same report which is obviously a maintenance and upkeep nightmare.
I would use the "Row Level Security" (RLS) feature for this requirement. Basically you set up roles, assign users to them and assign DAX expressions to them to filter the data.
There's a good explanation of it here:
https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-rls/
The most efficient design of RLS (from a coding and admin perspective) is if you can feed in a username variable and filter your data by that (as shown in that example).

Saving Data To Sitecore Analytics From Custom Code

I have been using Sitecore for a couple of years, and now looking to begin utilizing the Experience functionality found in Sitecore 8.
I have a view that will capture some user-provided data. How do I go about creating a "person" (don't know the correct Sitecore terminology) in the Analytics database from custom code.
You'll need to create a Contact. Contacts are a kind of profile store for xDb and allows you to store data about your visitors. A contact has a built in list of facets (email, phone number, name etc) that make up the contact record, but it's also possible to create your own facets.
If you are building a form to capture data you can use the new Tracker api to identify and update facets on a contact.
Here's some code to do this:
https://github.com/ianjohngraham/CoreBlimey.Utils/blob/master/CoreBlimey.Utils/xDB%20Contact%20Creator/CreateContact.aspx.cs
There's a walk through of how the code fits together here:
https://m.youtube.com/watch?v=Jq6TpMgUGAk
(Apologies for the sound quality)
Also if you are using the WFFM module in Sitecore 8 there are some new save actions that will create contacts and store xDB data.
You may want to spend time on the docs. Please refer here for articles and guides related to Personalization and Personas.
Most of the configuration can be specified in Experience Analytics within Sitecore and you can leverage Rules Engine to perform actions.

Facebook opengraph insights api on specific post id from my app

I want to build a dashboard that returns more customized insights from the insights generated by app.
The app is a facebook connect website that users visit and view a list of products. They can post to facebook about that particular product by sharing a custom story that incorporates that product on their timeline.
When I go to the insights for my app, it does a great job of showing me all social impressions for all custom stories that were generated on my site.
I'd like to narrow that down even more for specific products.
My plan is to record the object ids that are generated by these actions and link them to a partucular product in my database.
I'd then like to create a new dashboard page that will allow me to login, request read_insights permission from me and then use that object_id:product mapping from my database to show how many social impressions where recorded for a given product's object_ids.
Is this possible? I've read alot about it but still haven't found the most elegant way to get a segmented report of social impressions per type of content that was posted.
Thanks for your time.
The implementation all depends on which platform you want your app to run on.
The first major component is you must have a Facebook developers account which is easy to signup for. Just go to developers.facebook.com and register. Takes like 2 mins. After that you will need to create your first app and add the correct domain name where your app will be hosted and what platform it will run on. (iOS, Android, Web, ect.) Once that is finished you can make your app public so you can use the Facebook API in your code.
For the app creation itself. The first thing you need to do is import the correct API for your platform. Which you can find a walk through at https://developers.facebook.com/docs/. Once the API is imported you must build a Facebook object which contains your app id and possibly app secret. If you're using JavaScript you don't want to use the app secret because it will be visible to the public.
Now that you have your Facebook object you must require the app users to log in and grant permission to your app. You can add extended permissions to your log in process by adding a scope value to the log in button generated by Facebook. Here is an example.
<fb:login-button id="loginBtn" max_rows="1" scope="basic_info,read_insights,manage_pages" size="medium" show_faces="false" auto_logout_link="true"></fb:login-button>
After the user is logged in you can now query information from the users account using Facebook Api calls to Social Graph. Facebook also provides a tool to help you figure out what information you can query. https://developers.facebook.com/tools/explorer
Everything else you want to do with the app can be done by Facebook API calls. You just need to insure you grant the user the correct permissions before making the API calls.
API calls are a little different depending on which language syntax you are using but they all follow the same data model and return some array of responses which can be parsed using JSON or the standard array format. The Graph Explorer tool listed above will show you the output for your queries so you can handle them accordingly.
I hope this helps gets you started.
EDITED
Here's the implementation in JavaScript
function getMetric(){
// make the API call
FB.api(
"/{app-id}/insights/application_opengraph_story_impressions",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
}
Here's the reference now that Facebook docs are back up https://developers.facebook.com/docs/graph-api/reference/insights
application_opengraph_story_impressions will probably give you the total impression of all stories made by your app. I ran it against my Facebook app and it came back empty but I don't have any stories so it might work with your's. Also to note in the documentation there is an * by this metric and I could't find what that means.
I'm pretty sure that right now Facebook don't give developers ability to get insights about app custom stories.
Currently Facebook documentation has the following Graph APIs for Insights data:
/{page-id}/insights
/{app-id}/insights
/{domain-id}/insights
/{post-id}/insights (where this is a Page post)
So /{post-id}/insights won't work because custom story is actually user's post and others endpoints don't apply to your case.
As far as I know the only other option to access Insights is FQL. For that you'd use insights table in a manner similar to this:
SELECT ... FROM insights WHERE object_id = ... AND metric = ... AND end_time = ... AND period = ...
Now most likely this also won't work with your custom story posts (I don't have posts which I could try it on right now, so I can't tell) but at least it is not explicitly stated so in the documentation, so you should probably try it out.
UPDATE:
I wasn't able to get any insights data via FQL, although as far as I understand the following code should have gave me at least something (object id is for my page):
SELECT breakdown, end_time, event, metric, object_id, period, value FROM insights WHERE object_id = 224981264214413 and metric = 'page_fans' and period = period('lifetime') and end_time = 1395597892
But it results just in
{
"data": []
}
Facebook also has some pretty old bug report about similar topic: https://developers.facebook.com/x/bugs/508088155954330/ where they confirmed the issue, assigned it, and... did nothing to fix it for 6 months.
In case FQL doesn't work, my suggestion to you is - use your own analytics code to track the creation of custom stories and get the friend count of the users. It won't show you the real exposure of the posts but at least you will see some data on which types of custom stories where posted more often and what was the maximum potential friend count that could have seen them. By the way - to make charting easier, you could use Google Analytics events for that.