Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST feature layer extractor #48

Merged
merged 47 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3aba975
ci: deployment notifications
jacobdadams Sep 19, 2023
ec5df80
docs: building autodocs
jacobdadams Sep 19, 2023
f1fe036
feat: chunker helper method
jacobdadams Sep 19, 2023
03cdf97
wip: rest loader oids
jacobdadams Sep 19, 2023
6faa336
fix: sort oids
jacobdadams Sep 19, 2023
53cbfa5
feat: load feautres from rest given oids
jacobdadams Sep 19, 2023
d4c54a2
feat: main get_features
jacobdadams Sep 19, 2023
3e124b6
refactor: use classmethod instead
jacobdadams Sep 19, 2023
93d1d7c
docs: docstrings
jacobdadams Sep 19, 2023
8d6cc12
feat: ensure output length matches service
jacobdadams Sep 19, 2023
44dbf13
feat: check for query capability
jacobdadams Sep 19, 2023
eb093ed
chore: logging, trailing slash check
jacobdadams Sep 19, 2023
d950c35
feat: check layer type
jacobdadams Sep 19, 2023
e94cb64
fix: query bounds
jacobdadams Sep 19, 2023
40ac7d2
chore: redudnant logging
jacobdadams Sep 19, 2023
c15de70
ci: version pinning
jacobdadams Sep 19, 2023
0e5e79d
chore: clean up examples
jacobdadams Sep 19, 2023
3c379ef
chore: pass arbitrary query params
jacobdadams Sep 19, 2023
d30a513
feat: sleep, dry request, add key error checking
jacobdadams Sep 19, 2023
5d93ec4
feat: get features by "objectIds" query
jacobdadams Sep 19, 2023
71d93f4
chore: get oid field, use where in clause
jacobdadams Sep 19, 2023
4d41e75
chore: code review suggestions
jacobdadams Sep 19, 2023
8bb9fa3
chore: docstrings
jacobdadams Sep 19, 2023
c138b8c
feat: helper method to get info about layers in service
jacobdadams Sep 19, 2023
e1130ad
wip: layer info refactoring
jacobdadams Sep 19, 2023
76ce091
chore: refactor rest loader
jacobdadams Sep 19, 2023
ec76cf4
docs: update after refactor
jacobdadams Sep 19, 2023
9a25929
chore: docstrings
jacobdadams Sep 19, 2023
5529e0d
wip: test coverage
jacobdadams Sep 19, 2023
9dc8397
test: service layer init
jacobdadams Sep 19, 2023
cf74775
chore: double check errors in docstrings
jacobdadams Sep 19, 2023
662a477
deps: optional pinned deps to fix arcgis mess
jacobdadams Sep 19, 2023
45cc88c
fix: handle requests that return 0 features
jacobdadams Sep 19, 2023
3d5c453
ci: rename workflow
jacobdadams Sep 19, 2023
995150b
ci: fix pip problems
jacobdadams Sep 19, 2023
10e213d
chore: add where clause option
jacobdadams Sep 19, 2023
d05e7dc
chore: download tables as well as feature services
jacobdadams Sep 19, 2023
ba9004f
chore: more table stuff, default where clause
jacobdadams Sep 19, 2023
b5ffdff
chore: alligator should eat the number
jacobdadams Sep 19, 2023
1c4be65
feat: expose retry settings
jacobdadams Sep 19, 2023
54e08b0
tests: proper global state management
jacobdadams Sep 19, 2023
09b7b0d
chore: code review suggestions
jacobdadams Sep 19, 2023
8306fc9
chore: maxRecordCount check for group layers
jacobdadams Sep 19, 2023
34dc844
chore: remove TODO note
jacobdadams Sep 19, 2023
cd4456a
refactor: promote ServiceLayer to simplify method calls
jacobdadams Sep 19, 2023
8803c86
docs: update for ServiceLayer refactor
jacobdadams Sep 19, 2023
5230fa3
fix: duplicate indices breaking sedfs
jacobdadams Sep 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test
name: Push Events

on: [push, pull_request]

Expand All @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v2

- name: Install module
run: pip install .[tests]
run: pip install .[tests,nopro]

- name: Test with pytest
run: pytest
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: 🔔 Create deployment notification
uses: agrc/service-now-worknote-action@v1
with:
repo-token: ${{ github.token }}
username: ${{ secrets.SN_USERNAME }}
password: ${{ secrets.SN_PASSWORD }}
instance-name: ${{ secrets.SN_INSTANCE }}
table-name: ${{ secrets.SN_TABLE }}
system-id: ${{ secrets.SN_SYS_ID }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@ Now that you've got the token string, you can build the status query:
`https://services1.arcgis.com/<unique string>/arcgis/rest/services/<feature layer name>/FeatureServer/<layer id>/append/jobs/<job guid>?f=json&<token from agol>`

Calling this URL in a browser should return a message that will hopefully give you more info as to why it failed.

### Updating Docs

palletjack uses `pdoc` to generate HTML docs in `docs/palletjack` from the docstrings within the code itself. These are then served up via github pages.

The github pages are served from the `gh-pages` branch. After you make edits to the code and update the docstrings, rebase this branch onto the updated `main` branch. To prevent github pages from trying to generate a site from the contents of `docs/palletjack` with jekyll, add a `.nojekyll` file to `docs/palletjack`.

To generate the docs, run `pdoc --html -o docs\ c:\palletjack\repo\src\palletjack --force`. The code's docstrings should be Google-style docstrings with proper indentation to ensure the argument lists, etc are parsed and displayed correctly.
jacobdadams marked this conversation as resolved.
Show resolved Hide resolved

`docs/README.md` is included at the top package level by adding the line `.. include:: ../../docs/README.md` in `__init__.py`'s docstring. This tells pdoc to insert that markdown into the HTML generated for that docstring, and the include directive can be used for more in-depth documentation anywhere else as well. Note that `pdoc` tries to create links for anything surrounded by backticks, which are also used for coad blocks. You may need to manually edit the HTML to remove the links if they change the content of your code blocks (such as in the example import statement).

Once the contents of `docs/palletjack` look correct, force push the `gh-pages` branch to github. This will trigger the action to republish the site. The docs are then accessible at [agrc.github.io/palletjack/palletjack/index.html].
2 changes: 2 additions & 0 deletions docs/examples.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging
import sys
from pathlib import Path
from tempfile import TemporaryDirectory

Expand Down
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
setup(
name='ugrc-palletjack',
version=version['__version__'],
description='Updating AGOL feature services with data from SFTP shares.',
description='Updating AGOL feature services with data from external tables.',
long_description=(Path(__file__).parent / 'README.md').read_text(),
long_description_content_type='text/markdown',
author='Jake Adams, UGRC',
Expand Down Expand Up @@ -44,9 +44,16 @@
'SQLAlchemy==1.4.*',
'pg8000==1.29.*',
'psycopg2-binary==2.9.*',
'numpy==1.23.*', #: Pinned to 1.23.* to fix "module 'numpy' has no attribute 'str'" error
'numpy<=1.23.5', #: Pinned to < 1.24 to fix "module 'numpy' has no attribute 'str'" error
],
extras_require={
'nopro': [
#: pinned versions to avoid backtracking if pro (and thus arcgis) aren't already installed
'jupyterlab==3.6.5',
'jupyter-server==1.24.0',
'ipykernel==6.24.0',
'ypy-websocket==0.8.2'
],
'tests': [
'pylint-quotes==0.2.*',
'pylint==2.15.*',
Expand Down
Loading
Loading