| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
SemEHR contains four types of documents as follows.
URL Prefix http://IP_ADDR:PORT/INDEX/patient/
Query patients (/_search/)
RESTful Examples:
Python examples:
query patients by keyword hepatitis
from elasticsearch import Elasticsearch
es_host = 'http://IP_ADDR:PORT/'
index_name = 'INDEX'
doc_type = 'patient'
query = 'hepatitis'
es = Elasticsearch([es_host])
results = es.search(index=index_name, doc_type=doc_type, body={'query': {'term': {'_all': query}}, 'size': 1})
print resultsquery patients by contextualised concept - EB07A6EF908CFC11B1B003E1B1CFA6C6
from elasticsearch import Elasticsearch
es_host = 'http://IP_ADDR:PORT/'
index_name = 'INDEX'
doc_type = 'patient'
query = 'hepatitis'
es = Elasticsearch([es_host])
results = es.search(index=index_name, doc_type=doc_type, body={'query': {'term': {'anns.contexted_concept': 'EB07A6EF908CFC11B1B003E1B1CFA6C6'}}, 'size': 1})
print resultsGet patient data by id (/id)
RESTful Example:
Python Example:
from elasticsearch import Elasticsearch
es_host = 'http://IP_ADDR:PORT/'
index_name = 'INDEX'
doc_type = 'patient'
query = 'hepatitis'
patient_id = '99836'
es = Elasticsearch([es_host])
result = es.get(index_name, patient_id, doc_type=doc_type)
print resultPatient's properties including anns (annotations), articles (clinical notes of the patient) and id (patient id).
URL Prefix http://IP_ADDR:PORT/INDEX/ctx_concept/
Query contextualised concepts (/_search/)
RESTful Examples:
Python examples:
query ctx_concept by keyword hepatitis
from elasticsearch import Elasticsearch
es_host = 'http://IP_ADDR:PORT/'
index_name = 'INDEX'
doc_type = 'ctx_concept'
query = 'hepatitis'
es = Elasticsearch([es_host])
results = es.search(index=index_name, doc_type=doc_type, body={'query': {'term': {'_all': query}}, 'size': 1})
print resultsquery ctx_concept by contextualised concept - hepatitis, negation:Affirmed, temporality:Recent, experiencer:Patient
from elasticsearch import Elasticsearch
es_host = 'http://IP_ADDR:PORT/'
index_name = 'INDEX'
doc_type = 'patient'
query = 'hepatitis'
es = Elasticsearch([es_host])
results = es.search(index=index_name, doc_type=doc_type, body={'query':
{
'bool': {'must': [
{
'term': {'prefLabel': query}
},
{
'term': {'temporality': 'Recent'}
},
{
'term': {'negation': 'Affirmed'}
},
{
'term': {'experiencer': 'Patient'}
}
]
}
},
'size': 1})
print resultsGet contextualised concept by id (/id)
RESTful Example:
ctx_concept has properties as follows.
| Back | FazBrowse Home | New Git URL |