Tutorial and Walkthrough
We will walk through an example of adding data to the UKCN and then using it in the Knowledge Client.
You should have already installed the software. If not, go follow the installation instructions.
We demonstrate a real-life scenario where three users are collaborating to process the COVID-19 data during two weeks. Alice has some raw data that wants to share with others. Betty wants to do a predictive model with a trackable data source that is easy for debugging data and share the results. Charlie wants to analyze Betty's work and generate pictures for government reports.
On Monday, week one, the first user, Alice, works at a data collection agency. Alice fetched data from covidtracking.com. Then Alice processed the data to only get the latest 20 day's COVID-19 cumulative positive cases for all states in the US. After processing, Alice published the result as a knpsValue and gave it a label.
knps.publish_new(result,val_comment,"LatestCovidData","Alice")
The parameters are - data that the user wants to publish - a required comment - a label for this knpsValue - the name of user.
On Wednesday, week one, the second user, Betty, who works at a university received the knpsValue from Alice via an email. Betty first loaded the variable with the ID given by Alice. Next, Betty extended the data from Alice with a regression model, yielding a prediction for the next day’s case number for each state in the US. After processing data locally, Betty published the result as a knpsValue, and gave it a label.
VAR_LABEL_GIVEN_BY_ALICE = "LatestCovidData"
data_source = knps.get_label_content(VAR_LABEL_GIVEN_BY_ALICE)
knps.publish_new(rst, val_comment, "CovidPrediction",
"Betty", [VAR_LABEL_GIVEN_BY_ALICE, ])
The first four parameters are the same. The last parameter is the label of the knpsValue that the current knpsvalue depending on.
On Friday, week one, Charlie, a government policymaker, was searching for a reliable data source on the internet. Charlie went to the main page of the KNPS, and got the label of the knpsValue generated by Betty. With the prediction results from Betty's research, Charlie was able to generate a visualization of the prediction. By transferring the graph to a knps.File type, Charlie published a knpsValue in the same way as mentioned before and gave it the label "PredictionPic". Charlie also sorted the predictions and got ten states with least predicted cases. Charlie published this with knpsValue and gave it the label "TenStatesWithFewestCovid"
LABEL_FROM_BETTY = "CovidPrediction"
total_val = knps.get_label_content(LABEL_FROM_BETTY)
pre1 = knps.File("predict_1.png")
knps.publish_new(pre1, "Predict image for week one",
"CovidPredictionPic", "Charlie",
[LABEL_FROM_BETTY, ])
knps.publish_new(least_list,
"Ten states with the fewest COVID cases",
"TenStatesWithFewestCovid",
"Charlie", [LABEL_FROM_BETTY, ])
In the first week, data flew from covidtraking.com to Alice, then to Betty, and finally to Charlie. Users can go to the main page of KNPS and see the newly published knpsValues. They can hover over to see a brief description or double click for a detailed page.

Blue squares mean different users. Rounded rectangles mean the immutable knpsValues. KnpsValues' automatically generated identifiers are shown in the black square and their comments are shown below the identifiers. Black squares represent the current content of a label. Arrows point from data sources to dependent data.
On Monday, week two. The first user Alice fetched the data from covidtracking.com again, and updated the knpsvalue of the label "LatestCovidData".
knps.publish_update(rst, comment, "LatestCovidData", "Alice")
On Wednesday, week two. The second user Betty also updated the knpsValue of the label "CovidPrediction" based on the updated knpsValue from Alice. The first four parameters are the same, and the last parameter is the label of the knpsValue that the current knpsvalue depending on.
PREV_LABEL = "CovidPrediction"
VAR_ID_GIVEN_BY_ALICE = "LatestCovidData"
data_source = knps.get_label_content(VAR_ID_GIVEN_BY_ALICE)
knps.publish_update(rst, val_comment, PREV_LABEL,
"Betty", [VAR_ID_GIVEN_BY_ALICE, ])
On Friday, week two. The third user Charlie updated the knpsvalue of the label "PredictionPic" and "TenStatesWithFewestCovid".
LABEL_FROM_BETTY = "CovidPrediction"
PREV_PIC = "CovidPredictionPic"
PREV_VID = "TenStatesWithFewestCovid"
total_val = knps.get_label_content(LABEL_FROM_BETTY)
knps.publish_update(pre1, "Second week prediction image",
PREV_PIC, "Charlie", [LABEL_FROM_BETTY,])
knps.publish_update(least_list, "Ten states with the \
fewest COVID cases", PREV_VID,
"Charlie", [LABEL_FROM_BETTY, ])
The overall dataflow is from covidtracking.com to Alice, then to Betty, and finally to Charlie.
