Skip to content

Commit f74aa8a

Browse files
authored
Merge pull request #607 from OpenKnowledgeMaps/data-processing-refactoring
Data processing refactoring
2 parents d45814a + 78f9992 commit f74aa8a

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

server/storage/test.sqlite

1.43 MB
Binary file not shown.

vis/js/dataschemes/defaultScheme.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,24 @@ import {
77
stringArrayValidator,
88
} from "../utils/data";
99

10-
// name; required?; type?; protected?; validator?; sanitizer?; fallback?;
10+
/**
11+
* Scheme object based on the metadata spreadsheet.
12+
*
13+
* https://docs.google.com/spreadsheets/d/112Anbf-sJYkehyFvjuxr1DuMih-fPB9nt3E8ll19Iyc/edit#gid=0
14+
*
15+
* It's an array of objects, each object describes a paper property.
16+
*
17+
* It has the following properties:
18+
*
19+
* - name: string - the paper property's name
20+
* - required?: boolean - true for mandatory properties
21+
* - type?: string[] - list of allowed js types
22+
* - protected?: boolean - true for properties that shouldn't be escaped
23+
* - validator?: (value: any) => boolean - validator function that receives the property value and returns true if the value is valid
24+
* - sanitizer?: (value: any) => any - sanitizer function that sanitizes the property value
25+
* - fallback?: (localization?: object, paper?: object) => any - fallback function that returns a fallback value
26+
*
27+
*/
1128
const DEFAULT_SCHEME = [
1229
{
1330
name: "id",
@@ -57,6 +74,7 @@ const DEFAULT_SCHEME = [
5774
name: "subject_orig",
5875
required: true,
5976
type: ["string"],
77+
validator: (val) => val !== "",
6078
fallback: (loc) => loc.no_keywords,
6179
},
6280
{ name: "subject_cleaned", required: true, type: ["string"] },

0 commit comments

Comments
 (0)