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

Feature/30 enums #31

Merged
merged 8 commits into from
Nov 28, 2018
Merged

Feature/30 enums #31

merged 8 commits into from
Nov 28, 2018

Conversation

clbarnes
Copy link
Collaborator

@clbarnes clbarnes commented Oct 29, 2018

resolves #30

@clbarnes
Copy link
Collaborator Author

clbarnes commented Oct 31, 2018

To check:

  • Are relation IDs (those built into mainline CATMAID, anyway) always the same? The connector_types endpoint always fetches them from the database, so maybe not. But some endpoints are documented in a way which suggests that they are.

@clbarnes clbarnes force-pushed the feature/30-enums branch 2 times, most recently from 2097cae to 007cf62 Compare October 31, 2018 20:41
@aschampion
Copy link
Contributor

I think we want to not assume relation IDs are always the same and can be project-defined. Endpoint docs are legacy and should be updated. Relation IDs should be fetched and cached once per-project.

@clbarnes
Copy link
Collaborator Author

clbarnes commented Nov 1, 2018

Rebased on master after #27

- Use in export application
- Add convenience methods
- Move more functionality onto enum to make it more interoperable with
string
- CoordinateTransformer, ProjectStack use StackOrientation internally
@clbarnes
Copy link
Collaborator Author

clbarnes commented Nov 1, 2018

I think we want to not assume relation IDs are always the same and can be project-defined. Endpoint docs are legacy and should be updated. Relation IDs should be fetched and cached once per-project.

Makes sense. In that case, I guess it'd be better to define the enum using the string representations here https://github.com/catmaid/CATMAID/blob/master/django/applications/catmaid/control/connector.py#L35 , and then make a method/function which returns a list of (relation_id, relation_name) tuples, so that users can do the mapping both ways.

The enum could be scrapped entirely if we're treating the relations as dynamic, but that doesn't quite feel right either.

@clbarnes
Copy link
Collaborator Author

clbarnes commented Nov 1, 2018

Rebased on master after #28

@clbarnes
Copy link
Collaborator Author

clbarnes commented Nov 1, 2018

@aschampion done. Adds some complexity but I think it's the best way to do it while still keeping the nice bits of enums.

It'll break when different connector types are added but catpy was always going to be brittle to changes in CATMAID.

Relation ID mappings may be different between projects, and so cannot be
stored in an enum. The RelationIdentifier converts IDs to the enum form
and back.
@clbarnes clbarnes merged commit 9aa6905 into master Nov 28, 2018
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.

IntEnums
2 participants