Is there a way to access the ontology within a Scenario in a separate pipeline? - foundry-scenarios

Is it possible to write a transform on the Scenario's state of the ontology. A user wants to take the output of a scenario and send to a third party supplier for their approval, but requires an Excel spreadsheet output. Thus we have a transform that intakes the ontology objects and creates the spreadsheet needed. Then the user will approve the scenario. How can I programatically access the scenario state?

Related

FaunaDB, make connection between different users, I.e. become friends

I have a use case where I want to connect two different user roles, and if they accept and want to connect, new features will open up. It is very similar to how friend requests work at Facebook or LinkedIn, opening up and showing more content. Let's call them role1 and role2.
All users are stored within a "users" collection with an id. Depending on their provided role within the document attached to the "users" collection, they can store additional data in their respective role-collection, i.e., role1 collection or role2 collection.
What is the best approach and structure to connect the two users, i.e., become "friends"? Should I have the connection stored in a new collection, named perhaps connections-collection, or multiple collections?
I'm using Next.js, NextAuth for user authentication, and FaunaDB as a database. I'm using Fauna's query language, FQL.
Have you perhaps seen fireship's video RE: fauna db? I think it covers what you want to do and how you can proceed.
Edit: There are many ways to implement this. Based on my understanding, perhaps you can have "Friends" and "Requests" arrays stored under a user document. That way you can differentiate between confirmed friends or a just request.
Example: When user1 initiates a friend request with user2, you store user1's ref under "Requests" of user2's document. When user2 confirms, you move user1's ref to the "Friends" array.
This is just a overly simplified idea and you may need to consider your options and the implications. You would need to plan and define the predicate in both roles so you would only see what is necessary.

How to set different access levels for dashboard data in Google Data Studio

Lets assume I am creating a google DataStudio dashboard for a sales data which is having sales records for countries.
For each country has a country manager and they are assign to single supervisor in Head Office.
My question is:
Can we develop a Google DataStudio DashBoard which is capable to restrict data only relevant to a particular country if it is viewing by a country manager and to show whole data relevant to all countries if it is viewing by the supervisor of country managers?
There is no easy solution to have a page-level permission, but there are three options.
Break up the report in to separate ones (this is the most simple solution, although it creates multiple reports)
Use Viewer's credentials instead of Owners’ credential (You must grand viewers access to your gbq data source, which is not ideal in most cases)
Filter by email (This works for small number of users, but quite cumbersome for multiple users)
For the option one, you can break up one "master report" that has all pages, and creating multiple sub-reports by using URL embedding by page
In your Data Source, create a column called "e-mail" and populate it with the e-mail address of the manager that you want to be able to see that particular line.
After you do this, use the "Filter by email" option in the Data Source:
And select the field you just created:
And there you are. Your data will only be searchable by the person you selected, based on the email they are using to access the dashboard.
If you want more than one person to be able to see a particular data, you'll need to duplicate the respective lines in the Data Source.

Conditional read access to DynamoDB table with AWS Amplify

I'm building an application with AWS Amplify, where I have three DynamoDB tables: Users, Posts and Subscriptions.
users can make posts
users subscribe to other users
user A can only see posts by user B if user A is subscribed to user B
Points 1. and 2. are easy to implement with standard graphQL mutations. But I'm stuck at how to implement 3. in an elegant way. Currently what I do is to use a lambda resolver.
Given inputs "user A wants to see user B", the lambda resolver does the following:
Query Subscriptions table to see if there's a document for "user A subscribed to user B"
if such a row exists, query Posts table and return documents. If not, return nothing.
This logic required two round trips, but since dynamo is fast I'm OK with this trade-off. There are other downsides though, so I'm wondering if there's a more Amplify-native way to do this? Some magic DynamoDB and #auth trickery perhaps?
Thank you!
If you are using multiple tables to store the data, the multiple query approach is your only option.
You can use transactions when mutating items across multiple tables, which is useful when you want to perform an operation based on a condition on an item in another table(s). But when it comes to a read operation, you have no such option.
Aside from re-designing your tables to support this access pattern, I don't think two reads is particularly bad.
If you wanted to handle authorization logic outside of DDB, you may want to look into AWS IAM and it's documentation on Fine-Grained Access Control. Among other features, IAM can restrict access to specific items in a table based on certain primary key values.

DocuSign Apex Toolkit Create Envelope with multiple datasources

I am very new to DocuSign and trying to create a proof-of-concept for integrating DocuSign with our own Managed Package for Salesforce. I understand how I can create an envelope, how to create a document based on a template, how to fill it with the data of my Salesforce record and also how to send it.
My issue though is that the data which needs to be filled into the DocuSign document is not entirely saved within the specified record. Some data such as certain KPIs are loaded from AWS but belong to the record you're looking at. To me it seems that when creating an envelope, you need to specify the record-id of the record you're trying to pull data from.
Is it possible to extend that by not specifying a record-id but rather an Apex Object or List for example?

GAE datastore -- proper ways to implement search/data retrieval in response to a user request?

I am writing a web app and I am trying to improve the performance of search/displaying results. I am relatively new to programming this sort of thing, so I apologize in advance if these are simple questions/concepts.
Right now I have a database of ~20,000 sites, each with properties, and I have a search form that (for now) just asks the database to pull all sites within a set distance (for this example, say 50km). I have put the data into an index and use the Search API to find sites.
I am noticing that the database search takes ~2-3 seconds to:
1) Search the index
2) Get a list of key names (this is stored in the search index)
3) Using key names, pull from datastore (in a loop) and extract data properties to be displayed to the user
4) Transmit data to the user via jinja template variables
This is also only getting 20 results (the default maximum for a Search API query.. I haven't implemented cursors here yet, although I will have to).
For whatever reason, it feels quite slow.. I am wondering what websites do to make the process seem faster. Do they implement some kind of "asynchronous" search, where a page loads while in the background the search/data pulls are processed, and then subsequently shown to the user...?
Are there "standard" ways of performing searches here where the processing/loading feels seamless to the user?
Thanks.
edit
Would doing something like just passing a "query ID" via the page work, and then using AJAX to get data from the datastore via JSON work? Like... can app engine redirect the user to the final page, pass in only a "query ID", and then search in the meantime, and then once the data is ready, pass the information the user via JSON?
Make sure you are getting entities from the datastore in parallel. Since you already have the key names, you just have to pass your list of keys to the appropriate method.
For db:
MyModel.get_by_key_name(key_names)
For ndb:
ndb.get_multi([ndb.Key.from_path('MyModel', key_name) for key_name in key_names])
If you needed to do datastore queries, you could enable parallel fetches with the query.run (db) and query.fetch_async (ndb) methods.

Resources