Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
/ go-dol-healthsafety Public archive

US Department of Labor Health & Safety API access, in Go.

License

Notifications You must be signed in to change notification settings

gmccue/go-dol-healthsafety

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-dol-healthsafety

Build Status GoDoc

go-dol-healthsafety provides programmatic access to the United States Department of Labor Health & Safety datasets API.

This library is currently a work in progress and only provides access to the datasets listed in Provided Endpoints.

Installation

go get github.com/gmccue/go-dol-healthsafety

Usage

In order to use this library, you must have a valid API token for the DOL Public API. You can register for an API key at the US DOL website.

Important: By default, the first 100 results will be returned per request. In order to retrieve additional data, you must use query filters and paginate through the dataset. See the Filters section for more information.

import (
    "log"

    hstats "github.com/gmccue/go-dol-healthsafety"
)

func main() {
    api := hstats.New("{my_secret_key}")
    api.Debug = true

    basicMineInfo, err := api.QueryAddressOfRecord()
    if err != nil {
        log.Println(err)
    }

    log.Printf("%v", basicMineInfo)
}

Filters

A description of available filters can be found here.

Filters can be applied by using the AddFilter() method. For example:

import strconv

// Paginate API results: 10 results per page, first 10 pages.
resultsPerPage := 10

for p := 0; p < 10; p++ { 
    top := strconv.Itoa(resultsPerPage)
    skip := strconv.Itoa(p * resultsPerPage)

    api.AddFilter("top", top)
    api.AddFilter("skip", skip)
}

Provided Endpoints

Auto Workers

These queries provide access to the Auto Workers API endpoint.

Car Closed Repurposed

ccr, err := api.QueryCarClosedRepurposed()

Basic Mine Information

These queries provide access to the Basic Mine Information API endpoint.

Address of record

aor, err := api.QueryAddressOfRecord()

DOL OSHA Compliance

These queries provide access to the DOL OSHA Compliance API endpoint.

OSHA Fatalities

of, err := api.QueryOSHAFatalities()

Full Mine Information

These queries provide access to the the Full Mine Information API endpoint.

MSHA Mines

fm, err := api.QueryFullMineInfo()

Fatal Occupational Injuries

These queries provide access to the Fatal Occupational Injuries API endpoints.

Area

a, err := api.QueryFIArea()

Case

c, err := api.QueryFICase()

Category

c, err := api.QueryFICategory()

Category2

c2, err := api.QueryFICategory2()

Data Pub

dp, err := api.QueryFIDataPub()

Data Type

dt, err := api.QueryFIDataType()

Event

e, err := api.QueryFIEvent()

Footnote

f, err := api.QueryFIFootnote()

GQT Case

gc, err := api.QueryFIGQTCase()

GQT Char

gc, err := api.QueryFIGQTChar()

GQT Char Ownership

gco, err := api.QueryFIGQTCharOwnership()

GQT Ownership

go, err := api.QueryFIGQTOwnership()

GQT State

gs, err := api.QueryFIGQTState()

GQT State Ownership

gso, err := api.QueryFIGQTStateOwnership()

Industry

i, err := api.QueryFIIndustry()

Series

s, err := api.QueryFISeries()

Gulf Oil Spill

These queries provide access to the the Gulf Oil Spill API endpoint.

OSHA Direct Read Sampling

dr, err := api.QueryOSHADirectReadSampling()

Noise Report

on, err := api.QueryOSHANoiseReport()

Mine Accident Injuries

These queries provide access to the the Mine Accident Injuries API endpoint.

Mine Accident, Injury and Illness Report

ma, err := api.QueryMineAccidents()

Mine Inspections

These queries provide access to the Mine Inspections API endpoint.

Mine Inspections

ep, err := api.QueryMineInspections()

Mine Violation

These queries provide access to the Mine Violation API endpoint.

Mine Violation

mv, err := api.QueryMineViolations()

MSHA Employment Production

These queries provide access to the MSHA Employment Production API endpoint.

MSHA Employment Production

ep, err := api.QueryMSHAEmploymentProduction()

About

US Department of Labor Health & Safety API access, in Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages