Page 1
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
SEARCHfor
server developersMartijn Harthoorn
FHIR Developer Days
November 24, 2014
Page 2
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Name: Martijn Harthoorn
Company: Furore
Background:
Programmer in C# (mainly)
Team leader Furore FHIR team
Programmer of
Spark Search Engine
Spark custom-profile resource validator
2
Who am I?
Page 3
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
3
Understanding what’s behind the question mark.
Let’s talk about…
Page 4
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
4
FHIR Paradigm
FHIR client should be easy.
FHIR server needs to solve the complex issues.
Search has some…
Let’s talk about…
Page 5
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
5
Overview
1. Why we need search?
2. How does FHIR solve that?
3. What does the spec say?
4. How do we implement that technically?
Page 6
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
6
Fhir without search
Page 7
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
7
Fhir without search
1. CRUD
Page 8
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
8
Fhir without search
GET [base]/Patient/[id]
Page 9
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
9
Use cases
Page 10
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
10
UC1: The registrar
"patient forgot hospital card (with id)"
Page 11
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
11
UC2: The doctor
“give me all data on patient x”
Page 12
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
12
UC3: The researcher
“give me all data on
a specific allergy
that conforms to a set of conditions”
Page 13
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
13
UC4: The manager
“how many patients did we treat last month”
Page 14
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
14
UC5: The lab
“Give me the list of tests to process”
Page 15
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
15
UC6: The nurse
“Alert me on any patient with
a measurement in the danger zone.”
Page 16
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
16
UC Summary
- the registrar
- the doctor
- the researcher
- the manager
- the lab worker
- the nurse
Page 17
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
17
Solutions in FHIR
Page 18
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
18
Search Solutions in FHIR
URL/[resource]?<parameters>
Page 19
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
19
Search solution 2 of FHIR
Query
Page 20
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
20
Parameter types
Page 21
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
21
Parameters types
number
date
string
token
reference
quantity
composite
Page 22
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
22
FHIR Data types
Primitive data types
Page 23
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
23
FHIR Data types
Complex data types
Page 24
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
24
Mapping of number
number integer
Parameter data type Content data type
~/Procedure?date=>2010-01-01&date=<2011-12-31
Page 25
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
25
Mapping of date
dateDate
Parameter data type Content data type
Period
~/Procedure?date=>2010-01-01&date=<2011-12-31
DateTime
Instant
Page 26
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
26
Mapping of string
stringString
Parameter data type Content data type
HumanName
~/Patient?name=eve
Page 27
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
27
Mapping of token
tokenCoding
Parameter data type Content data type
Codeable concept
~/Patient?name=eve
Identifier
(Code)
Page 28
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
28
Mapping of quantity
quantity Quantity
Parameter data type Content data type
~/Patient?name=eve
Page 29
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
29
Mapping of reference
reference Uri
Parameter data type Content data type
~/condition?subject:Patient=23
(Local id)
Page 30
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
30
F. Mapping of Value[x]
value-concept value[x]
Parameter data type Content data type
~/condition?subject:Patient=23
value-date
value-quantity
value-string
Page 31
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
31
Returned parameters
Page 32
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
32
History
Version 1.
Patient only
Per parameter
No meta data
No index
Limited
Page 33
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
33
History
Version 2.
All resources
Self generated meta data
Indexing in Lucene
Client side joins
Page 34
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
34
History
Version 3.
All resources
Model meta data
Indexing in MongoEven faster!
changes in the standard are now applied automatically
Page 35
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
35
Indexing
Page 36
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
36
Indexing
Page 37
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
37
Indexing
Page 38
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
38
Indexing
REST Service
Storage
Index
&
Search
DB
Page 39
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
39
How to index?
Page 40
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
40
How to index?
<family value=“Chalmers”>
chalmers
Patient?name=chal
chal*
match
Page 41
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
41
How to index?
<valueQuantity=“10g”>
0.1
value-quantity=>0.1||kg
0.05>
http://unitsofmeasure.org http://unitsofmeasure.org
kg = kg
=
Page 42
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
42
Indexing in Mongo:
Page 43
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
43
K. Debugging
To test a client – you must have a tested server
To test a server – you must have a tested client
“One fool can ask more questions than seven wise men can answer”
Page 44
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
44
Debugging
“One fool can ask more questions than seven wise men can answer”
Sprinkler
(testtool)Spark MongoDB
Visual Studio Visual Studio MongoVue
Fiddler
Page 45
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
45
Logic and filtering
Page 46
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
46
Logic and filtering
a=x & c=y & e=z
a=x & a=y
a=b,d
a-b=c$d
Page 47
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
47
Logic and filtering
URL?a=A&a=A2&c=C1,C2&d-e-=D&E
AND
EQ a=A2 OR
c=C1 c=C2AND
d=D e=E
a A
ELEM
Page 48
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
48
_include
Page 49
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
49
Chained parameters
Page 50
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
50
Paging
Page 51
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
51
Canonical search
Page 52
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
52
Canonical search
UCUM
http://unitsofmeasure.org/
Page 53
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
53
Fuzzy search
Page 54
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
54
Fuzzy search
1. STARTS WITH
Page 55
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
55
Fuzzy search
2. LIKE
Page 56
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
56
Fuzzy search
3. SOUNDEX
Page 57
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
57
Fuzzy search
4. Damerau-Lehvenstein
Page 58
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
58
Fuzzy search
5. More advanced searching
Page 59
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
59
Full text search