{ "info": { "author": "Arizona Geological Survey", "author_email": "developer@azgs.az.gov", "bugtrack_url": null, "classifiers": [], "description": "# contentmodels\r\n\r\nA library defining an API for working with [USGIN Content Models](http://schemas.usgin.org/models) in Python.\r\n\r\n## Usage\r\n\r\nStart by importing the module\r\n\r\n```python\r\nimport usginmodels\r\n```\r\n\r\nThis exposes several important functions:\r\n\r\n### usginmodels.refresh\r\n\r\nChecks http://schemas.usgin.org/contentmodels.json for the most up-to-date description of available content models\r\n\r\nExample Usage:\r\n\r\n```python\r\nusginmodels.refresh()\r\n```\r\n\r\n### usginmodels.get_models\r\n\r\nReturns a list of [ContentModel](#contentmodels) objects that represent the models available from USGIN. See below\r\nfor a description of the capabilities of [ContentModel](#contentmodels) objects.\r\n\r\nExample Usage:\r\n\r\n```python\r\nmodels = usginmodels.get_models\r\n```\r\n\r\n### usginmodels.get_uris(uri)\r\n\r\nPass in a URI as a string and a model URI and a version URI are returned. If a version URI can't be determined an empty string will be returned.\r\n\r\nExample Usage:\r\n\r\n```python\r\nmodel_uri, version_uri = usginmodels.get_uris(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault\")\r\nmodel_uri, version_uri = usginmodels.get_uris(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault/1.2\")\r\n```\r\n\r\n### usginmodels.get_model(uri)\r\n\r\nPass in a URI as a string and a model object will be returned. If the URI is invalid, an InvalidUri exception will be thrown.\r\n\r\n```python\r\nmodel = usginmodels.get_model(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault/1.1\")\r\nmodel = usginmodels.get_model(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault\")\r\n```\r\n\r\n### usginmodels.get_version(uri)\r\n\r\nPass in a URI as a string and a version object will be returned. If the version is not specified in the URI the latest version will be returned. If the URI is invalid, an InvalidUri exception will be thrown.\r\n\r\n```python\r\nversion = usginmodels.get_version(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault/1.1\")\r\nversion = usginmodels.get_version(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault\")\r\n```\r\n\r\n### usginmodels.get_layer(uri, layer_name = \"\")\r\n\r\nPass in a URI as a string and optionally, a layer name, and a layer object will be returned. If the version is not specified in the URI the latest version will be used. If the layer is not specified and a multilayer model is being requested, an exception will be thrown.\r\n\r\n```python\r\nlayer = usginmodels.get_layer(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault/1.1\")\r\nlayer = usginmodels.get_layer(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/activefault\")\r\nlayer = usginmodels.get_layer(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/rockchemistry/0.4\", 'USeries')\r\nlayer = usginmodels.get_layer(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/rockchemistry\", 'USeries')\r\n```\r\n\r\n### usginmodels.get_service_name(version_uri)\r\n\r\nPass in a URI with version information as a string and a service name will be returned. If no service name\r\nis found, `\"Invalid\"` will be returned.\r\n\r\n```Python\r\nservice_name = usginmodels.get_service_name(\"http://schemas.usgin.org/uri-gin/ngds/dataschema/boreholetemperature/1.5\")\r\n```\r\n\r\n### usginmodels.validate_file(csv_file, uri, layer_name = \"\")\r\n\r\nPass in a URI as a string, and a **file-like object** that represents a CSV file. The layer name is **optional** but will error if the model is multi-layered.\r\n\r\nReturned:\r\n 1. a boolean specifying if the data is Valid* or not\r\n 2. a list of messages**\r\n 3. a list of lists with the data corrected to conform to NGDS parameters\r\n 4. a dictionary with field names as the key and True or False as the value representing whether or not any data in that field is over 255 characters in length\r\n 5. a string indicating the spatial reference system of the dataset\r\n\r\n\\* If a file is returned as Valid but the messages list is not empty, the file is valid only if the corrected data is used.\r\n\r\n\\** The messages list returns three types of messages, differentiated by the the words Notice!, Warning! and Error!.\r\n- **Notice!**: These are messages which indicate basic formatting changes made by the validation routine to the data, such as whitespace removed or the required / added to the end of a resource URI.\r\n- **Warning!**: These are messages which indicate issues that the validation routine attempts to correct programmatically. For example, if a field is supposed to be double and is a required field, but the data is blank, the placeholder -9999 will be inserted as the data. The user will need to review these message to verify that the changes made by the validation routine are acceptable. If not, manual changes will need to be made and the validation routine run again.\r\n- **Error!**: These are messages which indicate issues which will cause the file to be invalid and which need manual correction by the user before running the validation routine again.\r\n\r\nExample Usage:\r\n\r\n```python\r\nimport csv\r\n\r\ncsv_file = open(\"AZRockChemistryUSeries.csv\", \"r\")\r\nvalid, messages, dataCorrected, long_fields, srs = usginmodels.validate_file(\r\n csv_file,\r\n \"http://schemas.usgin.org/uri-gin/ngds/dataschema/rockchemistry\",\r\n \"USeries\"\r\n)\r\n\r\nif valid and messages:\r\n print \"The document is valid if the changes below are acceptable.\"\r\nelif valid and not messages:\r\n print \"The document is valid.\"\r\nelse:\r\n print \"Not Valid! Error messages:\"\r\n \r\nfor m in messages:\r\n if \"Warning!\" in m:\r\n print \"* \" + m\r\n elif \"Error!\" in m:\r\n print m\r\n elif \"Notice!\" in m:\r\n print m\r\n else:\r\n print m\r\n```", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/usgin/usginmodels/tarball/1.1.6", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/usgin/usginmodels", "keywords": "usgin,ngds,azgs", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "", "name": "usginmodels", "package_url": "https://pypi.org/project/usginmodels/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/usginmodels/", "project_urls": { "Download": "https://github.com/usgin/usginmodels/tarball/1.1.6", "Homepage": "https://github.com/usgin/usginmodels" }, "release_url": "https://pypi.org/project/usginmodels/1.1.6/", "requires_dist": null, "requires_python": null, "summary": "Interface for interacting with USGIN content models", "version": "1.1.6" }, "last_serial": 1371950, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "c3cc35929a454086531b6a5a6de7b609", "sha256": "340c3d4a8a0eade86440edb8a659c8b263dc9c22abfec7c1f04f3330753d776d" }, "downloads": -1, "filename": "usginmodels-1.0.0.tar.gz", "has_sig": false, "md5_digest": "c3cc35929a454086531b6a5a6de7b609", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6029, "upload_time": "2014-02-13T05:44:28", "url": "https://files.pythonhosted.org/packages/b5/9c/cfbb31a4bc3e60f1a7acd378c5014189fdce6a2cbf43c6a249aa883674bd/usginmodels-1.0.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "0111f2128f19c592b2d87d21345f9c65", "sha256": "327d37170cf2348bbe72ea2a5afdf9ea20fe70c5dc71fa8cb18e12317af5de44" }, "downloads": -1, "filename": "usginmodels-1.1.1.tar.gz", "has_sig": false, "md5_digest": "0111f2128f19c592b2d87d21345f9c65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6871, "upload_time": "2014-02-28T17:49:38", "url": "https://files.pythonhosted.org/packages/42/7e/f2172c784ce496058692ae065d9316a3f81d8bf5b67609b0545decbb3f8a/usginmodels-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "4b3d00aec0ccac51f7ce4b10151a659b", "sha256": "1fdf144ea6c6378e1bcfa7d097451d846bbdcf5485e8ceb08abbe989eec2ad87" }, "downloads": -1, "filename": "usginmodels-1.1.2.tar.gz", "has_sig": false, "md5_digest": "4b3d00aec0ccac51f7ce4b10151a659b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6897, "upload_time": "2014-03-17T00:03:50", "url": "https://files.pythonhosted.org/packages/3b/8d/e1add555502c3c1d00be2af0652146042510ac87855d6ad6144b237e44bf/usginmodels-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "c880e3d51673c6689797709cc5790f4d", "sha256": "50cbd640b00bcb4f1922208bc2578f1b8d031e0d90ff8dfa261a9db1a63824a1" }, "downloads": -1, "filename": "usginmodels-1.1.3.tar.gz", "has_sig": false, "md5_digest": "c880e3d51673c6689797709cc5790f4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6908, "upload_time": "2014-03-17T16:10:33", "url": "https://files.pythonhosted.org/packages/90/0b/e74a7013d7b41e0b305336c55f5ef0c1b4c0230e216f7c5b88ab2a0f7ae3/usginmodels-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "361b2710c8b51e3a9f131754e3f68fe4", "sha256": "83df5f3b5d57ea80b084978f5fb441bdddbd686b3d2271c36519c5279867485f" }, "downloads": -1, "filename": "usginmodels-1.1.4.tar.gz", "has_sig": false, "md5_digest": "361b2710c8b51e3a9f131754e3f68fe4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8308, "upload_time": "2014-04-09T22:40:21", "url": "https://files.pythonhosted.org/packages/1b/42/4f4c7805cbc1f60261604466328e9c870cb7793a19da8623ba68e4c3b1f5/usginmodels-1.1.4.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "811e595354327a46c5af446bd32db0f7", "sha256": "09f0addf4d3b0c12d5f1f0e7321b185e8b9cfd49308436725716c867b5b4a683" }, "downloads": -1, "filename": "usginmodels-1.1.5.tar.gz", "has_sig": false, "md5_digest": "811e595354327a46c5af446bd32db0f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8324, "upload_time": "2015-01-05T23:13:54", "url": "https://files.pythonhosted.org/packages/da/4a/f9efbd93e7fa4f5ecd201f13601c0a111a3325fa36c3aa4c5da7400bef51/usginmodels-1.1.5.tar.gz" } ], "1.1.6": [ { "comment_text": "", "digests": { "md5": "3facdc5a853a62aa28952f559822cdad", "sha256": "fc33e65e0a0ce460a2c4146f97ec438570de29d91f54f13f34d13e1f0b3f5713" }, "downloads": -1, "filename": "usginmodels-1.1.6.tar.gz", "has_sig": false, "md5_digest": "3facdc5a853a62aa28952f559822cdad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8303, "upload_time": "2015-01-05T23:15:30", "url": "https://files.pythonhosted.org/packages/ee/1e/c99dce106d8d18005382b1d56d545afebf769c8a15e5b0a79bc1f61df033/usginmodels-1.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3facdc5a853a62aa28952f559822cdad", "sha256": "fc33e65e0a0ce460a2c4146f97ec438570de29d91f54f13f34d13e1f0b3f5713" }, "downloads": -1, "filename": "usginmodels-1.1.6.tar.gz", "has_sig": false, "md5_digest": "3facdc5a853a62aa28952f559822cdad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8303, "upload_time": "2015-01-05T23:15:30", "url": "https://files.pythonhosted.org/packages/ee/1e/c99dce106d8d18005382b1d56d545afebf769c8a15e5b0a79bc1f61df033/usginmodels-1.1.6.tar.gz" } ] }