https://github.com/denysvitali/zefix-tools
A collection of tools to interact with the data exported by Zefix, the Swiss Central Business Name Index
https://github.com/denysvitali/zefix-tools
zefix
Last synced: 12 months ago
JSON representation
A collection of tools to interact with the data exported by Zefix, the Swiss Central Business Name Index
- Host: GitHub
- URL: https://github.com/denysvitali/zefix-tools
- Owner: denysvitali
- License: mit
- Created: 2024-01-10T22:42:17.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-20T09:58:05.000Z (over 1 year ago)
- Last Synced: 2025-06-28T20:58:38.795Z (about 1 year ago)
- Topics: zefix
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# zefix-tools
A collection of tools to interact with the data exported by Zefix, the Swiss Central Business Name Index.
## Get the data
Use [sparql-client](https://github.com/denysvitali/sparql-client) to query the data from
the [Zefix SPARQL endpoint](https://register.ld.admin.ch/sparql) and generate a JSON file.
```bash
go install github.com/denysvitali/sparql-client/cmd/sparql-client@master
sparql-client --endpoint https://register.ld.admin.ch/query \
--query query.txt \
-a -D \
--limit 500 \
-o zefix.json
```
## Import the data
### Start PostgreSQL
```bash
docker-compose up -d
```
#### Get the container IP
```bash
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker-compose ps -q | head -n1)
```
Once you have the IP, you can add it to `ZEFIX_DSN` in `.env`
### Import the data to postgres
```bash
source .env
export ZEFIX_DSN
# This will take a while:
go run ./cmd/zefix-import --input ./zefix.json
```
## Query the data
```bash
source .env
export ZEFIX_DSN
go run ./cmd/zefix-find "Rega AG" [23:39:51]
```
will result in:
```plain
Name: Rega AG
URI: https://register.ld.admin.ch/zefix/company/144424
```