Standings JSON

From PC2wiki
Revision as of 22:24, 20 June 2013 by Doug Lane (talk | contribs) (Format: more examples and info)
Jump to: navigation, search

Standings JSON

A future feature for pc2 is a JSON output/file that includes the equivalent of the Scoreboard HTML.

The JSON output will be delivered like the Event Feed and also be produced using pc2 reports.

Format

Each JSON output is created is an JSON array with zero or more JSON members. The output will be in a single long JSON string.

Sample JSON if no teams defined

[]

Each JSON Member is composed of a team member with optional problem members for example. This example is formatted in order to better show the example, the actual JSON will be a single line of JSON.

 [ {"id":"1","name":"University of Brevia","group":"Pangea"
	,"B":{"a":1,"t":20,"s":"solved"}
	,"D":{"a":1,"t":66,"s":"first"}
	,"E":{"a":1,"t":112,"s":"solved"}
	,"F":{"a":3,"s":"tried"}
	,"L":{"a":3,"t":152,"s":"solved"}},
 {"id":"2","name":"University of Fondu","group":"North America"
	,"B":{"a":1,"t":10,"s":"first"}
	,"D":{"a":1,"t":68,"s":"solved"}
	,"E":{"a":1,"t":122,"s":"solved"}
	,"F":{"a":2,"s":"tried"}
	,"L":{"a":3,"t":192,"s":"solved"}}
]

This same JSON example will be output as a single line, for example:

[{"id":"1","name":"University of Brevia","group":"Pangea","B":{"a":1,"t":20,"s":"solved"},"D":{"a":1,"t":66,"s":"first"},"E":{"a":1,"t":112,"s":"solved"},"F":{"a":3,"s":"tried"},"L":{"a":3,"t":152,"s":"solved"}},{"id":"2","name":"University of Fondu","group":"North America","B":{"a":1,"t":10,"s":"first"},"D":{"a":1,"t":68,"s":"solved"},"E":{"a":1,"t":122,"s":"solved"},"F":{"a":2,"s":"tried"},"L":{"a":3,"t":192,"s":"solved"}}]

General Format for problem members

{"id":"<Rank>","name":"<University_name>","group":"<Group_name>"
	,"<Problem_letter>":{"a":<hAttempts uh>,"t":<Elapsed_time>,"s":"<Results_phase>"}},

Fields and examples for both team and problem JSON members.

Name Description Example Type
Rank rank in contest 12 integer
University_name University/team name Oxford University String
Group_name Group/Region name Europe String
Problem_letter letter for problem D upper case char [A-Z]
Attempts number of attempts for problem 3 Integer
Elapsed_time time when solved 143 Integer
Results_phase results/info about run solved String: "tried", "solved", "first"