This repository has been archived by the owner on Apr 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileDefinitions.ts
88 lines (78 loc) · 2.29 KB
/
fileDefinitions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Row Types
* Note that row data is in CSV files, and CSV files do not have type information.
* Data that should numeric is marked appropriately as a comment,
* and is validated with `npm test`
*/
export interface Item {
itemKey: string;
itemName: string;
shortDescription?: string;
longDescription?: string;
searchTerms?: string;
};
export interface Location {
locationKey: string;
locationName: string;
address?: string;
latitude?: string; // number
longitude?: string; // number
shortDescription?: string;
longDescription?: string;
websiteURL?: string;
};
export interface ItemLocation {
itemKey: string;
locationKey: string;
};
export interface RelatedItem {
itemKeyA: string;
itemKeyB: string;
};
export interface ItemReuse {
itemKey: string;
reuseName: string;
reuseDescription?: string;
websiteURL?: string;
};
/*
* File Definitions
*/
export interface FileDefinition {
fileName: string;
columns: string[];
primaryKeyColumns: string[];
numericColumns?: string[];
requiredColumns?: string[];
};
export const fileDefinition_items: FileDefinition = {
fileName: "items.csv",
columns: ["itemKey", "itemName", "shortDescription", "longDescription", "searchTerms"],
primaryKeyColumns: ["itemKey"],
requiredColumns: ["itemKey", "itemName"]
};
export const fileDefinition_locations: FileDefinition = {
fileName: "locations.csv",
columns: ["locationKey", "locationName", "address", "latitude", "longitude", "shortDescription", "longDescription", "websiteURL"],
primaryKeyColumns: ["locationKey"],
numericColumns: ["latitude", "longitude"],
requiredColumns: ["locationKey", "locationName"]
};
export const fileDefinitions: FileDefinition[] = [
fileDefinition_items,
fileDefinition_locations, {
fileName: "itemLocations.csv",
columns: ["itemKey", "locationKey"],
primaryKeyColumns: ["itemKey", "locationKey"],
requiredColumns: ["itemKey", "locationKey"]
}, {
fileName: "relatedItems.csv",
columns: ["itemKeyA", "itemKeyB"],
primaryKeyColumns: ["itemKeyA", "itemKeyB"],
requiredColumns: ["itemKeyA", "itemKeyB"]
}, {
fileName: "itemReuses.csv",
columns: ["itemKey", "reuseName", "reuseDescription", "websiteURL"],
primaryKeyColumns: ["itemKey", "reuseName"],
requiredColumns: ["itemKey", "reuseName"]
}];