{% extends base.html %} {% block title %}{{ title }}{% end %} {% block content %} {% if handler.request.path == '/table' %} {% if handler.application.db %}
method path description parameters
GET /table/name 展示名为name的表
可选参数如右所述
sort 使用哪个字段排序,默认为插入顺序倒叙
order 顺序还是倒叙,默认为倒叙
page 当前页数,默认为1
count 每一页显示多少项,默认为20
f 当f=json时,返回json格式数据,可用于获取标注结果
POST /table/name 新增名为name的表
body为json格式,其字段类型描述如右所述
fields 有哪些字段以及其类型
docs 表示所有文档,为一个list,成员为dict
search 表示为哪些字段提供搜索
mark key表示哪个字段用于标记,value表示可取哪些值
unique结果是否唯一
如可选多个值并且docs字段内有值,其必须为list类型
DELETE /table/name 删除名为name的表

用于展示表格或者标注服务

curl -XDELETE http://{{ handler.request.host }}/table/test

curl -XPOST http://{{ handler.request.host }}/table/test -d '{
    "fields": ["id:int", "title:str", "publish_time:datetime", "tag:int"],
    "docs": [{"id": 1, "title":"hello", "publish_time": "2017-01-01 10:00:00" }],
    "search": ["id", "title", "publish_time"],
    "mark": [{"key": "tag", "value": [0, 1, 2], "unique": false}]
}' 

  
{% else %}
请先安装mongodb用于数据存储(./install.sh mongo)
{% end %} {% else %} {% include search.html %}
{% for field in handler.args.fields %} {% if field not in list(map(lambda x: x['key'], handler.args.marks)) %} {% end %} {% end %} {% for mark in handler.args.marks %} {% end %} {% for entry in entries %} {% for field in handler.args.fields %} {% if field not in list(map(lambda x: x['key'], handler.args.marks)) %} {% end %} {% end %} {% for mark in handler.args.marks %} {% end %} {% end %}
{{ field }}{{ mark['key'] }}
{% raw entry.get(field, 'hello') %} {% for value in mark['value'] %} {% end %}
{% end %} {% end %} {% block js %} {% end %}