@app.route("<STR_LIT>", methods=["<STR_LIT:GET>"])<EOL>def summary():
exp = Experiment(session)<EOL>state = {<EOL>"<STR_LIT:status>": "<STR_LIT:success>",<EOL>"<STR_LIT>": exp.log_summary(),<EOL>"<STR_LIT>": exp.is_complete(),<EOL>}<EOL>unfilled_nets = (<EOL>models.Network.query.filter(models.Network.full != true())<EOL>.with_entities(models.Network.id, models.Network.max_size)<EOL>.all()<EOL>)<EOL>working = (<EOL>models.Participant.query.filter_by(status="<STR_LIT>")<EOL>.with_entities(func.count(models.Participant.id))<EOL>.scalar()<EOL>)<EOL>state["<STR_LIT>"] = len(unfilled_nets)<EOL>nodes_remaining = <NUM_LIT:0><EOL>required_nodes = <NUM_LIT:0><EOL>if state["<STR_LIT>"] == <NUM_LIT:0>:<EOL><INDENT>if working == <NUM_LIT:0> and state["<STR_LIT>"] is None:<EOL><INDENT>state["<STR_LIT>"] = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for net in unfilled_nets:<EOL><INDENT>node_count = (<EOL>models.Node.query.filter_by(network_id=net.id, failed=False)<EOL>.with_entities(func.count(models.Node.id))<EOL>.scalar()<EOL>)<EOL>net_size = net.max_size<EOL>required_nodes += net_size<EOL>nodes_remaining += net_size - node_count<EOL><DEDENT><DEDENT>state["<STR_LIT>"] = nodes_remaining<EOL>state["<STR_LIT>"] = required_nodes<EOL>if state["<STR_LIT>"] is None:<EOL><INDENT>state["<STR_LIT>"] = False<EOL><DEDENT>nonfailed_count = models.Participant.query.filter(<EOL>(models.Participant.status == "<STR_LIT>")<EOL>| (models.Participant.status == "<STR_LIT>")<EOL>| (models.Participant.status == "<STR_LIT>")<EOL>| (models.Participant.status == "<STR_LIT>")<EOL>).count()<EOL>exp = Experiment(session)<EOL>overrecruited = exp.is_overrecruited(nonfailed_count)<EOL>if exp.quorum:<EOL><INDENT>quorum = {"<STR_LIT:q>": exp.quorum, "<STR_LIT:n>": nonfailed_count, "<STR_LIT>": overrecruited}<EOL>db.queue_message(WAITING_ROOM_CHANNEL, dumps(quorum))<EOL><DEDENT>return Response(dumps(state), status=<NUM_LIT:200>, mimetype="<STR_LIT:application/json>")<EOL>
Summarize the participants' status codes.