Comments (11)
@diabloevagto @oahehc 請給意見囉
from camera-trap-api.
如果要統一但又要涵蓋上述樣式, 應該是用 timestamp
from camera-trap-api.
所以是不論前端 widget 顯示什麼,一律都用 timestamp 寫入?然後顯示時間時再從 timestamp 轉?
from camera-trap-api.
我的想法是這樣
看有沒有人有其他意見
from camera-trap-api.
目前很多不用 timestamp 的理由是保存原始輸入資訊以供複查(相機可能會設定錯誤、還有EXIF的時間格式可能有出入、時區轉換差異),再來就是減少前端多一道 render 手續,這兩塊以外用的部分我同意用 timestamp。
dailyTestTime.time 是資料檢核用的,直接用 regex 就可以確認是否為定時測試照片。不然「每天中午12時」要以 timestamp 來表達並不方便。
from camera-trap-api.
前端的 render 其實可以統一以一個函式處理,函式中可設定 render 的格式,這樣未來如果要統一改成其它格式,只要改這個函式即可。
那麼:
- 事件的時間統一使用 timestamp
- 設定的時間(如 dailyTestTime.time)統一使用 ISO 8601
- 若是人工輸入的資料,或上傳的資料,事件的時間均加上一個 verbatim* 欄位供未來確認及除錯用
這樣可以?
from camera-trap-api.
會把 timestamp 除以 1000 的原因是什麼呢?
https://github.com/TaiBIF/camera-trap-api/blob/master/common/mixins/timeStamp.js#L11-L21
因為浮點數存進資料庫後在拿出來有可能會不一樣。
https://stackoverflow.com/questions/44693985/floating-point-numbers-do-not-match-in-aggregation
from camera-trap-api.
@trashmai : 「因為 javascript 的時間是微秒。」Hope this helps?
from camera-trap-api.
以我的經驗來說我習慣存 iso8601(2018-12-03T03:23:54.275Z),如果是跨國服務來說資料庫一定是 UTC,然後在前端用 JavaScript 轉成當地時間,因為有些國家有夏時令的問題,很難在後端處理。
MongoDB 好像可以用 ISODate https://docs.mongodb.com/manual/core/shell-types/
可以存到微秒
from camera-trap-api.
考慮 MongoDB 支援 ISODate,也許我們就以此格式儲存?
然後前端在準備 request JSON 時大概是用到這個 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString ?
from camera-trap-api.
no longer applicable
from camera-trap-api.
Related Issues (20)
- 修正計畫「 編輯設定」中的編輯狀態 HOT 1
- 初測延遲加上逐月的統計
- 修正篩選多物種時,只篩選出其中一種物種 HOT 2
- 上傳 csv,欄位錯誤的 error handling
- 批次上傳 Memory leak
- 帶 id 的 CSV 檔上傳,新增資料的處理
- 高海拔樣區和相機位置資料錯置 HOT 2
- 同一媒體檔案中缺漏資料的補充 HOT 1
- 敏感資料的處理
- 訂定計算結果匯出 CSV 格式
- 事業區、林班地、小區之圖籍資料
- 提供使用者判定之相機開始及結束工作時間,供計算選項考慮。
- 角況控制詞彙增加「無角」
- 計畫名稱及計畫簡稱不可重覆
- 資料分析-A. 相機工作時數 HOT 2
- 資料分析- B. 相對豐度指標的計算功能 - a: OI 值
- 資料分析- B. 相對豐度指標的計算功能 - b: 目擊事件
- 資料分析- B. 相對豐度指標的計算功能 - c: 捕獲回合比例
- 資料分析- C. 存缺(presence/absence)
- 資料分析- D. 活動機率(apparent probability of activity, APOA)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camera-trap-api.