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

62: add support for entities and entity_lists #65

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

lindsay-stevens
Copy link
Contributor

@lindsay-stevens lindsay-stevens commented Mar 28, 2024

Closes #62

Adds methods:

  • client.entity_lists.list
  • client.entities.list
  • client.entities.create
  • client.entities.get_table

Other entity_lists methods in #62 not included as they aren't publicly documented yet, so I don't know what the proper call pattern or response type/schema is. Although I took a guess based on manual testing for the test setup function in tests/utils/entity_lists.py.

What has been done to verify that this works as intended?

E2E tests added to test_client.py as well as usual unit tests.

Why is this the best possible solution? Were any other approaches considered?

I split entities from entity_lists, because they are separate object types. Due to the similar names it was confusing for me initially to tell the difference between an entity and entity_list and what they are supposed to do. Especially considering entity.list(), entity_list.list(). So the docstrings for EntityService and EntityListService try to clarify the difference.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Shiny new features!

Do we need any specific form for testing your changes? If so, please attach one.

No it's automated in test_client.py.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

The auto-generated docs is a good start but maybe we should add a notebook or something once the extra entity_list methods are available. Something like test_client.py/test_entities__create_and_query but more elaborate and relatable.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run python -m unittest and verified all tests pass
  • run ruff format pyxform tests and ruff check pyxform tests to lint code
  • verified that any code or assets from external sources are properly credited in comments

- fix: entity.py `create()` should send JSON not form-encoded data
- fix: projects.py typo in comment
- chg: readme.md make description generic rather than listing everything
- add: test entity_lists.py creation of test fixture with properties
- add: e2e test cases for entities and entity_lists functionality
@lindsay-stevens lindsay-stevens marked this pull request as ready for review April 17, 2024 14:17
- also tried to make the docstrings a bit clearer
pyodk/_endpoints/entities.py Show resolved Hide resolved
pyodk/_endpoints/entities.py Show resolved Hide resolved
@lognaturel
Copy link
Member

entity_list.list()

Yes, that's pretty miserable indeed. Luckily, I believe it will be a rare thing to do. I imagine generally clients will know which entity list to operate on without having to list them. We'll find out! We can always adjust if we need to.

maybe we should add a notebook or something

Maybe something like https://forum.getodk.org/t/datasets-in-central-are-now-entity-lists-please-help-translate/42893/4?u=ln? I think going through a data source and creating entities one by one will continue to be a relevant automation even when we release bulk entity creation.

@lindsay-stevens lindsay-stevens merged commit 7040a26 into getodk:master Apr 18, 2024
4 checks passed
@lindsay-stevens lindsay-stevens deleted the pyodk-62 branch April 18, 2024 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support entities
2 participants