13

Without using commercial tools, is there an easy way to generate sample FHIR resources?

I'm working an a project to store FHIR messages to Elasticsearch, and I need a tool to generate FHIR sample messages in real-time to ship over TCP/IP.

jacefarm
  • 6,747
  • 6
  • 36
  • 46
mishkin
  • 5,932
  • 8
  • 45
  • 64

3 Answers3

21

Did some digging and here is what I've found.

If you do not need a lot of samples, the easiest way is to grab a zip file with resource examples from hl7 website http://hl7.org/fhir/downloads.html

IMHO the easiest way I've found to get more than a few samples is by using Synthea project. You can generate millions of records of synthetic realistic data https://github.com/synthetichealth/synthea

They even run a public server. Here is an example to get a bundle with 100 patients - very neat! https://syntheticmass.mitre.org/fhir/Patient?_offset=0&_count=100

You can also find examples of bulk FHIR API implementations - some of them have demo web sites you can use to download examples: https://github.com/smart-on-fhir/fhir-bulk-data-docs/blob/master/implementations.md

Another generator in Python from SMART on FHIR project (looks outdated): https://github.com/smart-on-fhir/sample-patients.

mishkin
  • 5,932
  • 8
  • 45
  • 64
6

The only way I know to do this is to use a service provided by test.fhir.org. You call

http://test.fhir.org/r3/StructureDefinition/[resource]/$generate-template

e.g.

http://test.fhir.org/r3/StructureDefinition/Patient/$generate-template

Grahame Grieve
  • 3,538
  • 3
  • 15
  • 17
  • 1
    did not expect to get an answer from Grahame himself! it works but I only get one patient. I think I am just going to use one of the public FHIR servers to get test patients and other resources. I also looking at some python packages on github to generate sample FHIR resources – mishkin Oct 22 '17 at 01:06
  • @Grahame, mishkin is there any resource to follow to make FHIR calls from R ? – user5249203 Apr 15 '19 at 13:54
  • 1
    Yes. see https://cran.r-project.org/web/packages/RonFHIR/readme/README.html. btw - Rather off topic! – Grahame Grieve Apr 15 '19 at 19:03
2

An easy way to generate example resources (in 2022) is to use FHIR Shorthand (FSH). Here's a copy of the example on FSH School from which you easily create the JSON.

Link: https://fshschool.org/FSHOnline/#/share/3LH920m

Instance: PatientExample
InstanceOf: Patient
Description: "Example of Patient"
* name.family = "Anyperson"
* name.given[0] = "John"
* name.given[1] = "B."
// The first element [0] can also be represented as [+] if it is not preceded by any hard index
* contact.telecom[+].system = #phone
* contact.telecom[=].value = "555-555-5555"
* contact.telecom[=].use = #home
* gender = #male
* birthDate = "1951-01-20"
* address.line = "123 Main St"
* address.city = "Anytown"
* address.postalCode = "12345"
* address.country = "US"

Have a try at https://fshschool.org/

A bonus is that you can reverse JSON into FSH as well. And, templating is easy enough use in FSH (though it's not built-in.). For a worked example see https://github.com/intrahealth/bulk-fsh

citizenrich
  • 327
  • 2
  • 7