taibif / camera-trap-api Goto Github PK
View Code? Open in Web Editor NEWRESTful API
RESTful API
Related to TaiBIF/camera-trap-webapp#68
Once #6 PR is merged. we'll get many errors. like this,
So anyone can help to fix it?
cc @cjk-halodule
Related to TaiBIF/camera-trap-webapp#63
Related to #25
前端實作 Upload files Securely to AWS S3 Directly from Browser
API 端應設置對應的 bucket 位置
目前似乎是在 /project/bulk-update 下?
(後端網站service處理部分)
判斷是否為 ZIP
重覆性檢查
/api/v0.5/...
Then,
/api/v1
[{
"_id": OrcID_XXXX-XXXX-XXXX-XXXX,
"$set": {
"name": "New Name",
"email": "New Email"
}
}]
Related to TaiBIF/camera-trap-webapp#69
Related to TaiBIF/camera-trap-webapp#57
與 TaiBIF/camera-trap-webapp#18 相關
需要送出林班地 JSON 供前端套疊
Expected POST application/json object:
{
"decimalLatitude": "24.564853",
"decimalLongitude": "120.991452"
}
Expected response application/json
{
"query": {
"decimalLatitude": "24.2849853",
"decimalLongitude": "120.7340352"
},
"results": [
{
"type": "Feature",
"properties": {
"Name": "東勢處",
"description": null,
"altitudeMode": "clampToGround",
"CMPT": "3",
"AREA": "790277.780053",
"WKNG": "8",
"FID": "1",
"DIST_C": "東勢處",
"DIST": "03",
"Field_1": "東勢處",
"WKNG_C": "八仙山" },
"geometry": {
"type": "MultiPolygon",
"coordinates": [ [ [ [ 120.734243717809093, 24.284491143322999 ], [ 120.734545820319696, 24.284567597614569 ], [ 120.734410083969905, 24.285020350672809 ], [ 120.734291023148501, 24.285417040780661 ], [ 120.734284836437496, 24.285437653505401 ], [ 120.734278135904702, 24.28547086374072 ], [ 120.734195237479099, 24.285748970890761 ], [ 120.734065208922004, 24.285852237639141 ], [ 120.734057016677795, 24.285836377101269 ], [ 120.734056278880601, 24.28583495100635 ], [ 120.734056250359899, 24.285823104678268 ], [ 120.733962132776696, 24.285516133988011 ], [ 120.733744241223306, 24.284804710222581 ], [ 120.733844003884897, 24.284739381894511 ], [ 120.7338193504401, 24.2846068229106 ], [ 120.733756587505795, 24.28427007817363 ], [ 120.733906834895095, 24.284234843986361 ], [ 120.734354091737401, 24.284129957898259 ], [ 120.734243717809093, 24.284491143322999 ] ] ] ] }
}
]
}
When no intersect:
{
"message": "No compartment found.",
"coordinate": {
"decimalLatitude": "24.564853",
"decimalLongitude": "120.991452"
}
}
As this is an independent service endpoint, two files are expected in /common/models/
Model name would be: ForestCompartmentBoundary
參考
不過應該是不會需要 loopback 特別的支援,這裡是需要 point-in-polygon 的 mongo query 再把 GeoJSON object 送出來即可。
Related to #19
Related to TaiBIF/camera-trap-webapp#67
Related to TaiBIF/camera-trap-webapp#48
Define path for both preview and large image file.
Related to TaiBIF/camera-trap-webapp#40
如題,Related to TaiBIF/camera-trap-webapp#39
project/* 似乎沒有能夠調出一個計畫下所有樣區的說明?
https://nodemon.io/
We need auto-restart when the file was modified.
Must have
Good to have
Related to TaiBIF/camera-trap-webapp#55
若相機位置有錯誤資料,相機位置的名稱後方會有「錯誤數量的提示」
新增 API
GET /project/{id}/multimedia-annotation-error-cameras?site=&subSite=
{
"results": [
{
"site": "苗栗",
"subSite": "南庄鄉田美村",
"cameraLocation": "HC20B",
"errorCount": 255
},
{
"site": "苗栗",
"subSite": "南庄鄉田美村",
"cameraLocation": "HC20A",
"errorCount": 480
}
]
}
回傳結果為依據 MultimediaAnnotation.multimedia_error_flag 為 true 的資料進行 group。
Current manual deployment:
.ebextensions
client
common
server
package.json
Continuous Integration, using master branch for dev environment.
Related to TaiBIF/camera-trap-webapp#44
Nelson: prettier 和 operator-linebreak 都有各自的標準,過不了 eslint
試著加過各種括號,但會被 prettier 要求移除
根據昨天的討論,先 assign 給 @dca ?
Given that the value is unpredictable and the usage of the value as ID is uncertain, suggest drop the property.
Post
{
"userId": $userId, // OrcID_XXXX-XXXX-XXXX-XXXX
"projectId": $projectId, // 欲加入的計畫id
"role": $role // 角色,
}
Response
{
"userId": $userId, // OrcID_XXXX-XXXX-XXXX-XXXX
"projectId": $projectId, // 欲加入的計畫id
"projectTitle": "", 加入計畫名稱
"name": "", // 姓名
"email": "", // 電子郵件
"role": $role // 角色,
}
Related to TaiBIF/camera-trap-webapp#64
current authentication:
try {
// TODO: camera-trap-user-id 只在測試環境使用,正式環境要把這個 headers 拿掉
userId = req.headers['camera-trap-user-id'] || req.session.user_info.userId;
} catch (e) {
callback(new errors.Http403('使用者未登入'));
}
問題:
related to TaiBIF/camera-trap-webapp#13
b. 關聯標注
Given that the value is unpredictable and the usage of the value as ID is uncertain, suggest drop the property.
接「下一步」沒有反應。是 route 的設定?
Must have
Good to have
Related to #24
Related to TaiBIF/camera-trap-webapp#44
版本紀錄需要依照前端採用的資料更新方式設計批次更新以外的機制。
@diabloevagto:
/annotation-revision/query
這隻 api 的 modifiedBy 請改成要顯示的使用者名稱
Related to TaiBIF/camera-trap-webapp#5
最後更新時間定義上是該選定範圍最近一筆更動(回收或辨識)過的資料
所以是比較 location-month-identified-num.js 及 location-month-retrieved-num.js 的資料集中最新的一筆來顯示時間。
從 此處 同一查詢條件的資料結果找出最新的一筆為最後更新時間,亦即 modified 欄位。
Related to TaiBIF/camera-trap-webapp#16
目前有許多地方使用 projectTitle 為 id,非一般作法。須統一使用 projectId 為 關連用途。
Unified file naming (I think _
is not generally convention in JS community.)
e.g.
https://github.com/TaiBIF/camera-trap-api/blob/master/server/boot/create_indexes.js
ESLint rules should extend Airbnb and integrate pre-commit hooks (also prettier).
Separate out ESLint rules for easy to share in each repo (maybe is called TaiBIF/eslint-base
)
CI/CD integration.
Until / API testing.
Remove sensitive information switch to .env instead of.
Don't put builded code in repository.
Add node
in package.json
use yarn
instead of npm
(optional but strongly recommend.)
clean up unnecessary packages
eslint-plugin-react
serve-favicon
@oahehc mentioned:
/project/related-to-me => 500
/announcement/query => 502
/ctp-user/me => 500
/announcement/notifications => 502
目前的 error 是以 500 處理,不利前端除錯。
根據 11/12 討論,除了說明以外,就暫時的 unit test 而言,必須有
While we are improving code quality and applying eslint rules, we need tests to ensure the API functioning as expected, in other words, not breaking the working state.
@trashmai can you please write such tests so others can work on code with peace in mind? Thanks.
目前開發環境 dev api 後面的 MongoDB 是放在中研院,應該要一併部署到 AWS。
@rwu823 正著手進行 AWS Elastic Beanstalk 環境的自動化建置,也建立了 api-dev 環境。
Related to #26
TaiBIF/camera-trap-webapp#44 (comment)
新增 API
GET /project/{id}/multimedia-annotation-error-sites
{
"results": [
{
"site": "新竹",
"subSite": "南庄30林班",
"errorCount": 142
},
{
"site": "臺東處",
"subSite": "NULL",
"errorCount": 2127
},
{
"site": "苗栗",
"subSite": "南庄鄉田美村",
"errorCount": 735
}
]
}
回傳結果為依據 MultimediaAnnotation.multimedia_error_flag 為 true 的資料進行 group。
畫面可編輯的欄位如下
"projectTitle": "測試計畫1 // 計畫名稱",
"shortTitle": "測1 // 計畫簡稱",
"funder": "林務局 // 委辦單位",
"projectId": "FB-test-cameratrap-01 // 計畫編號",
"principalInvestigator": "測試principalInvestigator // 計畫主持人",
"projectStartDate": "2018-10-15 // 計畫時間:起",
"projectEndDate": "2018-12-10 // 計畫時間:迄",
"adminArea": [ // 計畫地區, 見 WF 2.3.7
"苗栗縣",
"新竹縣"
],
"abstract": "// 計畫摘要",
"remarks": "// 備註",
系統的 log 處理應該按照類別 (status, debug, error ...) 紀錄在可以設定的位置,避免直接輸出在 console 中。
需要一個訊息單元統一處理系統端(logging)及需要送到 response 的狀態。
目前從 API 文件來看,日期格式有:
"dailyTestTime": [ // 可先略過這項
{
"since": 1539593959,
"time": "12:00:00"
}
],
"projectStartDate": "2018-10-15 // 計畫時間:起",
"projectEndDate": "2018-12-10 // 計畫時間:迄",
"abnormalStartDate": "2017/02/08", // 異常資料時間 起
"abnormalEndDate": "2017/03/01", // 異常資料時間 迄
"created": 1540788756.494,
"modified": 1542014471.609,
"corrected_date_time": "2017-02-09 17:28:29",
For role: ProjectManager | Researcher
endpoint: project/data-field/add
3.2.3 彈出對話框的欄位有:
預期在 3.2.3 按下確定送出時,後端的 project/{$projectId}/data-field/add 及接受的 POST 格式:
{
"projectId" : "",
"userId" : "OrcId-*",
"key" : "", // (留空)
"label" : "", // 角況
"widget_type" : "", // select | string | datePicker
"widget_date_format" : "", // YYYY-MM-DD hh:mm
"widget_select_options" : [
{
"key" : "", // (留空)
"label" : "", // 例如性別 M | F
},
{
"key" : "", // (留空)
"label" : "", // 例如年齡 juvenile | adult
},
],
"description" : "", // 備註內容
"fieldStatus" : "", // pending | approved | rejected
}
系統收到 POST 物件後存入 db.DataFieldAvailable 中並傳回新增物件內容在 response 中:
{
"message" : "Request successfully submitted."
"dataFieldDefinition" : {
"projectId" : "",
"userId" : "OrcId-*",
"key" : "", // (留空)
"label" : "", // 角況
"widget_type" : "", // select | string | datePicker
"widget_date_format" : "", // YYYY-MM-DD hh:mm
"widget_select_options" : [
{
"key" : "", // (留空)
"label" : "", // 例如性別 M | F
},
{
"key" : "", // (留空)
"label" : "", // 例如年齡 juvenile | adult
},
],
"description" : "", // 備註內容
"fieldStatus" : "pending",
"created" : 1543110609.074,
"modified" : 1543110609.074
}
}
Related to TaiBIF/camera-trap-webapp#52
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.