mesh

package module
v0.0.0-...-6af6e01 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

README

Go-Mesh

go-mesh is a small library for parsing MeSH data files available at https://www.nlm.nih.gov/mesh/download_mesh.html

Notes

I (crhntr) neither use this library in production projects nor do I commit to maintaining it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanDescriptorRecordSet

func ScanDescriptorRecordSet(r io.Reader, f func(dr *DescriptorRecord) error) error

ScanDescriptorRecordSet is designed to parse desc####.xml files

func ScanPharmacologicalActionSet

func ScanPharmacologicalActionSet(r io.Reader, f func(dr *PharmacologicalAction) error) error

ScanPharmacologicalActionSet is designed to parse pa####.xml files

func ScanQualifierRecordSet

func ScanQualifierRecordSet(r io.Reader, f func(dr *QualifierRecord) error) error

ScanQualifierRecordSet is designed to parse qual####.xml files

func ScanSupplementalRecordSet

func ScanSupplementalRecordSet(r io.Reader, f func(dr *SupplementalRecord) error) error

ScanSupplementalRecordSet is designed to parse supp####.xml files

Types

type AllowableQualifier

type AllowableQualifier struct {
	UI   UI     `xml:"QualifierReferredTo>QualifierUI"`
	Name string `xml:"QualifierReferredTo>QualifierName>String"`

	Abbreviation string
}

type Concept

type Concept struct {
	UI                     UI     `xml:"ConceptUI"`
	Name                   string `xml:"ConceptName>String"`
	RegistryNumber         string
	CASN1Name              string
	ConceptRelations       []ConceptRelation `xml:"ConceptRelationList>ConceptRelation"`
	Prefered               YN                `xml:"PreferredConceptYN,attr"`
	ScopeNote              string
	RelatedRegistryNumbers []string `xml:"RelatedRegistryNumberList>RelatedRegistryNumber"`
}

type ConceptRelation

type ConceptRelation struct {
	Name string `xml:"RelationName,attr"`
	C1   UI     `xml:"Concept1UI"`
	C2   UI     `xml:"Concept2UI"`
}

type Date

type Date struct {
	time.Time
}

func (Date) MarshalXML

func (date Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Date) UnmarshalXML

func (date *Date) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type DescriptorRecord

type DescriptorRecord struct {
	UI                string `xml:"DescriptorUI"`
	Name              string `xml:"DescriptorName"`
	Created           Date   `xml:"DateCreated"`
	Revised           Date   `xml:"DateRevised"`
	Established       Date   `xml:"DateEstablished"`
	HistoryNote       string
	OnlineNote        string
	PublicMeSHNote    string
	PreviousIndexings []string  `xml:"PreviousIndexingList>PreviousIndexing"`
	TreeNumbers       []string  `xml:"TreeNumberList>TreeNumber"`
	Concepts          []Concept `xml:"ConceptList>Concept"`
	Terms             []Term    `xml:"TermList"`
}

DescriptorRecord are parsed from desc####.xml files

type PharmacologicalAction

type PharmacologicalAction struct {
	UI   UI     `xml:"DescriptorReferredTo>DescriptorUI"`
	Name string `xml:"DescriptorReferredTo>DescriptorName>String"`

	Substances []Substance `xml:"PharmacologicalActionSubstanceList>Substance"`
}

PharmacologicalAction are parsed from pa####.xml files

type QualifierRecord

type QualifierRecord struct {
	UI          UI     `xml:"QualifierUI"`
	Name        string `xml:"QualifierName>String"`
	Created     Date   `xml:"DateCreated"`
	Revised     Date   `xml:"DateRevised"`
	Established Date   `xml:"DateEstablished"`
	Annotation  string
	HistoryNote string
	TreeNumbers []string `xml:"TreeNumberList>TreeNumber"`
}

QualifierRecords are parsed from qual####.xml files

type Substance

type Substance struct {
	UI   UI     `xml:"RecordUI"`
	Name string `xml:"RecordName>String"`
}

Substances are emebeded structs in PharmacologicalAction

type SupplementalRecord

type SupplementalRecord struct {
	UI        UI     `xml:"SupplementalRecordUI"`
	Name      string `xml:"SupplementalRecordName>String"`
	Created   Date   `xml:"DateCreated"`
	Revised   Date   `xml:"DateRevised"`
	Note      string `xml:"Note"`
	Frequency int
	Concepts  []Concept `xml:"ConceptList>Concept"`
	Sources   []string  `xml:"SourceList>Source"`
	MappedTo  []struct {
		UI   UI     `xml:"DescriptorReferredTo>DescriptorUI"`
		Name string `xml:"DescriptorReferredTo>DescriptorName"`
	} `xml:"HeadingMappedToList"`
}

SupplementalRecords are parsed from supp####.xml files

type Term

type Term struct {
	XMLName xml.Name `xml:"Term"`
	UI      UI       `xml:"TermUI"`

	ConceptPreferred YN       `xml:"ConceptPreferredTermYN,attr"`
	IsPermuted       YN       `xml:"IsPermutedTermYN,attr"`
	RecordPreferred  YN       `xml:"RecordPreferredTermYN,attr"`
	Created          Date     `xml:"DateCreated"`
	ThesaurusIDs     []string `xml:"ThesaurusIDlist>ThesaurusID"`
	EntryVersion     string   `xml:"EntryVersion"`
	Abbreviation     string   `xml:"Abbreviation"`

	String string `xml:"String"`
}

type UI

type UI string

func (UI) Type

func (ui UI) Type() UIType

type UIType

type UIType int
const (
	UnknownUI    UIType = iota
	DescriptorUI        // 'D'
	QualifierUI         // 'Q'
	TermUI              // 'T'
	ConceptUI           // 'M'

)

type YN

type YN bool

func (YN) MarshalXMLAttr

func (pf YN) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

func (*YN) UnmarshalXMLAttr

func (pf *YN) UnmarshalXMLAttr(attr xml.Attr) error

Jump to

Keyboard shortcuts

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