{ "info": { "author": "Rick Copeland", "author_email": "rick@arborian.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3.6" ], "description": "# FHIRstorm\n\n## SMART on FHIR for Python\n\nYou know, because SMART on FHIR is the name of the protocol\n\n... and Firestorm is a DC hero who's basically a really smart guy\n\n... who is on fire.\n\nAlso, I couldn't easily find any puns having to do with intelligent snakes\non fire.\n\n## Getting started\n\n### Obtain FHIRstorm:\n\n```\npip install fhirstorm\n```\n\n### Obtain app credentials from a SMART on FHIR installation:\n\nYou can get free sandbox credentials from one of the following:\n\n- [SMART on FHIR SmartHealthIT Sandbox][smarthealthit]\n- [Healthcare Services Platform Consortium Sandbox][hspc]\n- [Open Epic][epic]\n- [Cerner Millenium][cerner]\n- [Allscripts][allscripts]\n\n[smarthealthit]: http://docs.smarthealthit.org/\n[hspc]: https://sandbox.hspconsortium.org/\n[epic]: https://open.epic.com/\n[cerner]: http://fhir.cerner.com/millennium/dstu2/\n[allscripts]: https://developer.allscripts.com/\n\nYou'll need to be ready with a `redirect_url` when you sign up (this\nis where you'll receive the OAuth2 callback that gives you a code that\nyou'll exchange for an authorization token.)\n\n### Obtain an authorization code\n\n```python\nimport os\nfrom fhirstorm import Connection, auth\n\n# Replace with the service root of your SMART on FHIR endpoint\nSERVICE_ROOT = 'https://sb-fhir-stu3.smarthealthit.org/smartstu3/data'\nCLIENT_ID = ''\nREDIRECT_URI = ''\nCLIENT_SECRET = ''\nINTERNAL_SECRET = 'itsaseekrit' # please do better than this\n\n# You need this if you used a `http://localhost...` redirect url\nos.environ['OAUTHLIB_INSECURE_TRANSPORT'] = 'true'\n\nconn = Connection(SERVICE_ROOT)\n\n# Get the particular REST endpoint (there's usually just the one)\nservice = conn.metadata.rest[0]\n\n# Get your authorization url\nauthorization_url, state = auth.authorization_url(\n service,\n client_id=CLIENT_ID,\n client_secret=CLIENT_SECRET,\n redirect_uri=REDIRECT_URI,\n scope='profile openid offline_access launch/patient patient/*.*',\n state=auth.jwt_state(INTERNAL_SECRET),\n aud=SERVICE_ROOT)\n```\n\nNow, send the user to the URL you just got.\nBest practice is for you to also save the `state` variable somewhere safe, and\nverify that the identical state is passed back to you.\nIn this example, however, I'll do the less-safe \"verify that some valid signed\nJWT was passed back to you.\"\n\nThe user will be redirected back to you redirect_uri after they log in (sandbox\ncredentials are different for each of the sandboxes; consult their documentation\nfor the correct credentials to use when logging in)\n\n### Obtain an authorization token\n\nOnce you have received the callback, use the *whole URL* you received (it should include\na state and code parameter, at a minimum):\n\n```python\n# Assuming you've stored the actual redirect URL received into authorization response...\n\ntok = auth.fetch_token(\n service, CLIENT_ID, REDIRECT_URI,\n authorization_response,\n client_secret=CLIENT_SECRET, # if you have one, otherwise leave it off\n state_validator=auth.jwt_state_validator(INTERNAL_SECRET))\n\n# Or if you saved the state:\ntok = auth.fetch_token(\n service, CLIENT_ID, REDIRECT_URI,\n authorization_response,\n client_secret=CLIENT_SECRET, # if you have one, otherwise leave it off\n state=STATE_VALUE_YOU_SAVED)\n\n```\n\nNow you can use this token to access the various FHIR resources. Save it somewhere safe.\n\n```python\nconn = Connection(\n SERVICE_ROOT,\n session=OAuth2Session(\n client_id=CLIENT_ID, token=token))\n\nservice = connection.metadata.rest[0]\n```\n\nIn many of the implementations, you'll get the patient ID right in the token. Sometimes, it\ncomes (in JWT form!) inside the encoded access token:\n\n```python\nimport jwt\n\npatient_id = token.get('patient')\nif patient_id is None:\n decoded = jwt.decode(token['access_token'], verify=False)\n patient_id = decoderd.get('local_patient_id')\n```\n\nOnce you've been authorized, though, you can get resources off the `service.r` object:\n\n```python\n# Fetch the patient\np = service.r.Patient.fetch(patient_id)\n\n# Get all medication orders for the patient\nres = service.r.MedicationOrder.search(dict(patient=p.id))\n\n```\n\n### What next?\n\nNow that you've gotten started, you can check out the Jupyter Notebook [tutorials][tutorials] for more detail.\n\nGet FHIRing!\n\n[tutorials]: ./notebooks\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Arborian/fhirstorm", "keywords": "", "license": "Apache License Version 2.0", "maintainer": "", "maintainer_email": "", "name": "FHIRstorm", "package_url": "https://pypi.org/project/FHIRstorm/", "platform": "", "project_url": "https://pypi.org/project/FHIRstorm/", "project_urls": { "Homepage": "https://github.com/Arborian/fhirstorm" }, "release_url": "https://pypi.org/project/FHIRstorm/0.0.1.dev6/", "requires_dist": null, "requires_python": "", "summary": "SMART on FHIR client for Python", "version": "0.0.1.dev6" }, "last_serial": 3439193, "releases": { "0.0.1.dev1": [ { "comment_text": "", "digests": { "md5": "a6484f37912c6a85864b19e58b4b0fe5", "sha256": "4aeb32d7dafaec94680049a3e9ed493035beed749bc1ffae365b094870dfaf0b" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev1.tar.gz", "has_sig": false, "md5_digest": "a6484f37912c6a85864b19e58b4b0fe5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5859, "upload_time": "2017-12-09T22:44:16", "url": "https://files.pythonhosted.org/packages/3f/9a/04b1abd795528dc4128c3359a81fba10b59611b8d7525b0688ee486aa2b3/FHIRstorm-0.0.1.dev1.tar.gz" } ], "0.0.1.dev2": [ { "comment_text": "", "digests": { "md5": "898bb3f8a8b88e7fc040a57e5a7fb7a2", "sha256": "dba61eabad6df0779a4030645ae47c9d4cb17464b879916278ca0dd96b24d185" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev2.tar.gz", "has_sig": false, "md5_digest": "898bb3f8a8b88e7fc040a57e5a7fb7a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5560, "upload_time": "2017-12-09T22:51:41", "url": "https://files.pythonhosted.org/packages/ec/d3/b43bb204ad64189f231592ccffd9a29b8a32eb3655992d2775c08b1a2036/FHIRstorm-0.0.1.dev2.tar.gz" } ], "0.0.1.dev3": [ { "comment_text": "", "digests": { "md5": "339cacad98f3f5e741cb6fa07a00c57d", "sha256": "21b01f310f7da705fe9d28cca6101da06b109f351d0f8dc12f0ef87f6d51735e" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev3.tar.gz", "has_sig": false, "md5_digest": "339cacad98f3f5e741cb6fa07a00c57d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5642, "upload_time": "2017-12-09T22:55:44", "url": "https://files.pythonhosted.org/packages/c1/d4/3cfe16131dd68564ad943180a1ae6888754f2c2b13ba422d24766798aeb9/FHIRstorm-0.0.1.dev3.tar.gz" } ], "0.0.1.dev4": [ { "comment_text": "", "digests": { "md5": "767c19abc0deac88e7a078a96524a4dd", "sha256": "6fbcbc3a082749740b3b6a0b84e7cfbf779553b1d78646f0484df751f5ab1d11" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev4.tar.gz", "has_sig": false, "md5_digest": "767c19abc0deac88e7a078a96524a4dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6224, "upload_time": "2017-12-09T23:25:53", "url": "https://files.pythonhosted.org/packages/99/01/3dcd9da20f8dbca6ee118bf7216b22966d0d44209f2966b182de3ea6ef22/FHIRstorm-0.0.1.dev4.tar.gz" } ], "0.0.1.dev5": [ { "comment_text": "", "digests": { "md5": "7c6b35c094fe1a1b3a7b90c7469a6c1e", "sha256": "d40c8bab5d2dd7bab783e1dc569636e4528d75099d47575c496fb080d0d761d6" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev5.tar.gz", "has_sig": false, "md5_digest": "7c6b35c094fe1a1b3a7b90c7469a6c1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6242, "upload_time": "2017-12-09T23:28:39", "url": "https://files.pythonhosted.org/packages/f3/1c/e3373df918be6ddb598833ff8aa08e9697c4392d73775cc257403115fcd0/FHIRstorm-0.0.1.dev5.tar.gz" } ], "0.0.1.dev6": [ { "comment_text": "", "digests": { "md5": "014bacf6f6a105c2f3443b2b17bbfdc8", "sha256": "766dbdc1088d8183aa4b05e0f45e7b157bd6791c335760f2ee20c06e4ddab5ce" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev6.tar.gz", "has_sig": false, "md5_digest": "014bacf6f6a105c2f3443b2b17bbfdc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6206, "upload_time": "2017-12-23T14:10:35", "url": "https://files.pythonhosted.org/packages/89/e7/b4d27fc58deeb7960794c46056f0b5a06c82fddaf733ad16fe19c46bd4b2/FHIRstorm-0.0.1.dev6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "014bacf6f6a105c2f3443b2b17bbfdc8", "sha256": "766dbdc1088d8183aa4b05e0f45e7b157bd6791c335760f2ee20c06e4ddab5ce" }, "downloads": -1, "filename": "FHIRstorm-0.0.1.dev6.tar.gz", "has_sig": false, "md5_digest": "014bacf6f6a105c2f3443b2b17bbfdc8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6206, "upload_time": "2017-12-23T14:10:35", "url": "https://files.pythonhosted.org/packages/89/e7/b4d27fc58deeb7960794c46056f0b5a06c82fddaf733ad16fe19c46bd4b2/FHIRstorm-0.0.1.dev6.tar.gz" } ] }