Skip to content

Instantly share code, notes, and snippets.

@johngrimes
Last active July 25, 2022 06:32
Show Gist options
  • Save johngrimes/0cee4686197e56e674b9219ad73947ba to your computer and use it in GitHub Desktop.
Save johngrimes/0cee4686197e56e674b9219ad73947ba to your computer and use it in GitHub Desktop.
Pathling Python API - Terminology Functions
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"source": [
"## Pathling Python API - Terminology functions\n",
"\n",
"The Pathling Python library provides the ability to use a FHIR terminology server to resolve terminology queries from within Spark. This capability can be used with any Spark dataframe, not just those that have been created from FHIR data."
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "1ac63a43-2e9b-4e57-be5a-8b19f164cf1e"
},
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "code",
"source": [
"from pathling import PathlingContext\n",
"\n",
"pc = PathlingContext.create()"
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "0c128329-369f-4ea3-ba59-717460fcc235"
},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div class=\"ansiout\"></div>",
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "html",
"arguments": {}
}
},
"data": {
"text/html": [
"<style scoped>\n .ansiout {\n display: block;\n unicode-bidi: embed;\n white-space: pre-wrap;\n word-wrap: break-word;\n word-break: break-all;\n font-family: \"Source Code Pro\", \"Menlo\", monospace;;\n font-size: 13px;\n color: #555;\n margin-left: 4px;\n line-height: 19px;\n }\n</style>\n<div class=\"ansiout\"></div>"
]
}
}
],
"execution_count": 0
},
{
"cell_type": "code",
"source": [
"csv = pc.spark.read.options(header=True).csv(\n",
" 's3://pathling-demo/staging/synthea/10k_csv_20210818/csv/conditions.csv')"
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "627ad3b7-f3e2-4dbc-bcd7-3cba6c614d31"
},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div class=\"ansiout\"></div>",
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "html",
"arguments": {}
}
},
"data": {
"text/html": [
"<style scoped>\n .ansiout {\n display: block;\n unicode-bidi: embed;\n white-space: pre-wrap;\n word-wrap: break-word;\n word-break: break-all;\n font-family: \"Source Code Pro\", \"Menlo\", monospace;;\n font-size: 13px;\n color: #555;\n margin-left: 4px;\n line-height: 19px;\n }\n</style>\n<div class=\"ansiout\"></div>"
]
}
}
],
"execution_count": 0
},
{
"cell_type": "markdown",
"source": [
"### Value set membership\n",
"\n",
"The `member_of` function can be used to test the membership of a code within a FHIR value set. In this example, we take a list of SNOMED CT diagnosis codes and create a new column which shows which are nasal sinus infections."
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "415f69ac-6167-47bb-bc74-a24c41d19618"
},
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "code",
"source": [
"from pathling.functions import to_coding\n",
"\n",
"# << 64572001|Disease| : (\n",
"# << 370135005|Pathological process| = << 441862004|Infectious process|,\n",
"# << 246075003|Causative agent| = << 49872002|Virus|\n",
"# )\n",
"member_of_result = pc.member_of(csv, to_coding(csv.CODE, 'http://snomed.info/sct'),\n",
" 'http://snomed.info/sct?fhir_vs=ecl/%3C%3C%2064572001%20%3A%20('\n",
" '%3C%3C%20370135005%20%3D%20%3C%3C%20441862004%20%2C%20%3C%3C'\n",
" '%20246075003%20%3D%20%3C%3C%2049872002%20)',\n",
" 'VIRAL_INFECTION')\n",
"member_of_result.select('CODE', 'DESCRIPTION', 'VIRAL_INFECTION').toPandas()"
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "89b7a70c-bb68-485c-b344-32b688e0d332"
},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div class=\"ansiout\">Out[8]: </div>",
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "html",
"arguments": {}
}
},
"data": {
"text/html": [
"<style scoped>\n .ansiout {\n display: block;\n unicode-bidi: embed;\n white-space: pre-wrap;\n word-wrap: break-word;\n word-break: break-all;\n font-family: \"Source Code Pro\", \"Menlo\", monospace;;\n font-size: 13px;\n color: #555;\n margin-left: 4px;\n line-height: 19px;\n }\n</style>\n<div class=\"ansiout\">Out[8]: </div>"
]
}
},
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>CODE</th>\n <th>DESCRIPTION</th>\n <th>VIRAL_INFECTION</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65363002</td>\n <td>Otitis media</td>\n <td>False</td>\n </tr>\n <tr>\n <th>1</th>\n <td>16114001</td>\n <td>Fracture of ankle</td>\n <td>False</td>\n </tr>\n <tr>\n <th>2</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>3</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>4</th>\n <td>43878008</td>\n <td>Streptococcal sore throat (disorder)</td>\n <td>False</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>42690</th>\n <td>195662009</td>\n <td>Acute viral pharyngitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>42691</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>42692</th>\n <td>44465007</td>\n <td>Sprain of ankle</td>\n <td>False</td>\n </tr>\n <tr>\n <th>42693</th>\n <td>62564004</td>\n <td>Concussion with loss of consciousness</td>\n <td>False</td>\n </tr>\n <tr>\n <th>42694</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n </tbody>\n</table>\n<p>42695 rows × 3 columns</p>\n</div>",
"textData": null,
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "htmlSandbox",
"arguments": {}
}
},
"data": {
"text/html": [
"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>CODE</th>\n <th>DESCRIPTION</th>\n <th>VIRAL_INFECTION</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65363002</td>\n <td>Otitis media</td>\n <td>False</td>\n </tr>\n <tr>\n <th>1</th>\n <td>16114001</td>\n <td>Fracture of ankle</td>\n <td>False</td>\n </tr>\n <tr>\n <th>2</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>3</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>4</th>\n <td>43878008</td>\n <td>Streptococcal sore throat (disorder)</td>\n <td>False</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>42690</th>\n <td>195662009</td>\n <td>Acute viral pharyngitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>42691</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n <tr>\n <th>42692</th>\n <td>44465007</td>\n <td>Sprain of ankle</td>\n <td>False</td>\n </tr>\n <tr>\n <th>42693</th>\n <td>62564004</td>\n <td>Concussion with loss of consciousness</td>\n <td>False</td>\n </tr>\n <tr>\n <th>42694</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n </tr>\n </tbody>\n</table>\n<p>42695 rows × 3 columns</p>\n</div>"
]
}
}
],
"execution_count": 0
},
{
"cell_type": "markdown",
"source": [
"### Concept translation\n",
"\n",
"The `translate` function can be used to translate codes from one code system to another using maps that are known to the terminology server. In this example, we translate our SNOMED CT diagnosis codes into Read CTV3."
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "db7c96ff-3251-4e63-8973-3342c4e5d2df"
},
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "code",
"source": [
"translate_result = pc.translate(csv, to_coding(csv.CODE, 'http://snomed.info/sct'),\n",
" 'http://snomed.info/sct?fhir_cm=900000000000497000',\n",
" output_column_name='READ_CODE')\n",
"translate_result = translate_result.withColumn('READ_CODE', translate_result.READ_CODE.code)\n",
"translate_result.select('CODE', 'DESCRIPTION', 'READ_CODE').toPandas()"
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "61c9cbc4-10b0-400f-b96a-e739c3e2a666"
},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div class=\"ansiout\">Out[9]: </div>",
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "html",
"arguments": {}
}
},
"data": {
"text/html": [
"<style scoped>\n .ansiout {\n display: block;\n unicode-bidi: embed;\n white-space: pre-wrap;\n word-wrap: break-word;\n word-break: break-all;\n font-family: \"Source Code Pro\", \"Menlo\", monospace;;\n font-size: 13px;\n color: #555;\n margin-left: 4px;\n line-height: 19px;\n }\n</style>\n<div class=\"ansiout\">Out[9]: </div>"
]
}
},
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>CODE</th>\n <th>DESCRIPTION</th>\n <th>READ_CODE</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65363002</td>\n <td>Otitis media</td>\n <td>None</td>\n </tr>\n <tr>\n <th>1</th>\n <td>16114001</td>\n <td>Fracture of ankle</td>\n <td>None</td>\n </tr>\n <tr>\n <th>2</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>3</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>4</th>\n <td>43878008</td>\n <td>Streptococcal sore throat (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>42690</th>\n <td>195662009</td>\n <td>Acute viral pharyngitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42691</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42692</th>\n <td>44465007</td>\n <td>Sprain of ankle</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42693</th>\n <td>62564004</td>\n <td>Concussion with loss of consciousness</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42694</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n </tbody>\n</table>\n<p>42695 rows × 3 columns</p>\n</div>",
"textData": null,
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "htmlSandbox",
"arguments": {}
}
},
"data": {
"text/html": [
"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>CODE</th>\n <th>DESCRIPTION</th>\n <th>READ_CODE</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65363002</td>\n <td>Otitis media</td>\n <td>None</td>\n </tr>\n <tr>\n <th>1</th>\n <td>16114001</td>\n <td>Fracture of ankle</td>\n <td>None</td>\n </tr>\n <tr>\n <th>2</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>3</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>4</th>\n <td>43878008</td>\n <td>Streptococcal sore throat (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>42690</th>\n <td>195662009</td>\n <td>Acute viral pharyngitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42691</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42692</th>\n <td>44465007</td>\n <td>Sprain of ankle</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42693</th>\n <td>62564004</td>\n <td>Concussion with loss of consciousness</td>\n <td>None</td>\n </tr>\n <tr>\n <th>42694</th>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>None</td>\n </tr>\n </tbody>\n</table>\n<p>42695 rows × 3 columns</p>\n</div>"
]
}
}
],
"execution_count": 0
},
{
"cell_type": "markdown",
"source": [
"### Subsumption testing\n",
"\n",
"The `subsumes` function allows us to perform subsumption testing on codes within our data. In hierarchical code systems, a subsumption test determines whether a code is a subtype of another code, e.g. an \"ankle fracture\" is subsumed by \"fracture\".\n",
"\n",
"In this example, we first take our codes, cross-join them and then test whether they subsume each other. Then we do another subsumption test against the \"fracture\" concept."
],
"metadata": {
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "31a02234-e166-4fe1-be19-114b9ba7af0e"
},
"pycharm": {
"name": "#%% md\n"
}
}
},
{
"cell_type": "code",
"source": [
"from pathling.coding import Coding\n",
"\n",
"first_3 = csv.limit(3)\n",
"cross_join = first_3.selectExpr('CODE as LEFT', 'DESCRIPTION as LEFT_DESCRIPTION') \\\n",
" .crossJoin(first_3.selectExpr('CODE as RIGHT', 'DESCRIPTION as RIGHT_DESCRIPTION'))\n",
"\n",
"subsumes_result_1 = pc.subsumes(cross_join, 'SUBSUMES',\n",
" left_coding_column=to_coding(cross_join.LEFT, 'http://snomed.info/sct'),\n",
" right_coding_column=to_coding(cross_join.RIGHT, 'http://snomed.info/sct'))\n",
"subsumes_result_2 = pc.subsumes(subsumes_result_1, 'LEFT_IS_ENT',\n",
" # 232208008 |Ear, nose and throat disorder|\n",
" left_coding=Coding('http://snomed.info/sct', '232208008'),\n",
" right_coding_column=to_coding(cross_join.LEFT, 'http://snomed.info/sct'))\n",
"subsumes_result_2.select('LEFT', 'RIGHT', 'LEFT_DESCRIPTION', 'RIGHT_DESCRIPTION', 'SUBSUMES', \n",
" 'LEFT_IS_ENT').toPandas()\n"
],
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"application/vnd.databricks.v1+cell": {
"title": "",
"showTitle": false,
"inputWidgets": {},
"nuid": "69abf69a-dfa9-44ce-b952-10f8d5c0817e"
}
},
"outputs": [
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div class=\"ansiout\">Out[10]: </div>",
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "html",
"arguments": {}
}
},
"data": {
"text/html": [
"<style scoped>\n .ansiout {\n display: block;\n unicode-bidi: embed;\n white-space: pre-wrap;\n word-wrap: break-word;\n word-break: break-all;\n font-family: \"Source Code Pro\", \"Menlo\", monospace;;\n font-size: 13px;\n color: #555;\n margin-left: 4px;\n line-height: 19px;\n }\n</style>\n<div class=\"ansiout\">Out[10]: </div>"
]
}
},
{
"output_type": "display_data",
"metadata": {
"application/vnd.databricks.v1+output": {
"datasetInfos": [],
"data": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>LEFT</th>\n <th>RIGHT</th>\n <th>LEFT_DESCRIPTION</th>\n <th>RIGHT_DESCRIPTION</th>\n <th>SUBSUMES</th>\n <th>LEFT_IS_ENT</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65363002</td>\n <td>65363002</td>\n <td>Otitis media</td>\n <td>Otitis media</td>\n <td>True</td>\n <td>True</td>\n </tr>\n <tr>\n <th>1</th>\n <td>65363002</td>\n <td>16114001</td>\n <td>Otitis media</td>\n <td>Fracture of ankle</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>2</th>\n <td>65363002</td>\n <td>444814009</td>\n <td>Otitis media</td>\n <td>Viral sinusitis (disorder)</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>3</th>\n <td>16114001</td>\n <td>65363002</td>\n <td>Fracture of ankle</td>\n <td>Otitis media</td>\n <td>False</td>\n <td>False</td>\n </tr>\n <tr>\n <th>4</th>\n <td>16114001</td>\n <td>16114001</td>\n <td>Fracture of ankle</td>\n <td>Fracture of ankle</td>\n <td>True</td>\n <td>False</td>\n </tr>\n <tr>\n <th>5</th>\n <td>16114001</td>\n <td>444814009</td>\n <td>Fracture of ankle</td>\n <td>Viral sinusitis (disorder)</td>\n <td>False</td>\n <td>False</td>\n </tr>\n <tr>\n <th>6</th>\n <td>444814009</td>\n <td>65363002</td>\n <td>Viral sinusitis (disorder)</td>\n <td>Otitis media</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>7</th>\n <td>444814009</td>\n <td>16114001</td>\n <td>Viral sinusitis (disorder)</td>\n <td>Fracture of ankle</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>8</th>\n <td>444814009</td>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n <td>True</td>\n </tr>\n </tbody>\n</table>\n</div>",
"textData": null,
"removedWidgets": [],
"addedWidgets": {},
"metadata": {},
"type": "htmlSandbox",
"arguments": {}
}
},
"data": {
"text/html": [
"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>LEFT</th>\n <th>RIGHT</th>\n <th>LEFT_DESCRIPTION</th>\n <th>RIGHT_DESCRIPTION</th>\n <th>SUBSUMES</th>\n <th>LEFT_IS_ENT</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65363002</td>\n <td>65363002</td>\n <td>Otitis media</td>\n <td>Otitis media</td>\n <td>True</td>\n <td>True</td>\n </tr>\n <tr>\n <th>1</th>\n <td>65363002</td>\n <td>16114001</td>\n <td>Otitis media</td>\n <td>Fracture of ankle</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>2</th>\n <td>65363002</td>\n <td>444814009</td>\n <td>Otitis media</td>\n <td>Viral sinusitis (disorder)</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>3</th>\n <td>16114001</td>\n <td>65363002</td>\n <td>Fracture of ankle</td>\n <td>Otitis media</td>\n <td>False</td>\n <td>False</td>\n </tr>\n <tr>\n <th>4</th>\n <td>16114001</td>\n <td>16114001</td>\n <td>Fracture of ankle</td>\n <td>Fracture of ankle</td>\n <td>True</td>\n <td>False</td>\n </tr>\n <tr>\n <th>5</th>\n <td>16114001</td>\n <td>444814009</td>\n <td>Fracture of ankle</td>\n <td>Viral sinusitis (disorder)</td>\n <td>False</td>\n <td>False</td>\n </tr>\n <tr>\n <th>6</th>\n <td>444814009</td>\n <td>65363002</td>\n <td>Viral sinusitis (disorder)</td>\n <td>Otitis media</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>7</th>\n <td>444814009</td>\n <td>16114001</td>\n <td>Viral sinusitis (disorder)</td>\n <td>Fracture of ankle</td>\n <td>False</td>\n <td>True</td>\n </tr>\n <tr>\n <th>8</th>\n <td>444814009</td>\n <td>444814009</td>\n <td>Viral sinusitis (disorder)</td>\n <td>Viral sinusitis (disorder)</td>\n <td>True</td>\n <td>True</td>\n </tr>\n </tbody>\n</table>\n</div>"
]
}
}
],
"execution_count": 0
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"mimetype": "text/x-python",
"name": "python",
"pygments_lexer": "ipython3",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"version": "3.10.5",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"application/vnd.databricks.v1+notebook": {
"notebookName": "Terminology functions",
"dashboards": [],
"notebookMetadata": {
"pythonIndentUnit": 4
},
"language": "python",
"widgets": {},
"notebookOrigID": 680698797981653
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment