MAAP

Discover and use biomass relevant data, integrating the data for comparison, analysis, evaluation, and generation.
https://github.com/MAAP-Project/maap-api-nasa

Category: Biosphere
Sub Category: Biomass

Keywords from Contributors

stac open-science earth-observation

Last synced: about 16 hours ago
JSON representation

Repository metadata

NASA Python implementation of the MAAP API specification

README.md

NASA MAAP API

The joint ESA-NASA Multi-Mission Algorithm and Analysis Platform (MAAP) focuses on developing a collaborative data system enabling collocated data, processing, and analysis tools for NASA and ESA datasets. The NASA MAAP API adheres to the joint ESA-NASA MAAP API specification currently in development. This joint architectural approach enables NASA and ESA to each run independent MAAPs, while ultimately sharing common facilities to share and integrate collocated platform services.

Development server: https://api.dit.maap-project.org/api

I. Local development using docker

Set your FERNET_KEY environment variable to be a key, doesn't necessarily need to be valid.

See instructions for generating a test key: https://cryptography.io/en/latest/fernet/

cd docker
docker-compose -f docker-compose-local.yml up

Once you make code changes you might need to delete your maap-api-nasa docker image for these code changes to be reflected. If you are getting a network not found error, try running docker-compose -f docker-compose-local.yml up --force-recreate
You may need to add these keys to your docker compose environment variables to get the api running correctly/ being able to submit jobs: FERNET_KEY, GITLAB_TOKEN, CAS_PROXY_DECRYPTION_TOKEN, CAS_SECRET_KEY, CAS_SERVER_NAME, REGISTER_JOB_REPO_ID, GITLAB_API_TOKEN, GIT_REPO_URL, GITLAB_POST_PROCESS_TOKEN, MOZART_URL, MOZART_V1_URL, THIRD_PARTY_SECRET_TOKEN, MAAP_TEMP_URS_TOKEN
If you make changes to the settings, rebuild with docker-compose -f docker-compose-local.yml build --no-cache

II. Local development using poetry and virtualenv

Prerequisites:

cd maap-api-nasa
poetry install

First run: Configure the database.

  1. Add a new user called maapuser (A fix for 'role does not exist')

    NOTE: You may need to use sudo -u postgres before postgres commands.

    createuser maapuser
    
  2. Create an empty postgres db (maap) (a fix for 'database maap does not exist'):

    createdatabase maap
    
  3. OPTIONAL: PyCharm configuration, if using the PyCharm IDE:

  • Script path: ./api/maapapp.py
  • Environment variables: PYTHONUNBUFFERED=1
  • Python interpreter: Python 3.9
  • Working directory: ./api

(Obsolete?) Config Titiler endpoint and maap-api-host

In the settings.py (i.e., maap-api-nasa/api/settings.py):

# settings.py
API_HOST_URL = 'http://0.0.0.0:5000/' # For local testing

# ...

# The endpoint obtained after doing Titiler deployment
TILER_ENDPOINT = 'https://XXX.execute-api.us-east-1.amazonaws.com'
# If running the tiler locally, this can be TILER_ENDPOINT = 'http://localhost:8000'

Run the app:

poetry shell
FLASK_APP=api/maapapp.py flask run --host=0.0.0.0

Some issues you may experience while running the above line:

  • Allowing using postgres without login (A fix for 'fe_sendauth: no password supplied'):

    sudo vi /etc/postgresql/9.5/main/pg_hba.conf #(the location may be different depend on OS and postgres version)
    
    # Reconfig as follows:
        local   all     all     trust
        host    all     all     127.0.0.1/32    trust
        host    all     all     ::1/0           trust
    # Save pg_hba.conf
    
    # Restart postgresql
    sudo /etc/init.d/postgresql reload
    sudo /etc/init.d/postgresql start
    

Running Tests

Prerequisites

  • Local development environment set up (see CLAUDE.md)
  • Test database configured
  • Required environment variables set

Test Execution Commands

Local Development

# Build and run all tests
./scripts/run-tests.sh

# Run specific test categories
docker-compose -f docker/docker-compose-test.yml run --rm test pytest test/api/endpoints/

# Run tests with coverage
docker-compose -f docker/docker-compose-test.yml run --rm test pytest --cov=api --cov-report=html

# Run tests in watch mode
docker-compose -f docker/docker-compose-test.yml run --rm test pytest -f

Debugging Tests

# Run tests with detailed output
docker-compose -f docker/docker-compose-test.yml run --rm test pytest -vvv -s

# Run specific test
docker-compose -f docker/docker-compose-test.yml run --rm test pytest test/api/endpoints/test_members.py::TestMemberManagement::test_new_member_can_be_created_successfully

# Run with debugger
docker-compose -f docker/docker-compose-test.yml run --rm test pytest --pdb

Test Execution

# Run all tests
python -m unittest discover test/

# Run specific test modules
python -m unittest test.api.endpoints.test_members
python -m unittest test.api.utils.test_email

# Run individual test methods
python -m unittest test.api.endpoints.test_members.MembersCase.test_create_member

III. User Accounts

A valid MAAP API token must be included in the header for any API request. An Earthdata account is required to access the MAAP API. To obtain a token, URS credentials must be provided as shown below:

curl -X POST --header "Content-Type: application/json" -d "{ \"username\": \"urs_username\", \"password\": \"urs_password\" }" https://api.dit.maap-project.org/token

