@ca-plant-list/ca-plant-list 0.4.21 → 0.4.22
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/data/exceptions.json +22 -1
- package/data/synonyms.csv +2 -0
- package/data/taxa.csv +1754 -1753
- package/lib/errorlog.js +1 -1
- package/lib/externalsites.js +29 -0
- package/lib/files.js +3 -5
- package/lib/htmltaxon.js +22 -12
- package/lib/index.d.ts +22 -12
- package/lib/taxon.js +33 -4
- package/lib/tools/cch2.js +126 -8
- package/lib/tools/fna.js +163 -0
- package/lib/tools/jepsoneflora.js +20 -1
- package/lib/tools/rpi.js +2 -2
- package/lib/tools/taxacsv.js +23 -4
- package/lib/web/pagetaxon.js +3 -9
- package/package.json +2 -1
- package/scripts/cpl-tools.js +17 -1
@@ -102,8 +102,25 @@ export class JepsonEFlora {
|
|
102
102
|
idsToUpdate.set(name, jepsInfo.id);
|
103
103
|
}
|
104
104
|
|
105
|
-
|
105
|
+
let efStatus = this.#getStatusCode(jepsInfo);
|
106
106
|
const taxonStatus = taxon.getStatus();
|
107
|
+
// Override if exception is specified.
|
108
|
+
const nativeException = exceptions.getValue(
|
109
|
+
name,
|
110
|
+
"jepson",
|
111
|
+
"native",
|
112
|
+
);
|
113
|
+
if (typeof nativeException === "boolean") {
|
114
|
+
const overrideStatus = nativeException ? "N" : "X";
|
115
|
+
if (overrideStatus === efStatus) {
|
116
|
+
this.#errorLog.log(
|
117
|
+
name,
|
118
|
+
"has unnecessary Jepson native override",
|
119
|
+
);
|
120
|
+
}
|
121
|
+
efStatus = overrideStatus;
|
122
|
+
}
|
123
|
+
|
107
124
|
if (
|
108
125
|
efStatus !== taxonStatus &&
|
109
126
|
!(taxonStatus === "NC" && efStatus === "N")
|
@@ -154,6 +171,8 @@ export class JepsonEFlora {
|
|
154
171
|
for (const [k] of Object.entries(exceptions)) {
|
155
172
|
const jepsonData = this.#nameInfo.get(name);
|
156
173
|
switch (k) {
|
174
|
+
case "native":
|
175
|
+
break;
|
157
176
|
case "notineflora":
|
158
177
|
// Make sure it is really not in eFlora.
|
159
178
|
if (jepsonData) {
|
package/lib/tools/rpi.js
CHANGED
@@ -80,8 +80,8 @@ class RPI {
|
|
80
80
|
const rank = row["CRPR"];
|
81
81
|
const rawCESA = row["CESA"];
|
82
82
|
const rawFESA = row["FESA"];
|
83
|
-
const cesa = rawCESA === "None" ?
|
84
|
-
const fesa = rawFESA === "None" ?
|
83
|
+
const cesa = rawCESA === "None" ? "" : rawCESA;
|
84
|
+
const fesa = rawFESA === "None" ? "" : rawFESA;
|
85
85
|
const cnddb = row["SRank"];
|
86
86
|
const globalRank = row["GRank"];
|
87
87
|
const taxon = taxa.getTaxon(name);
|
package/lib/tools/taxacsv.js
CHANGED
@@ -1,9 +1,30 @@
|
|
1
1
|
import path from "path";
|
2
2
|
import { CSV } from "../csv.js";
|
3
3
|
|
4
|
+
const HEADERS = [
|
5
|
+
"taxon_name",
|
6
|
+
"common name",
|
7
|
+
"status",
|
8
|
+
"jepson id",
|
9
|
+
"calrecnum",
|
10
|
+
"inat id",
|
11
|
+
"cch2_id",
|
12
|
+
"fna",
|
13
|
+
"calscape_cn",
|
14
|
+
"life_cycle",
|
15
|
+
"flower_color",
|
16
|
+
"bloom_start",
|
17
|
+
"bloom_end",
|
18
|
+
"RPI ID",
|
19
|
+
"CRPR",
|
20
|
+
"CESA",
|
21
|
+
"FESA",
|
22
|
+
"SRank",
|
23
|
+
"GRank",
|
24
|
+
];
|
25
|
+
|
4
26
|
export class TaxaCSV {
|
5
27
|
#filePath;
|
6
|
-
#headers;
|
7
28
|
/** @type {import("../index.js").TaxonData[]} */
|
8
29
|
#taxa;
|
9
30
|
|
@@ -13,9 +34,7 @@ export class TaxaCSV {
|
|
13
34
|
constructor(dataDir) {
|
14
35
|
this.#filePath = path.join(dataDir, "taxa.csv");
|
15
36
|
const csv = CSV.readFileAndHeaders(this.#filePath);
|
16
|
-
// @ts-ignore
|
17
37
|
this.#taxa = csv.data;
|
18
|
-
this.#headers = csv.headers;
|
19
38
|
}
|
20
39
|
|
21
40
|
/**
|
@@ -26,6 +45,6 @@ export class TaxaCSV {
|
|
26
45
|
}
|
27
46
|
|
28
47
|
write() {
|
29
|
-
CSV.writeFileObject(this.#filePath, this.#taxa,
|
48
|
+
CSV.writeFileObject(this.#filePath, this.#taxa, HEADERS);
|
30
49
|
}
|
31
50
|
}
|
package/lib/web/pagetaxon.js
CHANGED
@@ -34,19 +34,13 @@ export class PageTaxon extends GenericPage {
|
|
34
34
|
if (iNatLink) {
|
35
35
|
links.push(iNatLink);
|
36
36
|
}
|
37
|
-
const calscapeLink = HTMLTaxon.getCalscapeLink(this.#taxon);
|
38
|
-
if (calscapeLink) {
|
39
|
-
links.push(calscapeLink);
|
40
|
-
}
|
41
37
|
const rpiLink = this.#taxon.getRPITaxonLink();
|
42
38
|
if (rpiLink) {
|
43
39
|
links.push(rpiLink);
|
44
40
|
}
|
45
|
-
HTMLTaxon.
|
46
|
-
|
47
|
-
|
48
|
-
"CCH2",
|
49
|
-
);
|
41
|
+
HTMLTaxon.addRefLink(links, this.#taxon, "fna");
|
42
|
+
HTMLTaxon.addRefLink(links, this.#taxon, "cch");
|
43
|
+
HTMLTaxon.addRefLink(links, this.#taxon, "calscape");
|
50
44
|
return links;
|
51
45
|
}
|
52
46
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ca-plant-list/ca-plant-list",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.22",
|
4
4
|
"description": "Tools to create Jekyll files for a website listing plants in an area of California.",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -58,6 +58,7 @@
|
|
58
58
|
"eslint": "^9.18.0",
|
59
59
|
"jest": "^29.7.0",
|
60
60
|
"prettier": "^3.4.2",
|
61
|
+
"puppeteer": "^24.1.1",
|
61
62
|
"typescript": "^5.7.3"
|
62
63
|
}
|
63
64
|
}
|
package/scripts/cpl-tools.js
CHANGED
@@ -14,11 +14,13 @@ import { Taxa } from "../lib/taxa.js";
|
|
14
14
|
import { SupplementalText } from "../lib/tools/supplementaltext.js";
|
15
15
|
import { JepsonFamilies } from "../lib/tools/jepsonfamilies.js";
|
16
16
|
import { CCH2 } from "../lib/tools/cch2.js";
|
17
|
+
import { FNA } from "../lib/tools/fna.js";
|
17
18
|
|
18
19
|
const TOOLS = {
|
19
20
|
CALFLORA: "calflora",
|
20
21
|
CALSCAPE: "calscape",
|
21
22
|
CCH2: "cch",
|
23
|
+
FNA: "fna",
|
22
24
|
INAT: "inat",
|
23
25
|
JEPSON_EFLORA: "jepson-eflora",
|
24
26
|
JEPSON_FAM: "jepson-families",
|
@@ -30,6 +32,7 @@ const ALL_TOOLS = [
|
|
30
32
|
TOOLS.CALFLORA,
|
31
33
|
TOOLS.CALSCAPE,
|
32
34
|
TOOLS.CCH2,
|
35
|
+
TOOLS.FNA,
|
33
36
|
TOOLS.INAT,
|
34
37
|
TOOLS.JEPSON_EFLORA,
|
35
38
|
TOOLS.RPI,
|
@@ -84,11 +87,22 @@ async function build(program, options) {
|
|
84
87
|
await CCH2.analyze(
|
85
88
|
TOOLS_DATA_DIR,
|
86
89
|
options.datadir,
|
90
|
+
exceptions,
|
87
91
|
taxa,
|
88
92
|
errorLog,
|
89
93
|
!!options.update,
|
90
94
|
);
|
91
95
|
break;
|
96
|
+
case TOOLS.FNA:
|
97
|
+
await FNA.analyze(
|
98
|
+
TOOLS_DATA_DIR,
|
99
|
+
options.datadir,
|
100
|
+
taxa,
|
101
|
+
errorLog,
|
102
|
+
!!options.update,
|
103
|
+
);
|
104
|
+
break;
|
105
|
+
|
92
106
|
case TOOLS.INAT:
|
93
107
|
await INat.analyze(
|
94
108
|
TOOLS_DATA_DIR,
|
@@ -150,9 +164,11 @@ program.addHelpText(
|
|
150
164
|
"after",
|
151
165
|
`
|
152
166
|
Tools:
|
153
|
-
'all' runs the 'calflora', '${TOOLS.CALSCAPE}', 'inat', 'jepson-eflora', 'rpi', and 'text' tools.
|
167
|
+
'all' runs the 'calflora', '${TOOLS.CALSCAPE}', '${TOOLS.CCH2}, '${TOOLS.FNA}, 'inat', 'jepson-eflora', 'rpi', and 'text' tools.
|
154
168
|
'${TOOLS.CALFLORA}' retrieves data from Calflora and compares with local data.
|
155
169
|
'${TOOLS.CALSCAPE}' retrieves data from Calscape and compares with local data.
|
170
|
+
'${TOOLS.CCH2}' retrieves data from CCH2 and compares with local data.
|
171
|
+
'${TOOLS.FNA}' retrieves data from Flora of North America and compares with local data.
|
156
172
|
'${TOOLS.INAT}' retrieves data from iNaturalist and compares with local data.
|
157
173
|
'${TOOLS.JEPSON_EFLORA}' retrieves data from Jepson eFlora indexes and compares with local data.
|
158
174
|
'${TOOLS.JEPSON_FAM}' retrieves section, family and genus data from Jepson eFlora and creates data files for use by ca-plant-list.
|