Open Sustainability Index
An open, transparent, wikipedia-like sustainability database - aiming to accelerate comparable corporate sustainability data.
https://github.com/open-sustainability-index/open-sustainability-index-backend
Category: Emissions
Sub Category: Carbon Intensity and Accounting
Keywords
remix supabase swagger typescript vite
Last synced: about 20 hours ago
JSON representation
Repository metadata
Backend and API routes for Open Sustainability Index
- Host: GitHub
- URL: https://github.com/open-sustainability-index/open-sustainability-index-backend
- Owner: Open-Sustainability-Index
- License: agpl-3.0
- Created: 2024-04-17T12:50:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-18T09:16:05.000Z (5 months ago)
- Last Synced: 2025-04-18T04:10:45.185Z (9 days ago)
- Topics: remix, supabase, swagger, typescript, vite
- Language: PLpgSQL
- Homepage: https://api.opensustainabilityindex.org/v1/companies?api-key=demo&limit=10&offset=0
- Size: 1.07 MB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 5
- Releases: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
v2
List: 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)
- /components
- /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 metadata
- Name: Open Sustainability Index
- Login: Open-Sustainability-Index
- Email: [email protected]
- Kind: organization
- Description:
- Website: opensustainabilityindex.org
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/168263944?v=4
- Repositories: 1
- Last ynced at: 2024-05-03T17:18:38.870Z
- Profile URL: 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 metadata
Last synced: 6 days ago
Total Commits: 176
Total Committers: 3
Avg Commits per committer: 58.667
Development Distribution Score (DDS): 0.489
Commits in past year: 127
Committers in past year: 3
Avg Commits per committer in past year: 42.333
Development Distribution Score (DDS) in past year: 0.441
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:
- palander.se: 1
- tomsoderlund.com: 1
- tiburon.se: 1
Issue and Pull Request metadata
Last synced: 2 days ago
Total issues: 7
Total pull requests: 8
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.14
Average comments per pull request: 1.13
Merged pull request: 5
Bot issues: 0
Bot pull requests: 0
Past year issues: 7
Past year pull requests: 8
Past year average time to close issues: less than a minute
Past year average time to close pull requests: 2 days
Past year issue authors: 2
Past year pull request authors: 2
Past year average comments per issue: 0.14
Past year average comments per pull request: 1.13
Past year merged pull request: 5
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- achaido (6)
- hankmander (1)
Top Pull Request Authors
- tomsoderlund (5)
- hankmander (3)
Top Issue Labels
Top 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
Score: 3.6635616461296463