Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/max-planck-innovation-competition/go-openalex
https://github.com/max-planck-innovation-competition/go-openalex
golang openalex openalexapi
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/max-planck-innovation-competition/go-openalex
- Owner: max-planck-innovation-competition
- License: mit
- Created: 2023-09-21T08:52:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-05T15:51:57.000Z (2 months ago)
- Last Synced: 2024-11-13T02:18:35.375Z (about 2 months ago)
- Topics: golang, openalex, openalexapi
- Language: Go
- Homepage:
- Size: 1.18 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Open Alex
This package is interacting with the Open Alex API.
It downloads the data into strongly typed structs.# Status
Work in progress## Requirements
* AWS CLI for syncing the data from S3
## Install
```
go get -u github.com/max-planck-innovation-competition/go-openalex
```## Usage
### Downloading the data
```go
dirPath := "./path/to/folder"
openalex.Sync(dirPath)
```### Process the directory
```go
// write yor own handlers
err = openalex.ProcessDirectory(dirPath, openalex.PrintEntityHandler, openalex.PrintMergedIdRecordHandler)
if err != nil {
panic(err)
}
```### Handlers
#### EntityHandler
Every line that is parsed from the data is passed to the EntityHandler.
The EntityHandler is called with the FileEntityType and the entity.
You can pass your own handler to upload the data to a database.
```go
func EntityHandler(fileEntityType FileEntityType, entity any) error {
// TODO
}
```#### MergedIdRecordHandler
The MergedIdRecordHandler is called with the FileEntityType and the mergedIdRecord.
You can pass your own handler to modify the data in your database.
```go
func MergedIdRecordHandler(fileEntityType FileEntityType, mergedIdRecord any) error {
// TODO
}
```