Comments:

  • After running the local maap-api-nasa, go to http://0.0.0.0:5000/api to see the APIs.

  • Or running the your own test scripts with:

curl -X POST --header "Content-Type: application/json" -d "{ \"username\": \"urs_username\", \"password\": \"urs_password\" }" http://0.0.0.0:5000/token

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 620
Total Committers: 18
Avg Commits per committer: 34.444
Development Distribution Score (DDS): 0.661

Commits in past year: 24
Committers in past year: 4
Avg Commits per committer in past year: 6.0
Development Distribution Score (DDS) in past year: 0.333

Name Email Commits
bsatoriu b****s@j****v 210
Aimee Barciauskas a****e@d****g 81
namratam n****g@g****m 69
grallewellyn g****n@j****v 56
Malarout n****t@j****v 54
bsatoriu b****u@j****v 51
Anil Natha A****a@j****v 23
Frank Greguska 8****e 19
TonHai1111 t****i@g****m 15
Sujen Shah s****2 14
Marjorie Lucas m****s@j****v 10
Anthony Lukach a****h@g****m 6
Phil Varner p****r@g****m 5
echyam e****m@g****m 3
Chuck Daniels c****4@g****m 1
Jamison French j****h@g****m 1
Laura Alisic Jewell l****l 1
Slesa Adhikari s****d@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 13 days ago

Total issues: 22
Total pull requests: 208
Average time to close issues: about 2 months
Average time to close pull requests: 11 days
Total issue authors: 10
Total pull request authors: 16
Average comments per issue: 1.23
Average comments per pull request: 0.73
Merged pull request: 164
Bot issues: 0
Bot pull requests: 1

Past year issues: 3
Past year pull requests: 48
Past year average time to close issues: N/A
Past year average time to close pull requests: 3 days
Past year issue authors: 2
Past year pull request authors: 4
Past year average comments per issue: 0.0
Past year average comments per pull request: 1.1
Past year merged pull request: 26
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/MAAP-Project/maap-api-nasa

Top Issue Authors

  • sujen1412 (7)
  • frankinspace (4)
  • marjo-luc (3)
  • bsatoriu (2)
  • abarciauskas-bgse (1)
  • emileten (1)
  • omshinde (1)
  • anilnatha (1)
  • wildintellect (1)
  • hrodmn (1)

Top Pull Request Authors

  • bsatoriu (80)
  • grallewellyn (32)
  • sujen1412 (31)
  • marjo-luc (15)
  • abarciauskas-bgse (13)
  • anilnatha (12)
  • frankinspace (10)
  • TonHai1111 (5)
  • NamrataM (2)
  • jjfrench (2)
  • philvarner (1)
  • emileten (1)
  • chuckwondo (1)
  • dependabot[bot] (1)
  • slesaad (1)

Top Issue Labels

  • bug (3)
  • enhancement (3)
  • help wanted (1)

Top Pull Request Labels

  • bug (2)
  • dependencies (1)

Dependencies

docker/Dockerfile docker
  • python 3.9 build
docker/docker-compose.yml docker
  • maap-api-nasa latest
  • postgres 14.5
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v3 composite
  • docker/setup-compose-action v1 composite
docker/docker-compose-local.yml docker
  • maap-api-nasa latest
  • postgres 14.5
.github/workflows/build.yml actions
  • abatilo/actions-poetry v3 composite
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
  • docker/build-push-action v5 composite
  • docker/login-action v3 composite
  • docker/metadata-action v5 composite
  • getsentry/action-github-app-token v3 composite
  • ncipollo/release-action v1 composite
docker/docker-compose-test.yml docker
  • postgres 14.5
.github/workflows/release-branch-created.yml actions
  • abatilo/actions-poetry v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • getsentry/action-github-app-token v3 composite
.devcontainer/docker-compose-dev-container.yml docker
  • postgres 14.5
pyproject.toml pypi
  • factory-boy ^3.3.0 develop
  • faker ^19.0.0 develop
  • freezegun ^1.2.2 develop
  • pylint ^3.1.0 develop
  • pytest ^7.4.0 develop
  • pytest-cov ^4.1.0 develop
  • pytest-mock ^3.11.1 develop
  • requests-mock ^1.11.0 develop
  • responses ^0.23.0 develop
  • boto3 ^1.34.91
  • cachetools ^5.3.3
  • cryptography ^43.0.0
  • cwl-utils >0.10
  • flask ^2
  • flask-api ^3.1
  • flask-cors ^4.0.0
  • flask-jwt-extended ^4.6.0
  • flask-restx ^1.3.0
  • flask-sqlalchemy ^3.1.1
  • gitpython ^3.1.43
  • gunicorn ^22.0.0
  • mapproxy ^2.0.2
  • marshmallow-sqlalchemy ^1.0.0
  • natsort ^8.4.0
  • owslib ^0.30.0
  • pillow ^10.3.0
  • psycopg2 ^2.9.9
  • psycopg2-binary ^2.9.9
  • pycryptodome ^3.20.0
  • pyjwt ^2.8.0
  • pyproj ^3.6.1
  • pyshp ^2.3.1
  • python ^3.9.0
  • python-gitlab ^4.11.1
  • python-keycloak ^4.1.0
  • requests ^2.31.0
  • requests-file ^2.0.0
  • werkzeug ^2.2
  • xmltodict ^0.13.0
poetry.lock pypi
  • 145 dependencies

Score: 6.068425588244111