crosswalk

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package crosswalk provides mappings between NAICS and other industry classification systems (SIC codes, NAICS version changes).

All types are safe for concurrent reads after construction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SIC

type SIC struct {
	// contains filtered or unexported fields
}

SIC holds bidirectional SIC-to-NAICS mappings.

func NewSIC

func NewSIC() (*SIC, error)

NewSIC creates a SIC crosswalk loaded with the embedded SIC-NAICS data.

func NewSICFromCSV

func NewSICFromCSV(r io.Reader) (*SIC, error)

NewSICFromCSV creates a SIC crosswalk from CSV data read from r. The CSV must have a header row and columns: naics_code, naics_title, sic_code, sic_title.

func (*SIC) AllMappings

func (s *SIC) AllMappings() []SICMapping

AllMappings returns all SIC-NAICS mappings.

func (*SIC) Len

func (s *SIC) Len() int

Len returns the total number of crosswalk mapping records.

func (*SIC) NAICSToSIC

func (s *SIC) NAICSToSIC(naicsCode string) ([]SICMapping, bool)

NAICSToSIC returns all SIC mappings for a given NAICS code. One NAICS code may map to multiple SIC codes (merges). Returns false if the NAICS code has no mappings.

func (*SIC) SICToNAICS

func (s *SIC) SICToNAICS(sicCode string) ([]SICMapping, bool)

SICToNAICS returns all NAICS mappings for a given SIC code. One SIC code may map to multiple NAICS codes (splits). Returns false if the SIC code has no mappings.

type SICMapping

type SICMapping struct {
	NAICSCode  string
	NAICSTitle string
	SICCode    string
	SICTitle   string
}

SICMapping represents a single mapping between a SIC code and a NAICS code.

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version holds bidirectional NAICS 2017-to-2022 mappings.

func NewVersion

func NewVersion() (*Version, error)

NewVersion creates a Version crosswalk loaded with the embedded NAICS 2017-to-2022 concordance data.

func NewVersionFromCSV

func NewVersionFromCSV(r io.Reader) (*Version, error)

NewVersionFromCSV creates a Version crosswalk from CSV data read from r. The CSV must have a header row and columns: naics_2017, title_2017, naics_2022, title_2022.

func (*Version) AllMappings

func (v *Version) AllMappings() []VersionMapping

AllMappings returns all version crosswalk mappings.

func (*Version) Len

func (v *Version) Len() int

Len returns the total number of version crosswalk mapping records.

func (*Version) MapTo2017

func (v *Version) MapTo2017(code2022 string) ([]VersionMapping, bool)

MapTo2017 returns the NAICS 2017 codes that a NAICS 2022 code was derived from. One 2022 code may map to multiple 2017 codes when industries were merged. Returns false if the 2022 code has no mappings.

func (*Version) MapTo2022

func (v *Version) MapTo2022(code2017 string) ([]VersionMapping, bool)

MapTo2022 returns the NAICS 2022 codes that a NAICS 2017 code maps to. One 2017 code may map to multiple 2022 codes when an industry was split. Returns false if the 2017 code has no mappings.

type VersionMapping

type VersionMapping struct {
	Code2017  string
	Title2017 string
	Code2022  string
	Title2022 string
}

VersionMapping represents a single mapping between a NAICS 2017 code and a NAICS 2022 code.

Jump to

Keyboard shortcuts

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