Documentation ¶
Index ¶
- type APBIndexItem
- type APBIndexItemText
- type APBIndexItemWithYear
- type BibleBook
- type BibleSimilarityEdge
- type CatholicDiocese
- type CatholicDiocesesPerDecade
- type ChristeningsByYear
- type CityMembership
- type Config
- type Denomination
- type DenominationFamily
- type Endpoint
- type ExampleURL
- type GeneralBillsByYear
- type NullInt64
- type NullString
- type Parish
- type ParishByYear
- type Place
- type PlaceCounty
- type PlaceDetails
- type PresbyteriansByYear
- type Server
- func (s *Server) AHCBCountiesByIDHandler() http.HandlerFunc
- func (s *Server) AHCBCountiesByStateCodeHandler() http.HandlerFunc
- func (s *Server) AHCBCountiesByStateTerrIDHandler() http.HandlerFunc
- func (s *Server) AHCBCountiesHandler() http.HandlerFunc
- func (s *Server) AHCBStatesHandler() http.HandlerFunc
- func (s *Server) APBIndexAllHandler() http.HandlerFunc
- func (s *Server) APBIndexBiblicalOrderHandler() http.HandlerFunc
- func (s *Server) APBIndexChronologicalHandler() http.HandlerFunc
- func (s *Server) APBIndexFeaturedHandler() http.HandlerFunc
- func (s *Server) APBIndexTopHandler() http.HandlerFunc
- func (s *Server) BibleBooksHandler() http.HandlerFunc
- func (s *Server) BibleSimilarityHandler() http.HandlerFunc
- func (s *Server) BibleTrendHandler() http.HandlerFunc
- func (s *Server) BillsHandler() http.HandlerFunc
- func (s *Server) CatholicDiocesesHandler() http.HandlerFunc
- func (s *Server) CatholicDiocesesPerDecadeHandler() http.HandlerFunc
- func (s *Server) ChristeningsHandler() http.HandlerFunc
- func (s *Server) CityMembershipHandler() http.HandlerFunc
- func (s *Server) CountiesInState() http.HandlerFunc
- func (s *Server) DenominationFamiliesHandler() http.HandlerFunc
- func (s *Server) DenominationsHandler() http.HandlerFunc
- func (s *Server) EndpointsHandler() http.HandlerFunc
- func (s *Server) GeneralBillsHandler() http.HandlerFunc
- func (s *Server) Middleware()
- func (s *Server) NENorthAmericaHandler() http.HandlerFunc
- func (s *Server) NotFoundHandler() http.HandlerFunc
- func (s *Server) ParishesHandler() http.HandlerFunc
- func (s *Server) Place() http.HandlerFunc
- func (s *Server) PlacesInCounty() http.HandlerFunc
- func (s *Server) PresbyteriansHandler() http.HandlerFunc
- func (s *Server) Routes()
- func (s *Server) Run()
- func (s *Server) Shutdown()
- func (s *Server) VerseHandler() http.HandlerFunc
- func (s *Server) VerseQuotationsHandler() http.HandlerFunc
- func (s *Server) VerseTrendHandler() http.HandlerFunc
- type Verse
- type VerseQuotation
- type VerseTrend
- type VerseTrendResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APBIndexItem ¶
type APBIndexItem struct { Reference string `json:"reference"` Text string `json:"text"` Count int `json:"count"` }
APBIndexItem is an entry in one of the different indexes to verses
type APBIndexItemText ¶
APBIndexItemText is an entry in one of the different indexes to verses, with the reference and the text of the verse.
type APBIndexItemWithYear ¶
type APBIndexItemWithYear struct { Reference string `json:"reference"` Text string `json:"text"` Count int `json:"count"` Peak int `json:"peak"` }
APBIndexItemWithYear is an index item with the peak year
type BibleBook ¶
type BibleBook struct { Book string `json:"book"` Part string `json:"part"` Order int `json:"order"` }
BibleBook describes a book of the Bible and which part of the Bible it is in.
type BibleSimilarityEdge ¶
type BibleSimilarityEdge struct { A string `json:"source"` B string `json:"target"` N int `json:"n"` }
BibleSimilarityEdge describes an edge between two parts of the Bible
type CatholicDiocese ¶
type CatholicDiocese struct { City string `json:"city"` State string `json:"state"` Country string `json:"country"` Rite string `json:"rite"` YearErected int64 `json:"year_erected"` YearMetropolitan NullInt64 `json:"year_metropolitan"` YearDestroyed NullInt64 `json:"year_destroyed"` Lon float32 `json:"lon"` Lat float32 `json:"lat"` }
CatholicDiocese describes a diocese of the Roman Catholic Church.
type CatholicDiocesesPerDecade ¶
CatholicDiocesesPerDecade shows how many dioceses were established in North America per year.
type ChristeningsByYear ¶
type ChristeningsByYear struct { ChristeningsDesc string `json:"christenings_desc"` TotalCount NullInt64 `json:"count"` WeekNo int `json:"week_no"` WeekID string `json:"week_id"` Year int `json:"year"` }
ChristeningsByYear describes a christen's description and various metadata for a given christening.
type CityMembership ¶
type CityMembership struct { Year int `json:"year"` Group string `json:"group"` City string `json:"city"` State string `json:"state"` Denominations int `json:"denominations"` Churches int `json:"churches"` Members int `json:"members"` Population1926 NullInt64 `json:"population_1926"` Lon float64 `json:"lon"` Lat float64 `json:"lat"` }
CityMembership gives the membership (and population) statistics for some aggregation of denominations in a given year.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
The Config type stores configuration which is read from environment variables.
type Denomination ¶
type Denomination struct { Name string `json:"name"` ShortName string `json:"short_name"` DenominationID NullString `json:"denomination_id"` FamilyCensus NullString `json:"family_census"` FamilyRelec string `json:"family_relec"` }
Denomination describes a denomination's names and various systems of classification.
type DenominationFamily ¶
type DenominationFamily struct {
Name string `json:"name"`
}
DenominationFamily describes a group of denominations. There can be different ways of categorizing denominations.
type Endpoint ¶
type Endpoint struct { Name string `json:"name"` URL string `json:"path"` Examples []ExampleURL `json:"examples,omitempty"` }
Endpoint describes an endpoint available in this API and provides a sample path.
type ExampleURL ¶
ExampleURL provides an example URL to a different way of querying the API for any given endpoint.
type GeneralBillsByYear ¶
type GeneralBillsByYear struct { ParishName string `json:"name"` CountType string `json:"count_type"` TotalCount NullInt64 `json:"count"` Year int `json:"year"` WeekNo int `json:"week_no"` WeekID string `json:"week_id"` }
GeneralBillsByYear describes a parish's names and various metadata for a given parish.
type NullInt64 ¶
NullInt64 embeds the sql.NullInt64 type, so that it can be extended to change the JSON marshaling.
func (NullInt64) MarshalJSON ¶
MarshalJSON marshals a null integer as `{"int": null}` rather than using an object inside the field. See https://stackoverflow.com/questions/33072172/how-can-i-work-with-sql-null-values-and-json-in-a-good-way
func (*NullInt64) UnmarshalJSON ¶
UnmarshalJSON unmarshals a null integer represented in JSON as `{"int": null}` into our embedded type that allows nulls. See https://stackoverflow.com/questions/33072172/how-can-i-work-with-sql-null-values-and-json-in-a-good-way
type NullString ¶
type NullString struct {
sql.NullString
}
NullString embeds the sql.NullString type, so that it can be extended to change the JSON marshaling.
func (NullString) MarshalJSON ¶
func (v NullString) MarshalJSON() ([]byte, error)
MarshalJSON marshals a null string as `{"string": null}` rather than using an object inside the field. See https://stackoverflow.com/questions/33072172/how-can-i-work-with-sql-null-values-and-json-in-a-good-way
func (*NullString) UnmarshalJSON ¶
func (v *NullString) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a null string represented in JSON as `{"string": null}` into our embedded type that allows nulls. See https://stackoverflow.com/questions/33072172/how-can-i-work-with-sql-null-values-and-json-in-a-good-way
type Parish ¶
type Parish struct { ParishID int `json:"id"` Name string `json:"name"` CanonicalName string `json:"canonical_name"` }
Parish describes a denomination's names and various systems of classification.
type ParishByYear ¶
type ParishByYear struct { ParishName string `json:"name"` CountType string `json:"count_type"` TotalCount NullInt64 `json:"count"` StartDay string `json:"start_day"` StartMonth string `json:"start_month"` EndDay string `json:"end_day"` EndMonth string `json:"end_month"` Year int `json:"year"` WeekNo int `json:"week_no"` WeekID string `json:"week_id"` }
ParishByYear describes a parish's names and various metadata for a given parish.
type Place ¶
type Place struct { PlaceID int `json:"place_id"` Place string `json:"place"` MapName string `json:"map_name"` }
Place represents a place with ID and name
type PlaceCounty ¶
PlaceCounty represents a county with ID and name
type PlaceDetails ¶
type PlaceDetails struct { PlaceID int `json:"place_id"` Place string `json:"place"` MapName string `json:"map_name"` County string `json:"county"` CountyAHCB string `json:"county_ahcb"` State string `json:"state"` }
PlaceDetails represents details about a place
type PresbyteriansByYear ¶
type PresbyteriansByYear struct { Year int `json:"year"` Members int `json:"members"` Churches int `json:"churches"` }
PresbyteriansByYear holds aggregate data on Presbyterian membership and churches.
type Server ¶
type Server struct { Server *http.Server Database *sql.DB Router *mux.Router Config Config Statements map[string]*sql.Stmt }
The Server type shares access to the database.
func NewServer ¶
func NewServer() *Server
NewServer creates a new Server and connects to the database or fails trying.
func (*Server) AHCBCountiesByIDHandler ¶
func (s *Server) AHCBCountiesByIDHandler() http.HandlerFunc
AHCBCountiesByIDHandler returns a GeoJSON FeatureCollection containing counties from AHCB. The handler will get the county boundaries for a particular date and by county ID (or IDs if given a comma-separated string of values).
func (*Server) AHCBCountiesByStateCodeHandler ¶
func (s *Server) AHCBCountiesByStateCodeHandler() http.HandlerFunc
AHCBCountiesByStateCodeHandler returns a GeoJSON FeatureCollection containing counties from AHCB. The handler will get the county boundaries for a particular date and by state code (or state codes if given a comma-separated string of values).
func (*Server) AHCBCountiesByStateTerrIDHandler ¶
func (s *Server) AHCBCountiesByStateTerrIDHandler() http.HandlerFunc
AHCBCountiesByStateTerrIDHandler returns a GeoJSON FeatureCollection containing counties from AHCB. The handler will get the county boundaries for a particular date and by state/territory ID (or IDs if given a comma-separated string of values).
func (*Server) AHCBCountiesHandler ¶
func (s *Server) AHCBCountiesHandler() http.HandlerFunc
AHCBCountiesHandler returns a GeoJSON FeatureCollection containing counties from AHCB. The handler will get the county boundaries for a particular date.
func (*Server) AHCBStatesHandler ¶
func (s *Server) AHCBStatesHandler() http.HandlerFunc
AHCBStatesHandler returns a GeoJSON FeatureCollection containing states from AHCB. The handler will get the county boundaries for a particular date.
func (*Server) APBIndexAllHandler ¶
func (s *Server) APBIndexAllHandler() http.HandlerFunc
APBIndexAllHandler returns basically all available verses in their biblical order.
func (*Server) APBIndexBiblicalOrderHandler ¶
func (s *Server) APBIndexBiblicalOrderHandler() http.HandlerFunc
APBIndexBiblicalOrderHandler returns verses in their biblical order.
func (*Server) APBIndexChronologicalHandler ¶
func (s *Server) APBIndexChronologicalHandler() http.HandlerFunc
APBIndexChronologicalHandler returns verses in chronological order by their peak.
func (*Server) APBIndexFeaturedHandler ¶
func (s *Server) APBIndexFeaturedHandler() http.HandlerFunc
APBIndexFeaturedHandler returns featured verses.
func (*Server) APBIndexTopHandler ¶
func (s *Server) APBIndexTopHandler() http.HandlerFunc
APBIndexTopHandler returns top verses.
func (*Server) BibleBooksHandler ¶
func (s *Server) BibleBooksHandler() http.HandlerFunc
BibleBooksHandler returns the books of the Bible (in the KJV).
func (*Server) BibleSimilarityHandler ¶
func (s *Server) BibleSimilarityHandler() http.HandlerFunc
BibleSimilarityHandler returns the information about the network of similarities within the Bible.
func (*Server) BibleTrendHandler ¶
func (s *Server) BibleTrendHandler() http.HandlerFunc
BibleTrendHandler returns the rates of quotation per year for a verse
func (*Server) BillsHandler ¶
func (s *Server) BillsHandler() http.HandlerFunc
BillsHandler returns ...
func (*Server) CatholicDiocesesHandler ¶
func (s *Server) CatholicDiocesesHandler() http.HandlerFunc
CatholicDiocesesHandler returns a JSON array of Catholic dioceses. Though the spatial data is stored in the database as a geometry, it is returned as simple lon/lat coordinates because that is easiest to process in the visualizations.
func (*Server) CatholicDiocesesPerDecadeHandler ¶
func (s *Server) CatholicDiocesesPerDecadeHandler() http.HandlerFunc
CatholicDiocesesPerDecadeHandler returns a JSON array of the number of dioceses established in North America per year.
func (*Server) ChristeningsHandler ¶
func (s *Server) ChristeningsHandler() http.HandlerFunc
ChristeningsHandler returns ...
func (*Server) CityMembershipHandler ¶
func (s *Server) CityMembershipHandler() http.HandlerFunc
CityMembershipHandler returns the statistics for all the cities for a single denomination in a single year. It must be filtered by year and denomination.
func (*Server) CountiesInState ¶
func (s *Server) CountiesInState() http.HandlerFunc
CountiesInState returns a list of all the counties in a state, with IDs from AHCB.
func (*Server) DenominationFamiliesHandler ¶
func (s *Server) DenominationFamiliesHandler() http.HandlerFunc
DenominationFamiliesHandler returns
func (*Server) DenominationsHandler ¶
func (s *Server) DenominationsHandler() http.HandlerFunc
DenominationsHandler returns the denominations that are available. Optionally, it can be filtered to get just the denominations in a particular family.
func (*Server) EndpointsHandler ¶
func (s *Server) EndpointsHandler() http.HandlerFunc
EndpointsHandler describes the endpoints that are available in this API, with sample URLs to show how the API works.
func (*Server) GeneralBillsHandler ¶
func (s *Server) GeneralBillsHandler() http.HandlerFunc
GeneralBillsHandler returns ...
func (*Server) Middleware ¶
func (s *Server) Middleware()
Middleware registers the middleware functions that should be used.
func (*Server) NENorthAmericaHandler ¶
func (s *Server) NENorthAmericaHandler() http.HandlerFunc
NENorthAmericaHandler returns a GeoJSON FeatureCollection containing country polygons for North America from Natural Earth.
func (*Server) NotFoundHandler ¶
func (s *Server) NotFoundHandler() http.HandlerFunc
NotFoundHandler returns 404 errors
func (*Server) ParishesHandler ¶
func (s *Server) ParishesHandler() http.HandlerFunc
ParishesHandler returns
func (*Server) Place ¶
func (s *Server) Place() http.HandlerFunc
Place returns the details about a populated place
func (*Server) PlacesInCounty ¶
func (s *Server) PlacesInCounty() http.HandlerFunc
PlacesInCounty returns a list of all the populated places in a county.
func (*Server) PresbyteriansHandler ¶
func (s *Server) PresbyteriansHandler() http.HandlerFunc
PresbyteriansHandler returns the aggregate data on Presbyterian memberhsip and churches.
func (*Server) Routes ¶
func (s *Server) Routes()
Routes registers the handlers for the URLs that should be served.
func (*Server) Shutdown ¶
func (s *Server) Shutdown()
Shutdown closes the connection to the database and shutsdown the server.
func (*Server) VerseHandler ¶
func (s *Server) VerseHandler() http.HandlerFunc
VerseHandler returns information about a verse, and other verses which are related to it, if any.
func (*Server) VerseQuotationsHandler ¶
func (s *Server) VerseQuotationsHandler() http.HandlerFunc
VerseQuotationsHandler returns the instances of quotations for a verse
func (*Server) VerseTrendHandler ¶
func (s *Server) VerseTrendHandler() http.HandlerFunc
VerseTrendHandler returns the rates of quotation per year for a verse
type Verse ¶
type Verse struct { Reference string `json:"reference"` Text string `json:"text"` Related []string `json:"related"` }
Verse describes the reference and text of a single Bible verse
type VerseQuotation ¶
type VerseQuotation struct { Reference string `json:"reference"` DocID string `json:"docID"` Date string `json:"date"` Probability float32 `json:"probability"` Title string `json:"title"` State string `json:"state"` }
VerseQuotation is a single instance of a quotation
type VerseTrend ¶
type VerseTrend struct { Year int `json:"year"` N int `json:"n"` QuotationRateSmooth float64 `json:"smoothed"` }
VerseTrend is the rate of quotations in a single year for a single verse in a given corpus. The quotation rate is expressed in quotations per million words; the smoothed rate has the same units, and is a centered three-year rolling average.
type VerseTrendResponse ¶
type VerseTrendResponse struct { Reference string `json:"reference"` Corpus string `json:"corpus"` Trend []VerseTrend `json:"trend"` }
VerseTrendResponse wraps the data with the queries that were made
Source Files ¶
- ahcb.go
- apb-bible-similarity.go
- apb-bible-trend.go
- apb-bible.go
- apb-index.go
- apb-verse-quotations.go
- apb-verse-trend.go
- apb-verse.go
- bom-bills-general.go
- bom-bills.go
- bom-christenings.go
- bom-parishes.go
- catholic-dioceses.go
- endpoints.go
- helpers.go
- middleware.go
- ne-northamerica.go
- populated-places.go
- presbyterians.go
- relcensus-denominations.go
- relecensus-cities.go
- routes.go
- server.go