Managing a Stage

A Project consists of Stages ( for structuring the Project by subdividing a computer program into individual sub-programs.) Each stage have functionality for creating Properties, entering/uploading Data and writing Python scripts.

Clicking on a selected stage on the Process Flow Tab a user will be shown a menu to manage the stage. Clicking on the corresponding icon a user can manage following:

  • Edit Stage: User can change the name of Stage here.

  • Copy Stage: Copy a stage with all Properties, Data and Scripts.

  • Delete Stage and Disconnect connections

  • Add other Stage

  • Remove Other Stage

The pop up menu also have links to add and manage following :

Properties

Clicking on Properties will give a pop up form listing all the properties associated with a Stage. A user can then also add a new property by giving a Title and Type of property. There are predefined Types of properties (like Text, Number, Upload File, Barcode etc) which a user can use for adding a Data Property. Complete list of all the Properties with Notes is given in next section "Adding Data."

Clicking on a listed Property gives a form to update the Question related to the property (To be shown to Users Managers/Operators who will be tasked to upload/update data.) User can also make the property Required, add other Options, provide Limits or Delete a Property.

​

Types of Properties

Type of Property

Notes

Text

Question, Required, Stage ID

Number

Question, Required, Limits, Add Single Variable Chart (Line Chart or Histogram) and Multiple Variable Chart (Box Plot)

Choice(or)

Question, Required, Add more options, Add Single Variable Chart (Histogram or Pie Chart)

Multiple Choice (and)

Question, Required, Add more options, Add Single Variable Chart (Histogram or Pie Chart)

Date

Question, Required, Limits

Time

Question, Required

Upload File

Question, Required

Upload Multiple Files

Question, Required

Barcode

Question, Required

QR code

Question, Required

Smart Scanner

Question, Required

Location

Question, Required

Image

Question, Required

Video

Question, Required

Signature

Question, Required

TextArea

Question, Required

Computed

Question

Computed_array

Question

A Property is associated with a Question a User can submit (to be shown on the data input form). A User can also mark a Property as Required.

Date and Number Types of properties can also be provided with limits on maximum and minimum.

When a User creates any Properties (Variables) of Numbers, Choice or Multiple Choice Types a User gets to add Single Variable Charts (Pie Chart, Line Chart or Histogram) or Multiple Variable Charts (BoxPlot) on the User Dashboard.

Data

Clicking on Data will give a Pop up form to manage the data. A User can Add Data, View Data and check Data Spread here. Data can be added in the form or can also be uploaded using a Excel Sheet. A User can also Download a Sample file for uploading the data.

Python Scripts

Every stage can execute certain business logic expressed in python script upon insertion of data.

Clicking on Python Scripts will give a Pop up window showing all the Scripts related the particular Stage. Clicking on a Script Tab a user can Click on I/O , Edit , Delete, Info and Test to edit Script, Edit Name and Properties, Delete, get information and test the script.

I/O Tab

Clicking on I/O Tab gives list of all Input and Output Properties associated with the script. It also contains the script and a user can edit and Update the script.

Edit Tab

Clicking on Edit tab gives list of all Input and Output Properties and a User can add and delete Properties included with the script. User can also add and delete the Global Variables associated with the script. User can change the script Title and also give a Description of the script.

A User can also Bookmark and Deploy the script. After Deployment a User will not be able to Edit or Test a script.

Delete Tab

Clicking on the Delete Tab a user can delete a script by clicking on Delete Script Button.

Info Tab

Clicking on Info Tab gives the information about the script. This is same as the Description given on the Edit Tab.

Test Tab

A User can run the unittest on the script on the Test Tab and get the test response as Passed or Failed.

Test Script

import unittest
# You can accesss your script using 'mainscript'
import script_5df1a84dba09a742d900601d as mainscript

Log

Clicking on Log will give a Pop up window showing all the logs related the project. A User can Show More logs, Refresh the logs or Close the window.

API

Clicking on API will give a Pop up window showing all the APIs added the particular Stage. A User can update a API and also add new API by clicking on the + icon. User can a API using Create User API or Create Generic API Buttons.

User API

Clicking on Create User API will give a Pop up window containing a API form where API Title, API Request Type ( GET, GETALL, POST, UPDATE, DELETE, UPSERT) and Description should be provided by the User.

Example use case of Post API

Share data form from a Stage on Web Wynum Portal or App

To share a data form on web wynum portal or App a user can create a new User API and submit all the required fields namely API Title, API request Type (Here we select it as POST) and Description (Optional.)

On submission of the required data it will ask User to select Input Properties and Response Properties. User can submit the required Properties to create new API.

A user can share the Data form (exposed through the Post API) by providing the User Email. Clicking on the Share Project Button will open a Pop up window containing links for adding Collaborators and Users. A User can share the data form by clicking on Users Link and submitting the Select Stage, Title, Form Title, Component URL and POST URL to generate the required Tokens.

A User can then add Process User by entering the Email Address of the select Users.

Generic API

Clicking on Create Generic API will give a Pop up window containing a API form where API Token, API Title, API Request Type (GET, POST, UPDATE, DELETE) and Description should be provided by the User.

Example use case of GET API

Share data from one stage to another Stage to another Stage

In this example we will be sharing data from Calculation stage to Prediction Stage. To share a data form on web wynum portal or App a user can create a new Generic API and submit all the required fields namely API Title, API request Type (Here we select it as GET) and Description (Optional.)

On submission of the required data a Pop up window will give Secret Key and API Token and it will ask User to select Input Properties and Response Properties. User can submit the required Properties to create new API.

A User can then write Python Script to get the Data in the Prediction Stage. Secret Key and API Token are used in the script (Line no. 21 and 22) to get the datafrom Calculation Stage.

from wynum import Client
import requests
​
def send_mesage(sender_email, receiver_email, message, api_token,components_url, post_url, submission_id, response):
data = {
"Sender_email": sender_email,
"Receiver_email": receiver_email,
"Message": message,
"APIToken": api_token,
"Payload": {
"Components_url": components_url,
"Post_url": post_url,
"Submission_id": submission_id,
"Response": response
}
}
res = requests.post("https://api.wynum.com/apimessages", json=data)
return res.json()
def main():
secret = "6b85efb96cb1eb45179f9ed419d2d3439t"
token = "8992174"
client = Client(secret, token)
getdata = client.getdata()
print(getdata)
alpha = getdata[0]['alpha']
beta = getdata[0]['beta']
output['prediction'] = alpha + beta*input['year']
res = send_mesage(sender_email = 'hello@wynum.com',
receiver_email = input['user_id'],
message = "Prediction Result " + str(output['prediction']) ,
api_token = '3257293',
components_url = "https://api.wynum.com/getComponent/4993bac5aba569405d23f42e6f48a604",
post_url = "https://api.wynum.com/postStage/779b903316106aadd9c5b295e910d01f",
submission_id = input['id'],
response = ''
)
​
if __name__ == "__main__":
# stuff only to run when not called via 'import' here
main()
​