@liuhange/dsh-data-asset-quality-score 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +7 -5
- package/package.json +22 -6
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const name = '@liuhange/dsh-data-asset-quality-score';
|
|
2
2
|
export const inject = ['tools'];
|
|
3
|
+
import { loadJsonConfig } from '@liuhange/dsh-data-asset-shared';
|
|
3
4
|
export function apply(ctx) {
|
|
4
5
|
ctx.tools.register({
|
|
5
6
|
name: 'score_data_quality',
|
|
@@ -17,10 +18,9 @@ export function apply(ctx) {
|
|
|
17
18
|
if (!args?.dataSource || typeof args.dataSource !== 'string') {
|
|
18
19
|
return JSON.stringify({ error: 'INVALID_ARGS', message: 'dataSource is required' });
|
|
19
20
|
}
|
|
20
|
-
const { readFileSync } = await import('node:fs');
|
|
21
21
|
let rulesConfig;
|
|
22
22
|
try {
|
|
23
|
-
rulesConfig =
|
|
23
|
+
rulesConfig = loadJsonConfig('BUSINESS_RULES_PATH', 'config/business-rules.json', '@liuhange/dsh-data-asset-shared/config/business-rules.json');
|
|
24
24
|
}
|
|
25
25
|
catch {
|
|
26
26
|
return JSON.stringify({ error: 'QUALITY_RULES_MISSING', message: '无法加载business-rules.json' });
|
|
@@ -31,8 +31,9 @@ export function apply(ctx) {
|
|
|
31
31
|
}
|
|
32
32
|
let policyDocuments = [];
|
|
33
33
|
try {
|
|
34
|
-
const policyConfig =
|
|
35
|
-
const
|
|
34
|
+
const policyConfig = loadJsonConfig('POLICY_REFS_PATH', 'config/policy-references.json', '@liuhange/dsh-data-asset-shared/config/policy-references.json');
|
|
35
|
+
const refs = policyConfig.policyReferences;
|
|
36
|
+
const stage = refs?.find(s => s.stage === 'QUALITY_SCORE');
|
|
36
37
|
policyDocuments = stage?.documents ?? [];
|
|
37
38
|
}
|
|
38
39
|
catch { /* empty */ }
|
|
@@ -43,7 +44,8 @@ export function apply(ctx) {
|
|
|
43
44
|
}
|
|
44
45
|
let data;
|
|
45
46
|
try {
|
|
46
|
-
const
|
|
47
|
+
const { readFileSync: rfs } = await import('node:fs');
|
|
48
|
+
const raw = rfs(args.dataSource, 'utf-8');
|
|
47
49
|
data = JSON.parse(raw);
|
|
48
50
|
if (!Array.isArray(data))
|
|
49
51
|
data = [data];
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liuhange/dsh-data-asset-quality-score",
|
|
3
3
|
"description": "Data quality scoring plugin: six-dimension quantitative scoring (normality + completeness + accuracy + consistency + timeliness + accessibility)",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
|
|
4
|
+
"version": "3.1.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/liuhange789/data-asset-inspector.git",
|
|
11
|
+
"directory": "packages/data-asset/data-asset-quality-score"
|
|
12
|
+
},
|
|
7
13
|
"type": "module",
|
|
8
14
|
"main": "lib/index.js",
|
|
9
15
|
"types": "lib/types/index.d.ts",
|
|
10
16
|
"exports": {
|
|
11
|
-
".": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
12
21
|
"./src/*": "./src/*",
|
|
13
22
|
"./package.json": "./package.json"
|
|
14
23
|
},
|
|
15
|
-
"files": [
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/**/*.js",
|
|
26
|
+
"lib/types/**/*.d.ts"
|
|
27
|
+
],
|
|
16
28
|
"license": "MIT",
|
|
17
29
|
"scripts": {
|
|
18
30
|
"typecheck": "tsc --noEmit",
|
|
@@ -24,5 +36,9 @@
|
|
|
24
36
|
"@deepseek-ai/dsh-tools": "0.0.1-rc.1",
|
|
25
37
|
"@liuhange/dsh-data-asset-shared": "^3.0.0"
|
|
26
38
|
},
|
|
27
|
-
"dsh": {
|
|
39
|
+
"dsh": {
|
|
40
|
+
"bundle": {
|
|
41
|
+
"patch": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
28
44
|
}
|