open-sustainability-index-backend
Backend and API routes for Open Sustainability Index
https://github.com/open-sustainability-index/open-sustainability-index-backend
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.3%) to scientific vocabulary
Keywords
Repository
Backend and API routes for Open Sustainability Index
Basic Info
- Host: GitHub
- Owner: Open-Sustainability-Index
- License: agpl-3.0
- Language: PLpgSQL
- Default Branch: main
- Homepage: https://api.opensustainabilityindex.org/v1/companies?api-key=demo&limit=10&offset=0
- Size: 1.07 MB
Statistics
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 5
- Releases: 0
Topics
Metadata Files
README.md
Open Sustainability Index (backend)
Introduction for new contributors
See the README on https://github.com/Open-Sustainability-Index
How to run
npm run dev
Set up local Supabase development
cd supabase
npx supabase start
Take note of API URL and anon key. You can also use this to get API keys and URLs:
npx supabase status
Development environment
Supabase web admin: http://127.0.0.1:54333/
Postgres connection string for TablePlus/Postico: postgresql://postgres:postgres@localhost:54332/postgres
Get schema and data from cloud database
npx supabase db pull # Pull down local db schema from cloud db
npx supabase db push # Push up your local db schema to cloud db
Note: If you get “Wrong password” message, add your password with --password [SUPABASE_PASSWORD]
Get data:
npx supabase db dump --data-only -f db_data.sql
psql --single-transaction --file db_data.sql --dbname 'postgresql://postgres:postgres@localhost:54332/postgres'
Creating migration of database changes from local machine to server
Edit your local database, then run:
npx supabase db diff -f [migration-name]
# Then normally run: npx supabase db push
Running a migration locally:
npx supabase migration up
Reset database and apply current migrations:
npx supabase db reset
API
Note: use &api-key=demo, or set it as a Bearer token in the header.
- Companies:
- List: http://localhost:5173/v1/companies?sort=company_name&order=asc&limit=20&offset=0&api-key=demo
- List by tag: http://localhost:5173/v1/companies?tags=omx120&api-key=demo
v2List: http://localhost:5173/v2/companies?sort=company_name&order=asc&limit=20&offset=0&api-key=demo- Company: http://localhost:5173/v1/companies/skf?api-key=demo
- Company all years: http://localhost:5173/v1/companies/skf/all-years?api-key=demo
- Industries: http://localhost:5173/v1/industries?api-key=demo
- Search: http://localhost:5173/v1/search?query=Maersk&sort=name&order=asc&api-key=demo
Live API on https://api.opensustainabilityindex.org/ e.g. https://api.opensustainabilityindex.org/v1/companies/skf?api-key=demo
Structure
- /app
- /components - /common - /input - /[area specific]
- /routes
- /api
- /hooks (incl context)
- /services (business logic)
- /utils (smaller utils)
- /loaders - articles.ts
- /config
- /public
- /db
- /migrations
SQL functions
SELECT * FROM companies(
0, -- offset_value
20, -- limit_value
'name', -- sort_by
'asc', -- sort_order
-- 'Technology', -- industry_filter
-- true, -- near_term_filter
-- 'Type A', -- commitment_type_filter
-- 'Active', -- commitment_status_filter
-- 'Target 1' -- target_target_filter
-- 'omx120' -- tags_filter
);
-- v2:
SELECT * FROM companies_v2(
0, -- offset_value
20, -- limit_value
'name', -- sort_by
'asc' -- sort_order
-- 'Technology', -- industry_filter
-- true, -- near_term_filter
-- 'Type A', -- commitment_type_filter
-- 'Active', -- commitment_status_filter
-- 'Target 1' -- target_target_filter
-- ?? -- emissions_required
-- 'omx120' -- tags_filter
);
Get SQL code:
SELECT pg_get_functiondef('companies_v2'::regproc);
Owner
- Name: Open Sustainability Index
- Login: Open-Sustainability-Index
- Kind: organization
- Email: team@opensustainabilityindex.org
- Website: opensustainabilityindex.org
- Repositories: 1
- Profile: https://github.com/Open-Sustainability-Index
GitHub Events
Total
- Watch event: 1
- Delete event: 1
- Issue comment event: 2
- Push event: 14
- Pull request event: 3
- Create event: 1
Last Year
- Watch event: 1
- Delete event: 1
- Issue comment event: 2
- Push event: 14
- Pull request event: 3
- Create event: 1
Committers
Last synced: 6 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Henric Malmberg | h****c@t****e | 90 |
| Tom Söderlund | t****m@t****m | 85 |
| Petter Palander | p****r@p****e | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 6
- Total pull requests: 7
- Average time to close issues: less than a minute
- Average time to close pull requests: 2 days
- Total issue authors: 2
- Total pull request authors: 2
- Average comments per issue: 0.17
- Average comments per pull request: 1.14
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Issue authors: 0
- Pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 1.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- achaido (5)
- tomsoderlund (1)
- hankmander (1)
Pull Request Authors
- tomsoderlund (9)
- hankmander (4)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- 643 dependencies
- @remix-run/dev ^2.8.1 development
- vite ^5.2.9 development
- @remix-run/node ^2.8.1
- @remix-run/react ^2.8.1
- @remix-run/serve ^2.8.1
- @supabase/ssr ^0.3.0
- @supabase/supabase-js ^2.42.7
- googleapis ^105.0.0
- isbot ^4.4.0
- react ^18.2.0
- react-dom ^18.2.0