Closed agrignard closed 4 years ago
Seems to work pretty well now for a Hello World indicator sent by GAMA with this method
action sendIndicator(string type){
string myIndicator;
myIndicator<-"[{\"indicator_type\":\"" + type+"\",\"name\":\"Gama Indicator\",\"value\":"+length(block)+",\"viz_type\":\"bar\"}]";
save myIndicator to: "indicator.json" rewrite: true;
file JsonFileResults <- json_file("./indicator.json");
map<string, unknown> c <- JsonFileResults.contents;
try{
save(json_file("https://cityio.media.mit.edu/api/table/update/"+city_io_table+"/indicators", c));
}catch{
write #current_error + " Impossible to write to cityIO - Connection to Internet lost or cityIO is offline";
}
write #now +" Indicator Sucessfully sent to cityIO at iteration:" + cycle ;
}
see https://cityio.media.mit.edu/api/table/dungeonmaster/indicators
Nice! Did you push this?
Yes just pushed with your modification also
Looks good! Let's try something more agent-based-like to help us think about the record mode for the simulation. Let's do a random walker that moves between the blocks and count the number of times it visits a park?
Yes of course this is just the Hello World. There is no agent yet in the model to keep it simple for now.
Also we need to be able to send several indicator, right now it just send the last, we should have a list of indicator sent
I already started working on this, see #142
4f8ba7c9c1c54ddb20db9be1b90f3bf96a6fd259 makes indicators their own species.
I think we can close this for now. The numeric indicators are working pretty well. We can reopen if we need to develop them more.
Referencing a commit with documentation here:
8ab9ea8e2f369f477516e259edba1f132953777e
I guess we can also build this using the same logic as the other two indicators and using cityio_agent
as the parent class.
All indicators now use cityio_agent
as their parent class.
Provide an exemple to build and send a numerical indicator to cityIO.
This need to be send here https://cityio.media.mit.edu/api/table/dungeonmaster/indicators
And here the format of the indicators