1 of 26

A hands-on tour of the ecosystem

Become more effective with FHIR in Python

HL7®, FHIR® and the flame Design mark are the registered trademarks of Health Level Seven International and are used with permission.

HL7 FHIR DevDays 2023 | Hybrid Edition, Amsterdam | June 6–9, 2023 | @HL7 | @FirelyTeam | #fhirdevdays | www.devdays.com

2 of 26

Who am I?

Axel Vanraes – CTO @Tiro.health

1

3 of 26

Structured reporting for clinicians

2

4 of 26

Using FHIR in Python

All our backends are written in Python. 🐍

But tooling for FHIR in Python is not as mature as Java or .NET 😿

Let’s have a look at the ecosystem! 🧐

3

5 of 26

Ecosystem: Data Models

4

6 of 26

Typing issues with fhir.resources

5

7 of 26

Ecosystem: Client SDK’s

6

8 of 26

Ecosystem: Analytics

7

9 of 26

Ecosystem: other

8

10 of 26

Let’s get hands-on! 🛠️

Follow along with the notebooks on https://github.com/axelv/devdays-2023

9

11 of 26

⛑️ Make your Python FHIR-type safe

10

12 of 26

⛑️ Make your Python FHIR-type safe

  • Let your IDE assist you with the available Elements and docstrings�
  • Be 100% guaranteed of types at runtime by using validators�
  • Conveniently initialize Elements with cardinality 0…* as lists

11

13 of 26

Intermezzo: Pydantic

12

14 of 26

🤝 Use a client library to interact with a FHIR Server

13

15 of 26

🤝 Use a client library to interact with a FHIR Server

14

16 of 26

🤝 Use a client library to interact with a FHIR Server

  • Use a client library to compose encode url’s.�
  • Use a happy path to simplify response types and code and�
  • handle FHIR OperationOutcome’s as Python Exceptions.

15

17 of 26

🏠 Generate your proper models

16

18 of 26

🏠 Generate your proper models

  • Download a FHIR spec (ex. R4B R5) and generate your proper models.
  • Some PR’s open to support model generation for FHIR Profiles and IG’s

17

19 of 26

⚙️ Customize the client to support your $operations

18

20 of 26

⚙️ Customize the client to support your $operations

  • User your IDE completion to suggest “In Parameters”�
  • Automatically convert your **kwargs to a Parameters resource.�
  • Built in validation and typing of the response

19

21 of 26

🪄 Customize the models to with magic functions

ex. Use __repr_html__ to render the Narrative in Notebooks

20

22 of 26

📊 DataFrames that preserve nested structures

21

23 of 26

📈 Putting all learnings together: analytics dashboard

22

24 of 26

Contact

During DevDays, you can find / reach me here:

@AxelVanraes

    • axel.vanraes@tiro.health

23

25 of 26

Q&A

24

26 of 26

25