A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

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

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.

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 metadata


GitHub Events

Total
Last Year

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 Email 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:


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

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/open-sustainability-index/open-sustainability-index-backend

Top Issue Authors

  • achaido (6)
  • hankmander (1)

Top Pull Request Authors

  • tomsoderlund (5)
  • hankmander (3)

Top Issue Labels

Top Pull Request Labels


Dependencies

package-lock.json npm
  • 643 dependencies
package.json npm
  • @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