Documentation ¶
Index ¶
- type APBIndexItem
- type APBIndexItemText
- type APBIndexItemWithYear
- type APIParameters
- type BibleBook
- type BibleSimilarityEdge
- type CatholicDiocese
- type CatholicDiocesesPerDecade
- type Causes
- type Christenings
- type ChristeningsByYear
- type CityMembership
- type Config
- type DeathCauses
- type Denomination
- type DenominationFamily
- type Endpoint
- type ExampleURL
- 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) APBBibleBooksHandler() http.HandlerFunc
- func (s *Server) APBBibleSimilarityHandler() http.HandlerFunc
- func (s *Server) APBBibleTrendHandler() 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) APBVerseHandler() http.HandlerFunc
- func (s *Server) APBVerseQuotationsHandler() http.HandlerFunc
- func (s *Server) APBVerseTrendHandler() http.HandlerFunc
- func (s *Server) BillsHandler() http.HandlerFunc
- func (s *Server) CacheTest() http.HandlerFunc
- func (s *Server) CatholicDiocesesHandler() http.HandlerFunc
- func (s *Server) CatholicDiocesesPerDecadeHandler() http.HandlerFunc
- func (s *Server) ChristeningsHandler() http.HandlerFunc
- func (s *Server) CountiesInState() http.HandlerFunc
- func (s *Server) DeathCausesHandler() http.HandlerFunc
- func (s *Server) EndpointsHandler() http.HandlerFunc
- func (s *Server) ListCausesHandler() http.HandlerFunc
- func (s *Server) ListChristeningsHandler() http.HandlerFunc
- func (s *Server) Middleware()
- func (s *Server) NaturalEarthHandler() 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) RelCensusCityMembershipHandler() http.HandlerFunc
- func (s *Server) RelCensusDenominationFamiliesHandler() http.HandlerFunc
- func (s *Server) RelCensusDenominationsHandler() http.HandlerFunc
- func (s *Server) Routes()
- func (s *Server) Run() error
- func (s *Server) Shutdown()
- func (s *Server) TotalBillsHandler() http.HandlerFunc
- type TotalBills
- 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 APIParameters ¶
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 Christenings ¶
Christenings describes a christening location.
type ChristeningsByYear ¶
type ChristeningsByYear struct { Christening string `json:"christening"` TotalCount NullInt64 `json:"count"` WeekNo NullInt64 `json:"week_no"` StartDay NullInt64 `json:"start_day"` StartMonth string `json:"start_month"` EndDay NullInt64 `json:"end_day"` EndMonth string `json:"end_month"` Year int `json:"year"` SplitYear string `json:"split_year"` TotalRecords int `json:"totalrecords"` }
ChristeningsByYear describes a christening's description, total count, week number, week ID, and year.
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 DeathCauses ¶
type DeathCauses struct { Death string `json:"death"` Count NullInt64 `json:"count"` DescriptiveText NullString `json:"descriptive_text"` WeekID string `json:"week_id"` WeekNo int `json:"week_no"` StartDay NullInt64 `json:"start_day"` StartMonth NullString `json:"start_month"` EndDay NullInt64 `json:"end_day"` EndMonth NullString `json:"end_month"` Year NullInt64 `json:"year"` SplitYear string `json:"split_year"` TotalRecords int `json:"totalrecords"` }
DeathCauses returns a list of causes of death with a count of deaths for each cause and related metadata.
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 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 parish name, canonical name, and unique ID.
type ParishByYear ¶
type ParishByYear struct { CanonicalName string `json:"name"` BillType string `json:"bill_type"` CountType string `json:"count_type"` Count NullInt64 `json:"count"` StartDay NullInt64 `json:"start_day"` StartMonth NullString `json:"start_month"` EndDay NullInt64 `json:"end_day"` EndMonth NullString `json:"end_month"` Year NullInt64 `json:"year"` SplitYear string `json:"split_year"` WeekNo int `json:"week_no"` WeekID string `json:"week_id"` TotalRecords int `json:"totalrecords"` }
ParishByYear describes a parish's canoncial name, count type, total count, start day, start month, end day, end month, year, week number, and week ID.
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 DB *pgxpool.Pool Router *mux.Router Config Config Cache *cache.Client }
The Server type shares access to the database.
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) APBBibleBooksHandler ¶
func (s *Server) APBBibleBooksHandler() http.HandlerFunc
APBBibleBooksHandler returns the books of the Bible (in the KJV).
func (*Server) APBBibleSimilarityHandler ¶
func (s *Server) APBBibleSimilarityHandler() http.HandlerFunc
APBBibleSimilarityHandler returns the information about the network of similarities within the Bible.
func (*Server) APBBibleTrendHandler ¶
func (s *Server) APBBibleTrendHandler() http.HandlerFunc
APBBibleTrendHandler returns the rates of quotation per year for a verse.
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 for APB.
func (*Server) APBIndexTopHandler ¶
func (s *Server) APBIndexTopHandler() http.HandlerFunc
APBIndexTopHandler returns top verses for APB.
func (*Server) APBVerseHandler ¶
func (s *Server) APBVerseHandler() http.HandlerFunc
APBVerseHandler returns information about a verse, and other verses which are related to it, if any.
func (*Server) APBVerseQuotationsHandler ¶
func (s *Server) APBVerseQuotationsHandler() http.HandlerFunc
APBVerseQuotationsHandler returns the instances of quotations for a verse.
func (*Server) APBVerseTrendHandler ¶
func (s *Server) APBVerseTrendHandler() http.HandlerFunc
APBVerseTrendHandler returns the rates of quotation per year for a verse.
func (*Server) BillsHandler ¶
func (s *Server) BillsHandler() http.HandlerFunc
BillsHandler returns the bills for a given range of years. It expects a start year and an end year. It returns a JSON array of ParishByYear objects.
func (*Server) CacheTest ¶
func (s *Server) CacheTest() http.HandlerFunc
CacheTest returns the time the application started and the time that the handler was last run. So if the result is cached, then one would expect that the time the handler was last run would remain the same.
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 the christenings for a given range of years. It expects a start year and end year as query parameters.
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) DeathCausesHandler ¶
func (s *Server) DeathCausesHandler() http.HandlerFunc
DeathCausesHandler returns a JSON array of causes of death. The list of causes depends on whether a user has provided a comma-separated list of causes. If no list is provided, it returns the entire list of causes.
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) ListCausesHandler ¶
func (s *Server) ListCausesHandler() http.HandlerFunc
func (*Server) ListChristeningsHandler ¶
func (s *Server) ListChristeningsHandler() http.HandlerFunc
ListChristeningsHandler returns a list of parish names and ids where christenings have been recorded.
func (*Server) Middleware ¶
func (s *Server) Middleware()
Middleware registers the middleware functions that should be used.
func (*Server) NaturalEarthHandler ¶
func (s *Server) NaturalEarthHandler() http.HandlerFunc
NaturalEarthHandler returns a GeoJSON FeatureCollection containing country polygons by passing location parameters. The available country parameters are: Africa; Antarctica; Asia; Europe; North+America; Oceania; South+America; Seven+seas+(open+ocean)
func (*Server) NotFoundHandler ¶
func (s *Server) NotFoundHandler() http.HandlerFunc
NotFoundHandler returns 404 errors
func (*Server) ParishesHandler ¶
func (s *Server) ParishesHandler() http.HandlerFunc
ParishesHandler returns a list of unique parish IDs and names.
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) RelCensusCityMembershipHandler ¶
func (s *Server) RelCensusCityMembershipHandler() http.HandlerFunc
RelCensusCityMembershipHandler 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) RelCensusDenominationFamiliesHandler ¶
func (s *Server) RelCensusDenominationFamiliesHandler() http.HandlerFunc
RelCensusDenominationFamiliesHandler returns
func (*Server) RelCensusDenominationsHandler ¶
func (s *Server) RelCensusDenominationsHandler() http.HandlerFunc
RelCensusDenominationsHandler returns the denominations that are available. Optionally, it can be filtered to get just the denominations in a particular family.
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) TotalBillsHandler ¶
func (s *Server) TotalBillsHandler() http.HandlerFunc
TotalBillsHandler returns the total number of bills in the database. This number is required for pagination in the web application.
type TotalBills ¶
type TotalBills struct {
TotalRecords NullInt64 `json:"total_records"`
}
TotalBills returns to the total number of records in the database. We need this number to get pagination working.
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.go
- bom-causes.go
- bom-christenings.go
- bom-parishes.go
- cache-test.go
- catholic-dioceses.go
- endpoints.go
- helpers.go
- middleware.go
- ne-globe.go
- populated-places.go
- presbyterians.go
- relcensus-denominations.go
- relecensus-cities.go
- routes.go
- server.go