postsec_api
Version, currently develop branch1 version
- develop branchlatestNov 15, 2019
github.com/perezperret/postsec_api
Post Secondary Institutions autocomplete API
Installation
# Add this to your shard.yml
dependencies:
postsec_api:
github: perezperret/postsec_api
branch: developdevelop is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.26.1- Author
- Santiago Perez Perret
- Target
postsec_apifrom src/postsec_api.cr
Dependencies
Runtime Dependencies
- lucky~> 0.11github: luckyframework/lucky
- carbon~> 0.1.0github: luckyframework/carbon
- authentic~> 0.1.0github: luckyframework/authentic
- lucky_migrator~> 0.6github: luckyframework/lucky_migrator
README
Ported this to Rails for convenience
PostsecAPI
This is a proof of concept for an API to search accredited post secondary institutions in the US. I once needed this for a project and thought it would work well as a standalone API.
There is a sample autocomplete (view source) using the API, and you can hit the api.
The data was obtained from the IPEDS database
On the other hand, I wanted to try out the crystal programming language and the Lucky web framework, and this looked like a nice fit.
Usage
It's a single endpoint API, at /institutions.
Options
Only three options (passed in as query params) are supported for the time being:
page: optional, defaults to1.per_page: optional, defaults to20.query: optional, searches the names of the institutions.
Example
fetch("postsecapi.herokuapp.com/institutions?page=1&per_page=1")
.then(response => response.json())
.then(responseJson => console.log(responseJson))
// = { "ipeds_id": "166027", "name": "Harvard University" }
For a more complete example, check out the sample app.
Running the project locally
- Install required dependencies
- Run
bin/setup - Run
lucky devto start the app - Set up the database running
lucky db.createand thenlucky db.migrate - Load the database seeds running
lucky db.create_required_seeds
Improvements
This is just a proof of concept and I don't intend to invest much time in it unless I find a need for it again. But here are a few ideas of what can be improved, and of course PRs would be more than welcome.
- [ ] Use the IPEDS database better
- [ ] Expose more information, for instance it would be nice to include location data.
- [ ] Use more fields in search, for instance, the
name aliasfield in the IPEDS database could help easily improve the search
- [ ] Use Postgres better (Currently a simple
ilikequery is being used, but the full text search and trigram module could greatly improve the results) - [ ] Make production ready (I think this could be a useful service and mantained very cheaply if the previous points are addressed, and API keys are added, but I think it would make more sense to port to a more mature framework)
Learn Lucky
This app uses Lucky, which in turn uses the Crystal programming language. You can learn about Lucky from the Lucky Guides.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
develop- Seen
- Nov 15, 2019
- Crystal
0.26.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/perezperret/postsec_api
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1