bioparser

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package bioparser parses a bioschemas's CSV file into an YAML document for jekyll

Index

Constants

This section is empty.

Variables

View Source
var (
	//Specifications stores an slice of Specification structs
	Specifications []Specification
)

Functions

func Start

func Start(u, f string)

Start receive a file path and an URL path for a CSV, that could be empty, and prints its content formated for Jekyl (YAML)

Types

type Specification

type Specification struct {
	SpecificationInfo   SpecificationInfo    `yaml:"spec_info"`
	SpecificationParams []SpecificationParam `yaml:"mapping"`
}

Specification is an object representation of the Bioschemas specification spreadsheet the "Bioschemas fields" sheet

func LoadFile

func LoadFile(fp string) (Specification, error)

LoadFile loads CSV file into an spec object

func LoadURL

func LoadURL(u string) (Specification, error)

LoadURL loads CSV from url into an spec object

func ParseSpecificationCSV

func ParseSpecificationCSV(r *csv.Reader) (Specification, error)

ParseSpecificationCSV reads the CSV file

parses it into an Specification struct. The CSV second row has the Specification Info,
and from the fourth row the mapping.

type SpecificationInfo

type SpecificationInfo struct {
	Title        string `yaml:"title"`
	Subtitle     string `yaml:"subtitle"`
	Description  string `yaml:"description"`
	Version      string `yaml:"version"`
	VersionDate  string `yaml:"version_date"`
	OfficialType string `yaml:"official_type"`
	FullExample  string `yaml:"full_example"`
}

SpecificationInfo Details for an specification struct

type SpecificationParam

type SpecificationParam struct {
	Property             string   `yaml:"property"`
	ExpectedTypes        []string `yaml:"expected_types"`
	Description          string   `yaml:"description"`
	Type                 string   `yaml:"type"`
	TypeURL              string   `yaml:"type_url"`
	BscDescription       string   `yaml:"bsc_description"`
	Marginality          string   `yaml:"marginality"`
	Cardinality          string   `yaml:"cardinality"`
	ControlledVocabulary string   `yaml:"controlled_vocab"`
	Example              string   `yaml:"example"`
}

SpecificationParam Represents a parameter of a bioschemas spec

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL