{ "info": { "author": "Vineet Bansal", "author_email": "vineetb@princeton.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "[![PyPI version](https://badge.fury.io/py/ffmetadata-py.svg)](https://badge.fury.io/py/ffmetadata-py)\n\n# ffmetadata-py\nPython wrapper for Fragile Families Metadata API\n\nThis Python package provides convenient wrappers to interface with the [Fragile Families Metadata API](https://github.com/fragilefamilieschallenge/metadata_app). By downloading and importing the `ff` module, users can query the metadata variables. No other software installation is necessary.\n\nRequirements\n------------\n\nThe `ff` module has been tested on Python 3.6, and should work on most Python 3.x installations.\n\nInstallation\n------------\n\nThe easiest way to install and use the module is to do a `pip install`\n\n```\npip install ffmetadata-py\n```\n\nThis step will also install any dependencies if needed (currently, the `requests` and `simplejson` libraries).\n\nAlternatively, you can clone this Github repository and place the `ff` folder and it's contents at a location accessible by your Python 3 installation (most commonly the `site-packages` folder for your Python installation). In this scenario, make sure that you have recent versions of the `requests` and `simplejson` libraries installed.\n\nGetting Started\n---------------\n\nTo get started, import the ff module using `import ff`. Follow the examples below on how to use the library.\n\nExamples\n--------\n\n### Getting attributes of a variable\n\n#### Get *all* attributes of a variable\nGiven the variable name, this function call returns a dictionary of all attribute name/value pairs.\n```\n>>> ff.select('ce3datey')\n{'data_source': 'constructed', 'data_type': 'Continuous', ...\n```\n\n#### Get a single attribute of a variable\nTo get a single attribute value, call the `select` function with the second argument as the attribute you're interested in. Most attributes return `str` values, but a handful have `int` return values.\n```\n>>> ff.select('ce3datey', 'data_source')\n'constructed'\n```\n\n#### Get multiple attributes of a variable\nTo get multiple attribute values, call the `select` function with the second argument as a list of string attribute names. A dictionary with name/value pairs is returned.\n```\n>>> ff.select('ce3datey', ['name', 'data_source'])\n{'data_source': 'constructed', 'name': 'ce3datey'}\n```\n\n### Searching for variables\nQuerying variables is done using the `search` function. In the simplest case, this function expects a dictionary with keys *name*, *op* and *val*. In all cases, a list of variable names is returned. Some examples follow.\n\n#### Find variable(s) where name='ce3datey'\n```\n>>> ff.search({'name': 'name', 'op': 'eq', 'val': 'ce3datey'})\n['ce3datey']\n```\n\n#### Find variable(s) where data_source='constructed' AND name ends with 'e'\nMultiple search criteria can be specified by passing in a list of dictionaries. These are combined with an `AND` clause.\n```\n>>> ff.search([{'name': 'data_source', 'op': 'eq', 'val': 'constructed'}, {'name': 'name', 'op': 'like', 'val': '%e'}])\n['cf1age', 'cf1ethrace', ...\n```\n\n#### Find variable(s) where data_source='constructed' OR name starts with 'c' OR name ends with 'd'\nTo specify an `OR` clause for multiple search combination, replace the search criteria with a dictionary keyed by `OR`, with values as a list of dictionaries.\n```\n>>> ff.search({'or': [{'name': 'data_source', 'op': 'eq', 'val': 'constructed'}, {'name': 'name', 'op': 'like', 'val': 'c%'}, {'name': 'name', 'op': 'like', 'val': '%d'}]})\n['cf1intmon', 'cf1intyr', ...\n```\n\n#### Find variable(s) where data_source='constructed' OR (name ends with 'f' AND data_source='questionnaire')\nMore complicated search queries can b constructed, by combining several AND/OR clauses. In such cases, at any point where you want to specify a sub-query, pass in a dictionary keyed by either an `AND` or `OR`, with the values being valid search criteria themselves - either dictionaries of name/op/val keys, or sub-queries (defined recursively).\n```\n>>> ff.search({'or': [{'name': 'data_source', 'op': 'eq', 'val': 'constructed'}, {'and': [{'name': 'name', 'op': 'like', 'val': '%f'}, {'name': 'data_source', 'op': 'eq', 'val': 'questionnaire'}]}]})\n['cf1intmon', 'cf1intyr', ...\n```\n\nFor more complicated search queries, you may find the interactive [Advanced Search](http://metadata.fragilefamilies.princeton.edu/search) page on the project website useful.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fragilefamilieschallenge/ffmetadata-py", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ffmetadata-py", "package_url": "https://pypi.org/project/ffmetadata-py/", "platform": "", "project_url": "https://pypi.org/project/ffmetadata-py/", "project_urls": { "Homepage": "https://github.com/fragilefamilieschallenge/ffmetadata-py" }, "release_url": "https://pypi.org/project/ffmetadata-py/1.1.0/", "requires_dist": [ "simplejson", "requests" ], "requires_python": "", "summary": "Python wrapper for The Fragile Families Metadata API", "version": "1.1.0" }, "last_serial": 4522261, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "acb8592485c18c232f27f0f3fd21f28f", "sha256": "f5c2ca07fcc4f6b97297f4294f1f719b3ff9addff0e183cc0863ff13074770fa" }, "downloads": -1, "filename": "ffmetadata_py-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "acb8592485c18c232f27f0f3fd21f28f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4500, "upload_time": "2018-11-24T02:40:26", "url": "https://files.pythonhosted.org/packages/2b/e6/bf9217cfa6e7a30a1adb668e86e41843aa5c0974be1b381ebba2cd218d90/ffmetadata_py-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7dfafcaa5e5f9444e583143d4b2ff7a1", "sha256": "3adc947bc94c5ffe13ae9a93542298726b736305a860503c5d2e6a53637ba14a" }, "downloads": -1, "filename": "ffmetadata-py-1.1.0.tar.gz", "has_sig": false, "md5_digest": "7dfafcaa5e5f9444e583143d4b2ff7a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4120, "upload_time": "2018-11-24T02:40:28", "url": "https://files.pythonhosted.org/packages/eb/22/7e6b8181ca71ebf05d7bb5f917b25a4e8fe13e57b2814d8e664bb91a3445/ffmetadata-py-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "acb8592485c18c232f27f0f3fd21f28f", "sha256": "f5c2ca07fcc4f6b97297f4294f1f719b3ff9addff0e183cc0863ff13074770fa" }, "downloads": -1, "filename": "ffmetadata_py-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "acb8592485c18c232f27f0f3fd21f28f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4500, "upload_time": "2018-11-24T02:40:26", "url": "https://files.pythonhosted.org/packages/2b/e6/bf9217cfa6e7a30a1adb668e86e41843aa5c0974be1b381ebba2cd218d90/ffmetadata_py-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7dfafcaa5e5f9444e583143d4b2ff7a1", "sha256": "3adc947bc94c5ffe13ae9a93542298726b736305a860503c5d2e6a53637ba14a" }, "downloads": -1, "filename": "ffmetadata-py-1.1.0.tar.gz", "has_sig": false, "md5_digest": "7dfafcaa5e5f9444e583143d4b2ff7a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4120, "upload_time": "2018-11-24T02:40:28", "url": "https://files.pythonhosted.org/packages/eb/22/7e6b8181ca71ebf05d7bb5f917b25a4e8fe13e57b2814d8e664bb91a3445/ffmetadata-py-1.1.0.tar.gz" } ] }