{"action":"created","issue":{"url":"https://api.github.com/repos/glue-viz/glue/issues/593","labels_url":"https://api.github.com/repos/glue-viz/glue/issues/593/labels{/name}","comments_url":"https://api.github.com/repos/glue-viz/glue/issues/593/comments","events_url":"https://api.github.com/repos/glue-viz/glue/issues/593/events","html_url":"https://github.com/glue-viz/glue/pull/593","id":63085845,"number":593,"title":"Generalize data sources/importers","user":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/glue-viz/glue/labels/enhancement","name":"enhancement","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-03-19T20:33:36Z","updated_at":"2015-03-25T18:00:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/glue-viz/glue/pulls/593","html_url":"https://github.com/glue-viz/glue/pull/593","diff_url":"https://github.com/glue-viz/glue/pull/593.diff","patch_url":"https://github.com/glue-viz/glue/pull/593.patch"},"body":"In the same way that we can have plug-in exporters, it would be nice to have plug-in imports that can bring up different or additional dialogs. Examples include:\r\n\r\n* An additional dialog for e.g. FITS files which can allow one to select the HDU\r\n* A dialog instead of the 'open file' which could get data from online sources (e.g. dataverse, Vizier, etc)\r\n\r\nThis would open up all kinds of new fun ways to bring data into glue. All these could be developed as plugins of course, and wouldn't clutter up the main code base."},"comment":{"url":"https://api.github.com/repos/glue-viz/glue/issues/comments/86150087","html_url":"https://github.com/glue-viz/glue/pull/593#issuecomment-86150087","issue_url":"https://api.github.com/repos/glue-viz/glue/issues/593","id":86150087,"user":{"login":"ChrisBeaumont","id":796752,"avatar_url":"https://avatars.githubusercontent.com/u/796752?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisBeaumont","html_url":"https://github.com/ChrisBeaumont","followers_url":"https://api.github.com/users/ChrisBeaumont/followers","following_url":"https://api.github.com/users/ChrisBeaumont/following{/other_user}","gists_url":"https://api.github.com/users/ChrisBeaumont/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisBeaumont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisBeaumont/subscriptions","organizations_url":"https://api.github.com/users/ChrisBeaumont/orgs","repos_url":"https://api.github.com/users/ChrisBeaumont/repos","events_url":"https://api.github.com/users/ChrisBeaumont/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisBeaumont/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T18:00:14Z","updated_at":"2015-03-25T18:00:14Z","body":"Hmm, thinking out loud here to see if an idea emerges:\r\n\r\n``` python\r\nsource = get_source()  # step 1. The particular get_source() function probably selected via menu item\r\nstaging_structure = core.data_factories.load_data(source)  # step 2\r\n# some mechanism to choose UI on data type, type of staging structure, etc\r\nrefinement_ui = find_refinement_ui(source, staging_structure, get_source) \r\nresult = refinement_ui.refine(staging_structure) # step 3\r\nreturn qglue.parse_data(result) # step 4\r\n```\r\n\r\nThis actually is pretty similar to your second listing, the main difference being that there are two stages of dispatch (one for the data factory, one for the UI) and no looping. I wonder if the looping approach would be too ambiguous -- for example, maybe I have two alternative step 3 disamiguators/refiners that both take as input astropy tables, but provide different interfaces. How would `core.data_factories.load_data(result)` know which utility to dispatch to?"}}