CSV, JSON,

Converting FHIR JSON to CSV with Flexter

March 16, 2018

In this post we will be converting FHIR JSON files to text (CSV).

FHIR

Fast Healthcare Interoperability Resources (FHIR, pronounced “fire”) is a draft standard describing data formats and elements (known as “resources”) and an application programming interface (API) for exchanging electronic health records. The standard was created by the Health Level Seven International (HL7) health-care standards organization.
FHIR builds on previous data format standards from HL7, like HL7 version 2.x and HL7 version 3.x. But it is easier to implement because it uses a modern web-based suite of API technology, including a HTTP-based RESTful protocol, HTML and Cascading Style Sheets for user interface integration, a choice of JSON or XML for data representation, and Atom for results. One of its goals is to facilitate interoperation between legacy health care systems, to make it easy to provide health care information to health care providers and individuals on a wide variety of devices from computers to tablets to cell phones, and to allow third-party application developers to provide medical applications which can be easily integrated into existing systems.
FHIR provides an alternative to document-centric approaches by directly exposing discrete data elements as services. For example, basic elements of healthcare like patients, admissions, diagnostic reports and medications can each be retrieved and manipulated via their own resource URLs. FHIR was supported at an American Medical Informatics Association meeting by companies like Cerner which value its open and extensible nature.

Processing the file

Flexter is available in a dockerized version. You can contact us for a trial.

This command will create a container and destroy it when you exit it.

Now we can start processing the file.

  • First we will see what we have in the fhir folder and check ‘valuesets.json’. That is the file that we will be using

 
 

  • Now we run

 

  • As you can see we got the Logical Schema ID ( logical: 1). Logical Schema is a relational schema equivalent that is created as the output from Flexter. From the same logical schema multiple physical schemas can be generated
  • We can now move to extracting files

Extracting CSV files

  • We will be running first this command

  • And it’s done. You can check your output_dir and use the CSV files.

 

  • This is the source to target map that Maps XML source elements to table attributes

 

Here you can find input and output files

JSON INPUT
CSV OUTPUT

[Video] Converting FHIR JSON to CSV with free Flexter

Here you can see how Free Version of Flexter can be used for FHIR JSON.

Download ER Diagram

Conclusion

It tooks us just a few minutes to convert a large number of JSON files. This shows you how powerful Flexter is for converting JSON to text, a database or Hadoop (Parquet, ORC, Avro).

Read this document to avail Free Trial of Flexter.