11# Data Access Tool (DAT) Backend
22
3- Backend services for the [ Data Access Tool UI] ( https://github.com/nsidc/data-access-tool-ui ) .
3+ Backend services for the
4+ [ Data Access Tool UI] ( https://github.com/nsidc/data-access-tool-ui ) .
45
56A Flask-based API provides:
67
7- * The` python_script.py ` download script for data granules matching a user's filters.
8- * The
8+ - The` python_script.py ` download script for data granules matching a user's
9+ filters.
10+ - The
911 [ getLinks] ( https://github.com/nasa/earthdata-download/blob/main/docs/GET_LINKS.md )
10- service required for DAT integration with the [ NASA Earthdata
11- Downloader] ( https://github.com/nasa/earthdata-download ) .
12-
12+ service required for DAT integration with the
13+ [ NASA Earthdata Downloader] ( https://github.com/nasa/earthdata-download ) .
1314
1415Note that this service was originally a part of the
1516[ hermes-api] ( https://bitbucket.org/nsidc/hermes-api/src ) . It was moved to a
16- standalone service to support the decomissioning of ECS and the rest of the
17+ standalone service to support the decommissioning of ECS and the rest of the
1718hermes stack planned for July 2026.
1819
19-
2020## Dev
2121
22- ### Testing the download script
22+ ### Pre-commit
23+
24+ This project uses [ pre-commit] ( https://pre-commit.com/ ) to run pre-commit hooks
25+ that check and format this project's code for stylistic consistency (e.g., using
26+ ` ruff ` and ` black ` ) .
27+
28+ The pre-commit configuration for this project can be found in
29+ ` .pre-commit-config.yaml ` . Configuration for specific tools (e.g., ` vulture ` ) is
30+ given in the included ` pyproject.toml ` .
31+
32+ For more information about using ` pre-commit ` , please sese the
33+ [ Scientific Python Library Development Guide's section on pre-commit] ( https://learn.scientific-python.org/development/guides/gha-basic/#pre-commit ) .
34+
35+ To install pre-commit to run checks for each commit you make:
36+
37+ ```
38+ $ pre-commit install
39+ ```
40+
41+ To manually run the pre-commit hooks without a commit:
42+
43+ ```
44+ $ pre-commit run --all-files
45+ ```
46+
47+ > [ !NOTE] GitHub actions are configured to run pre-commit for all PRs and pushes
48+ > to the ` main ` branch. See
49+ > [ .github/workflows/pre-commit.yml] ( .github/workflows/pre-commit.yml ) .
2350
24- The tests for the download script assumes a .netrc file is setup for the current
25- user to login to earthdata. Setup a ` .netrc ` with credentials for earthdata
26- login by e.g., [ using the earthaccess
27- library] ( https://earthaccess.readthedocs.io/en/latest/howto/authenticate/ )
51+ ### Running tests
2852
29- Once a ` .netrc ` file is setup:
53+ Before manually running tests, setup the ` EARTHDATA_USERNAME ` and
54+ ` EARTHDATA_PASSWORD ` envvars, which are necessary for integration tests.
55+
56+ Next, to run all tests:
3057
3158```
32- PYTHONPATH=./src/ pytest test/
59+ scripts/run_tests.sh
3360```
3461
62+ > [ !NOTE] GitHub actions are configured to run unit tests that do not require
63+ > Earthdata login credentials for all PRs and pushes to the ` main ` branch. See
64+ > [ .github/workflows/test.yml] ( .github/workflows/test.yml ) .
65+
3566### Testing the EDD integration
3667
3768An example deep-link to initiate EDD downloads:
@@ -46,16 +77,14 @@ that looks like the above.
4677The GET request to ` earthdata-download://startDownload ` should include the
4778following query parameters:
4879
49- * ` getLinks ` : URI for ` /api/get-links/ ` . This URI will specify the
80+ - ` getLinks ` : URI for ` /api/get-links/ ` . This URI will specify the
5081 ` cmr_request_params ` query-parameter, which is a string representing the CMR
5182 query parameters mapping to a user's selections in the DAT.
52- * ` downloadId ` : The dataset ID and version for the current order (e.g., ATL06 v6
83+ - ` downloadId ` : The dataset ID and version for the current order (e.g., ATL06 v6
5384 is ` atl06_06 ` )
54- * ` authUrl ` : URI for ` /api/earthdata/auth/ ` . EDD will
55- use this to initiate a token exchange with URS to authenticate user
56- downloads. This URL must include
85+ - ` authUrl ` : URI for ` /api/earthdata/auth/ ` . EDD will use this to initiate a
86+ token exchange with URS to authenticate user downloads. This URL must include
5787 ` eddRedirect=earthdata-download%3A%2F%2FauthCallback ` as a query parameter.
5888
59- > [ !WARNING]
60- > As of this writing, the CMR query parameters are hard-coded to always return a
61- > small subset of ATL06 v6 data.
89+ > [ !WARNING] As of this writing, the CMR query parameters are hard-coded to
90+ > always return a small subset of ATL06 v6 data.
0 commit comments