Skip to content

Commit

Permalink
- parser paydexHisto
Browse files Browse the repository at this point in the history
- tests
  • Loading branch information
dependabot[bot] authored and Christophe Ninucci committed Aug 16, 2023
1 parent 3c5b146 commit 9355c8a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sireneUL.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
)

var SireneULHeaders = strings.Split("siren statutDiffusionUniteLegale unitePurgeeUniteLegale dateCreationUniteLegale sigleUniteLegale sexeUniteLegale prenom1UniteLegale prenom2UniteLegale prenom3UniteLegale prenom4UniteLegale prenomUsuelUniteLegale pseudonymeUniteLegale identifiantAssociationUniteLegale trancheEffectifsUniteLegale anneeEffectifsUniteLegale dateDernierTraitementUniteLegale nombrePeriodesUniteLegale categorieEntreprise anneeCategorieEntreprise dateDebut etatAdministratifUniteLegale nomUniteLegale nomUsageUniteLegale denominationUniteLegale denominationUsuelle1UniteLegale denominationUsuelle2UniteLegale denominationUsuelle3UniteLegale categorieJuridiqueUniteLegale activitePrincipaleUniteLegale nomenclatureActivitePrincipaleUniteLegale nicSiegeUniteLegale economieSocialeSolidaireUniteLegale caractereEmployeurUniteLegale", " ")
var SireneULMap = mapHeaders(SireneULHeaders)

// GeoSireneParses returns a GeoSirene channel.
// Errors are transmitted trough GeoSirene.Error() function.
Expand All @@ -37,6 +36,7 @@ func sireneULFromCsv(row []string) SireneUL {

func parseSireneUL(ctx context.Context, file io.ReadCloser, s chan SireneUL) {
c := csv.NewReader(file)

if head, err := c.Read(); checkHeader(SireneULHeaders, head) && err != nil {
s <- SireneUL{err: err}
return
Expand All @@ -51,7 +51,6 @@ func parseSireneUL(ctx context.Context, file io.ReadCloser, s chan SireneUL) {
}
return
}
file.Close()
s <- SireneUL{err: err}
return
}
Expand All @@ -64,7 +63,6 @@ func parseSireneUL(ctx context.Context, file io.ReadCloser, s chan SireneUL) {
case <-ctx.Done():
return
case s <- sirene:
continue
}
}
}
Expand All @@ -80,13 +78,12 @@ func readPlainSireneUL(ctx context.Context, path string, s chan SireneUL) {
}

func readZipSireneUL(ctx context.Context, path string, s chan SireneUL) {
defer close(s)
zr, err := zip.OpenReader(path)
if err != nil {
s <- SireneUL{err: err}
return
}

defer close(s)
defer zr.Close()

for _, zf := range zr.File {
Expand Down

0 comments on commit 9355c8a

Please sign in to comment.