Function: parseCsvSource()
parseCsvSource(
source):object
Parse a CsvSource into concepts and skipped-row warnings.
Parameters
source
The CSV source.
Returns
object
The parsed concepts (by code) and the load warnings.
concepts
concepts:
Map<string,Concept>
warnings
warnings:
LoadWarning[]
Throws
TERM_CODESYSTEM_MALFORMED when the file has no header row, or a
configured code/display/status/property column is absent from the header.
Example
import { parseCsvSource } from "@cosyte/terminology";
const { concepts } = parseCsvSource({
format: "csv",
content: "CODE,NAME\n2160-0,Creatinine",
columns: { code: "CODE", display: "NAME" },
});
concepts.get("2160-0")?.display; // => "Creatinine"