Skip to content

Api filter by children#5088

Merged
jburel merged 24 commits intoome:developfrom
will-moore:api_filter_by_children
Mar 7, 2017
Merged

Api filter by children#5088
jburel merged 24 commits intoome:developfrom
will-moore:api_filter_by_children

Conversation

@will-moore
Copy link
Copy Markdown
Member

@will-moore will-moore commented Feb 7, 2017

What this PR does

Supports filtering of Projects by Datasets and filtering of Datasets by Image.
This allows users to find the parents of a given Image or Dataset and
so browse Image -> Dataset -> Project.
Also, we now add the version number in the header of every request:

X-OMERO-ApiVersion: 0.0

Also I've updated the example at examples/Training/python/Json_Api/Login.py to work with recent changes to the API.

Testing this PR

  1. Filter Projects by Dataset /projects/?dataset=:id or via /datasets/:id/projects/
  2. Filter Datasets by Image /datasets/?image=:id or via /images/:id/datasets/
  3. Datasets listed at /datasets/ or single object at /datasets/:id/ have 'url: projects to browse to parents.
  4. Images listed at /images/ or single object at /images/:id/ have 'url: datasets to browse to parents.
  5. Browse from /wells/ -> url:plates -> Plate -> url:Screens -> Screen.
  6. Check header in browser dev tools for X-OMERO-ApiVersion: 0.0
  7. I've added examples/Training/python/Json_Api/Login.py to the Training test suite, so it should be tested by ci job now.

TODO:

  • Write Tests
  • When Wells PR is merged, support /wells/:id/plates/ etc.

Related reading

@snoopycrimecop
Copy link
Copy Markdown
Member

Conflicting PR. Removed from build OMERO-DEV-merge-push#584. See the console output for more details.
Possible conflicts:

  • PR Api wells #5047 will-moore 'Api wells'
    • components/tools/OmeroWeb/omeroweb/api/views.py
    • components/tools/OmeroWeb/omeroweb/api/urls.py
  • PR Api child count #5058 will-moore 'Api child count'
    • components/tools/OmeroWeb/omeroweb/api/views.py
  • PR Api pagination #5067 will-moore 'Api pagination'
    • components/tools/OmeroWeb/omeroweb/api/views.py

@jburel jburel added the develop label Feb 8, 2017
@snoopycrimecop
Copy link
Copy Markdown
Member

Conflicting PR. Removed from build OMERO-DEV-merge-push#585. See the console output for more details.
Possible conflicts:

  • PR Api wells #5047 will-moore 'Api wells'
    • components/tools/OmeroWeb/omeroweb/api/views.py
    • components/tools/OmeroWeb/omeroweb/api/urls.py
  • PR Api child count #5058 will-moore 'Api child count'
    • components/tools/OmeroWeb/omeroweb/api/views.py
  • PR Api pagination #5067 will-moore 'Api pagination'
    • components/tools/OmeroWeb/omeroweb/api/views.py
    • components/tools/OmeroWeb/omeroweb/api/urls.py

@will-moore will-moore closed this Feb 9, 2017
@will-moore will-moore reopened this Feb 28, 2017
@will-moore will-moore force-pushed the api_filter_by_children branch from bbe983c to 9f620a5 Compare February 28, 2017 09:50
@jburel
Copy link
Copy Markdown
Member

jburel commented Feb 28, 2017

./components/tools/OmeroWeb/test/integration/test_api_containers.py:562:19: F821 undefined name 'settings'

views.ProjectsView.as_view(),
name='api_dataset_projects')
"""
GET Projects in Dataset, using omero-marshal to generate json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Projects Parents of Dataset

views.ScreensView.as_view(),
name='api_plate_screens')
"""
GET Screens for child Plate, using omero-marshal to generate json
Copy link
Copy Markdown
Member

@jburel jburel Feb 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify comment i.e. Screens that contain a Plate

@will-moore will-moore closed this Mar 1, 2017
@will-moore will-moore reopened this Mar 1, 2017
@will-moore
Copy link
Copy Markdown
Member Author

Adding the Json_Api/Login.py script to the Training test suite has broken the Training test because it requires import requests
https://ci.openmicroscopy.org/view/Failing/job/OMERO-DEV-merge-training/534/console

File "/opt/hudson/workspace/OMERO-DEV-merge-training/src/examples/Training/python/Json_Api/Login.py", line 10, in <module>
    import requests
ImportError: No module named requests

Do we want to add this to a requirements.txt somewhere, or should I remove Login.py from the Training test suite? cc @aleksandra-tarkowska @sbesson

@joshmoore
Copy link
Copy Markdown
Member

From my POV, requests is a generally useful library

if opts is None:
opts = {}
if 'project' in opts:
query += ' join obj.projectLinks plink'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: to align with the rest of the query, you could use projectlinks instead of plink

@jburel
Copy link
Copy Markdown
Member

jburel commented Mar 6, 2017

Restarted travis
minor: method comment to fix

@jburel
Copy link
Copy Markdown
Member

jburel commented Mar 7, 2017

looks good

@jburel jburel merged commit 355f565 into ome:develop Mar 7, 2017
@jburel jburel added this to the 5.3.0 milestone Mar 29, 2017
@will-moore will-moore deleted the api_filter_by_children branch February 18, 2019 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants