csl_eu

package
v0.50.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileGenerationDateIdx             = 0
	EntityLogicalIdx                  = 1
	ReferenceNumberIdx                = 2
	EntityRemarkIdx                   = 6
	EntitySubjectTypeIdx              = 8
	EntityRegulationPublicationURLIdx = 15

	NameAliasWholeNameIdx = 19
	NameAliasTitleIdx     = 22

	AddressCityIdx               = 34
	AddressStreetIdx             = 35
	AddressPoBoxIdx              = 36
	AddressZipCodeIdx            = 37
	AddressCountryDescriptionIdx = 43

	BirthDateIdx        = 54
	BirthDateCityIdx    = 65
	BirthDateCountryIdx = 67

	IdentificationValidFromIdx = 86
	IdentificationValidToIdx   = 87
)

header indicies

Variables

This section is empty.

Functions

func DownloadEU

func DownloadEU(ctx context.Context, logger log.Logger, initialDir string) (map[string]io.ReadCloser, error)

func ParseEU

func ParseEU(r io.ReadCloser) ([]CSLRecord, CSL, error)

func PtrToEntity

func PtrToEntity(record *CSLRecord) search.Entity[CSLRecord]

func ToEntity

func ToEntity(record CSLRecord) search.Entity[CSLRecord]

Types

type Address

type Address struct {
	City    string `json:"city"`
	Street  string `json:"street"`
	PoBox   string `json:"poBox"`
	ZipCode string `json:"zipCode"`
	// Region             string
	// Place              string
	// AsAtListingTime    string
	// ContactInfo        string
	// CountryIso2code    string
	CountryDescription string `json:"countryDescription"`
}

type BirthDate

type BirthDate struct {
	BirthDate string // keep
	// Day                int64
	// Month              int64
	// Year               int64
	// YearRangeFrom      string
	// YearRangeTo        string
	// Circa              string
	// CaldendarType      string
	// ZipCode            string
	// Region             string
	// Place              string
	City string `json:"city"`
	// CountryIso2code    string
	CountryDescription string `json:"countryDescription"`
}

type CSL

type CSL map[int]*CSLRecord

struct to hold the rows from the csv data before merge

type CSLRecord

type CSLRecord struct {
	FileGenerationDate         string            `json:"fileGenerationDate"`
	EntityLogicalID            int               `json:"entityLogicalId"`
	EntityRemark               string            `json:"entityRemark"`
	EntitySubjectType          string            `json:"entitySubjectType"`
	EntityPublicationURL       string            `json:"entityPublicationURL"`
	EntityReferenceNumber      string            `json:"entityReferenceNumber"`
	NameAliasWholeNames        []string          `json:"nameAliasWholeNames"`
	NameAliasTitles            []string          `json:"nameAliasTitles"`
	AddressCities              []string          `json:"addressCities"`
	AddressStreets             []string          `json:"addressStreets"`
	AddressPoBoxes             []string          `json:"addressPoBoxs"`
	AddressZipCodes            []string          `json:"addressZipCodes"`
	AddressCountryDescriptions []string          `json:"addressCountryDescriptions"`
	BirthDates                 []string          `json:"birthDates"`
	BirthCities                []string          `json:"birthCities"`
	BirthCountries             []string          `json:"birthCountries"`
	ValidFromTo                map[string]string `json:"validFromTo"`
}

type CSLRow

type CSLRow struct {
	FileGenerationDate string            `json:"fileGenerationDate"`
	Entity             *Entity           `json:"entity"`
	NameAliases        []*NameAlias      `json:"nameAliases"`
	Addresses          []*Address        `json:"addresses"`
	BirthDates         []*BirthDate      `json:"birthDates"`
	Identifications    []*Identification `json:"identifications"`
}

below is the original struct used to parse the document fields commented out are not parsed this was refactored to be a flatter structure but is left in for documentation use the CSLRecord struct above

type Entity

type Entity struct {
	LogicalID       int    `json:"logicalId"`
	ReferenceNumber string `json:"referenceNumber"`
	// UnitiedNationsID   string
	// DesignationDate    string
	// DesignationDetails string
	Remark      string       `json:"remark"`
	SubjectType *SubjectType `json:"subjectType"`
	Regulation  *Regulation  `json:"regulation"`
}

type Identification

type Identification struct {
	// Regulation         *Regulation
	// Number             int64
	// KnownExpired       bool
	// KnownFalse         bool
	// ReportedLost       bool
	// RevokedByIssuer    bool
	// LogicalID          int64
	// Diplomatic         string
	// IssuedBy           string
	// IssuedDate         string
	ValidFrom string `json:"validFrom"`
	ValidTo   string `json:"validTo"`
}

type NameAlias

type NameAlias struct {
	// LastName           string
	// FirstName          string
	// MiddleName         string
	WholeName string `json:"wholeName"`
	// NameLanguage       string
	// Gender             string
	Title string `json:"title"`
}

type Regulation

type Regulation struct {
	// Type               string
	// OrganizationType   string
	// PublicationDate    string
	// EntryInfoForceDate string
	// NumberTitle        string
	// Programme          string
	PublicationURL string `json:"publicationURL"`
}

type SubjectType

type SubjectType struct {
	// SingleLetter       string
	ClassificationCode string `json:"classificationCode"`
}

Jump to

Keyboard shortcuts

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