-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for JSON-LD data. #15
Comments
這看起來很不錯,我沒用過 JSON-LD,可以多舉一些例子嗎?比如說下面這個測試如果套用 JSON-LD 會需要做哪些修改? it('若「無」天災、事變或突發事件,但雇主要求於例假日工作並且徵得勞工同意時,此為違法加班' +
'工資加倍發給。月薪制勞工,平均時薪 150 元並工作 2 小時,' +
'加給工資 1200 元(勞基法 39, 40 條),並且無額外補休', () => {
const accident = false;
const consent = true;
let result = std.overtimePay(150, 2, std.REGULAR_LEAVE, consent, accident);
/*
expect result looks like this:
{
status: std.ILLEGAL,
value: 1200,
extraLeave: {
value: false
},
reference: [
{
id: 'LSA-39',
description: '第三十六條所定之例假、休息日、第....',
url: 'http://laws.mol.gov.tw/FLAW/FLAWDOC01.aspx?lsid=FL014930&flno=39'
},
{ id: 'LSA-40' },
{ id: 'LSA-79' },
{ id: '台八十三勞動一字第 102498 號函' }
],
fines: [
{ min: 20000, max: 1000000, according: 'LSA-79' }
]
};
*/
expect(result.value).eq(1200);
expect(result.extraLeave.value).eq(false);
expect(result.reference[0].id).eq('LSA-39');
expect(result.reference[1].id).eq('LSA-40');
expect(result.reference[2].id).eq('LSA-79');
// https://laws.mol.gov.tw/FLAW/FLAWDOC03.aspx?datatype=etype&lc1=%5bc%5d%E5%8B%9E%E5%8B%95%E5%9F%BA%E6%BA%96%E6%B3%95%2c40&cnt=19&recordno=10
expect(result.reference[3].id).eq('台八十三勞動一字第 102498 號函');
expect(result.status).eq(std.ILLEGAL);
// 79 條,罰則介於二萬到一百萬
expect(result.fines[0].according).eq('LSA-79');
expect(result.fines[0].min).eq(20000);
expect(result.fines[0].max).eq(1000000);
}); |
所以如果是這個例子,在 |
@yurenju 沒有更多例子可提供因為mydaka專案已長草許久,概念分兩個方面講,一個是schema一個是JSON-LD。 schemaschema定義好後相關值的驗證可交給ajv負責,一些值就不需寫單元測試來驗。 ajv https://www.npmjs.com/package/ajv JSON-LDJSON-LD部分可用工具或google的結構化資料測試工具來檢驗,不過JSON-LD語義定義一直沒找到適用工時模型,後續如這個專案有興趣納入這類作法可移到這裡一起做,另外這裡的需求返回值還有法條語義模型待探索。 https://search.google.com/structured-data/testing-tool Legislation : Proposed extension · Issue #1156 · schemaorg/schemaorg |
@y12studio 這次 g0v 大松有要來嗎?可以見面討論一下 |
另外目前的參與者都有在 g0v slack 裡面的 #labor 頻道,有興趣可以上來聊聊! |
輸入參數與返回值支援JSON-LD格式定義的可行性?例如輸入工時表,輸出總工時統計或違法等JSON-LD定義的返回值。
舉例 https://github.com/g0v/mydaka/blob/master/test/draft02.json
The text was updated successfully, but these errors were encountered: