evidence-mcp-dev 1.0.3 → 1.0.4
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/dist/index.js +10 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5159,12 +5159,14 @@ function parseEsummary(json2, ids, libraryDir) {
|
|
|
5159
5159
|
const first = String(s.sortfirstauthor ?? (Array.isArray(s.authors) && s.authors[0]?.name) ?? "").replace(/\s+[A-Z]{1,3}$/, "").trim() || null;
|
|
5160
5160
|
const pmc2 = (Array.isArray(s.articleids) ? s.articleids : []).find((a) => a.idtype === "pmc")?.value ?? null;
|
|
5161
5161
|
const types = Array.isArray(s.pubtype) ? reviewTypes(s.pubtype.map(String)).join("; ") : "";
|
|
5162
|
-
|
|
5163
|
-
const level = entryExists(paths) ? String(readStatus(paths, emptyStatus(`pmid:${id}`, "pmid", id, libraryDir)).level) : null;
|
|
5164
|
-
rows.push([id, String(s.title ?? "").replace(/\.$/, "") || null, first, year, s.source ? String(s.source) : null, types || null, pmc2 ? String(pmc2) : null, level]);
|
|
5162
|
+
rows.push([id, String(s.title ?? "").replace(/\.$/, "") || null, first, year, s.source ? String(s.source) : null, types || null, pmc2 ? String(pmc2) : null, levelOf(id, libraryDir)]);
|
|
5165
5163
|
}
|
|
5166
5164
|
return rows;
|
|
5167
5165
|
}
|
|
5166
|
+
function levelOf(id, libraryDir) {
|
|
5167
|
+
const paths = entryPaths(libraryDir, "pmid", id);
|
|
5168
|
+
return entryExists(paths) ? String(readStatus(paths, emptyStatus(`pmid:${id}`, "pmid", id, libraryDir)).level) : null;
|
|
5169
|
+
}
|
|
5168
5170
|
var live = (url) => fetchText(url, { "User-Agent": "evidence-mcp", Accept: "application/json" });
|
|
5169
5171
|
async function searchArticles(raw, libraryDir = FH_EVIDENCE_DIR, fetchImpl = live) {
|
|
5170
5172
|
const q = normalizeQuery2(raw);
|
|
@@ -5173,7 +5175,11 @@ async function searchArticles(raw, libraryDir = FH_EVIDENCE_DIR, fetchImpl = liv
|
|
|
5173
5175
|
if (existsSync12(file3)) {
|
|
5174
5176
|
try {
|
|
5175
5177
|
const r = JSON.parse(readFileSync10(file3, "utf8"));
|
|
5176
|
-
if (daysSince(r.searched) < searchCacheDays()) return { ok: true, result: r,
|
|
5178
|
+
if (daysSince(r.searched) < searchCacheDays()) return { ok: true, result: { ...r, rows: r.rows.map((row3) => {
|
|
5179
|
+
const c = [...row3];
|
|
5180
|
+
c[7] = levelOf(String(row3[0]), libraryDir);
|
|
5181
|
+
return c;
|
|
5182
|
+
}) }, cached: true };
|
|
5177
5183
|
} catch {
|
|
5178
5184
|
}
|
|
5179
5185
|
}
|