• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Swift
  • License
    Other
  • Created over 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Swift SMART on FHIR framework for iOS and OS X

Swift-SMART is a full client implementation of the 🔥FHIR specification for building apps that interact with healthcare data through SMART on FHIR. Written in Swift 5.0 it is compatible with iOS 11 and macOS 10.13 and newer and requires Xcode 10.2 or newer.

Versioning

Due to the complications of combining two volatile technologies, here's an overview of which version numbers use which Swift and FHIR versions.

  • The master branch should always compile and is on (point releases of) these main versions.
  • The develop branch should be on versions corresponding to the latest freezes and may be updated from time to time with the latest and greatest CI build.

See tags/releases.

Version Swift FHIR  
4.2 5.0 Package 4.0.0-a53ec6ee1b R4
4.1 5.0 4.0.0-a53ec6ee1b R4
4.0 4.2 4.0.0-a53ec6ee1b R4
3.2 3.2 3.0.0.11832 STU 3
3.0 3.0 3.0.0.11832 STU 3
2.9 3.0 1.6.0.9663 STU 3 Ballot, Sep 2016
2.8 3.0 1.0.2.7202 DSTU 2 (+ technical errata)
2.4 2.2 1.6.0.9663 STU 3 Ballot, Sep 2016
2.3 2.3 1.0.2.7202 DSTU 2 (+ technical errata)
2.2.3 2.2 1.0.2.7202 DSTU 2 (+ technical errata)
2.2 2.0-2.2 1.0.2.7202 DSTU 2 (+ technical errata)
2.1 2.0-2.2 1.0.1.7108 DSTU 2
2.0 2.0-2.2 0.5.0.5149 DSTU 2 Ballot, May 2015
1.0 1.2 0.5.0.5149 DSTU 2 Ballot, May 2015
0.2 1.1 0.5.0.5149 DSTU 2 Ballot, May 2015
0.1 1.0 0.0.81.2382 DSTU 1

Resources

QuickStart

See the programming guide for more code examples and details.

The following is the minimal setup working against our reference implementation. It is assuming that you don't have a client_id and on first authentication will register the client with our server, then proceed to retrieve a token. If you know your client-id you can specify it in the settings dict. The app must also register the redirect URL scheme so it can be notified when authentication completes.

import SMART

// create the client
let smart = Client(
    baseURL: URL(string: "https://fhir-api-dstu2.smarthealthit.org")!,
    settings: [
        //"client_id": "my_mobile_app",       // if you have one
        "redirect": "smartapp://callback",    // must be registered
    ]
)

// authorize, then search for prescriptions
smart.authorize() { patient, error in
    if nil != error || nil == patient {
        // report error
    }
    else {
        MedicationOrder.search(["patient": patient!.id])
        .perform(smart.server) { bundle, error in
            if nil != error {
                // report error
            }
            else {
                var meds = bundle?.entry?
                    .filter() { return $0.resource is MedicationOrder }
                    .map() { return $0.resource as! MedicationOrder }
                
                // now `meds` holds all the patient's orders (or is nil)
            }
        }
    }
}

For authorization to work with Safari/SFViewController, you also need to:

  1. register the scheme (such as smartapp in the example here) in your app's Info.plist and
  2. intercept the callback in your app delegate, like so:
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    func application(_ app: UIApplication, open url: URL,
        options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
        
        // "smart" is your SMART `Client` instance
        if smart.awaitingAuthCallback {
            return smart.didRedirect(to: url)
        }
        return false
    }
}

Installation

The suggested approach is to add Swift-SMART as a git submodule to your project. Find detailed instructions on how this is done on the Installation page.

The framework can also be installed via Carthage and is also available via CocoaPods under the name “SMART”.

License

This work is Apache 2 licensed: NOTICE.txt. FHIR® is the registered trademark of HL7 and is used with the permission of HL7.

More Repositories

1

client-py

Python SMART on FHIR client
Python
588
star
2

health-cards

Health Cards Framework: implementation guide and supporting material
TypeScript
259
star
3

Swift-FHIR

These are Swift classes for data models of FHIR elements and resources
Swift
159
star
4

fhir-parser

A Python FHIR specification parser and class generator
Python
149
star
5

smart-dev-sandbox

Docker based sandbox for smart apps
Smarty
116
star
6

api-server

Open-source FHIR Server to support patient- and clinician-facing apps
Groovy
104
star
7

patient-browser

JavaScript
83
star
8

smart-on-fhir.github.io

SMART on FHIR Docs
Jupyter Notebook
77
star
9

fhir-bulk-data-docs

Documentation and issue tracking for the emerging FHIR bulk data implementation guide
Jupyter Notebook
74
star
10

health-cards-dev-tools

Developer tools for validating SMART Health Cards
TypeScript
71
star
11

growth-chart-app

JavaScript
66
star
12

sample-apps-stu3

Collection of simple sample apps
JavaScript
46
star
13

fred

FRED - FHIR Resource Editor
JavaScript
44
star
14

health-cards-tests

Demo for health wallet with Verifiable Credentials and Decentralized Identifiers
TypeScript
43
star
15

bulk-data-server

JavaScript
42
star
16

fhir-server-dashboard

Presents a human-readable representation of the data in a FHIR server.
JavaScript
41
star
17

fhir-viewer

In-browser viewer for FHIR resources
JavaScript
39
star
18

installer

Shell
39
star
19

hapi

HAPI FHIR Server With Sample Patients
Dockerfile
37
star
20

SoF-Demo

Simple SMART on FHIR / Argonaut iOS sample app that fetches a couple of resources
Swift
36
star
21

smart-launcher

Launcher for SMART apps
JavaScript
33
star
22

smart-scheduling-links

Clinical Appointment Slot Discovery
TypeScript
28
star
23

sample-apps

HTML
25
star
24

cardiac-risk-app

JavaScript
25
star
25

generated-sample-data

Contains all the bundles that are loaded into the FHIR server
24
star
26

bulk-data-tools

HTML
23
star
27

smart-examples

Collection of public apps
JavaScript
14
star
28

client-node

SMART client for NodeJS
HTML
13
star
29

bulk-import

12
star
30

bulk-data-implementations

listing of bulk FHIR client implementations
12
star
31

bulk-data-client

JavaScript
11
star
32

tag-uploader

Adds tags to FHIR bundles and resources and uploads them to specified servers
JavaScript
9
star
33

sample-patients-stu3

Python
9
star
34

client-ts

FHIR Client Library
HTML
9
star
35

bp-centiles-app

JavaScript
8
star
36

cumulus-etl

Extract FHIR data, Transform with NLP and DEID tools, and then Load FHIR data into a SQL Database for analysis
Python
8
star
37

diabetes-monograph-app

JavaScript
7
star
38

fhir-starter

HTML
7
star
39

smart-launcher-v2

SMART Launcher
TypeScript
6
star
40

smart-local-sandbox

Docker based sandbox for smart apps
JavaScript
6
star
41

health-cards-designs

5
star
42

smart-hapi-stack

Experimental HAPI stack to support SMART on FHIR
Java
5
star
43

sample-bulk-fhir-datasets

Sample bulk export results of various sizes, for testing tools and workflows
Shell
5
star
44

bdt

Bulk Data Test Suite and Test Runner
TypeScript
5
star
45

sample-patients-prom

Provisional Quarterly Patient Reported Outcome Measures (PROMs) in England - April 2015 to March 2016, November 2016 release
JavaScript
5
star
46

smart-stub

Node / Express server to stub SMART Auth
JavaScript
4
star
47

mpr-monitor-app

JavaScript
4
star
48

dstu2-examples

Copy of official FHIR examples with an index page
HTML
4
star
49

synthea

Static build of Synthea with http interface
JavaScript
4
star
50

hca-fhir-importer

Import synthetic breast cancer sample data, courtesy of HCA/Bill Gregg
Python
4
star
51

fhir-demo-app

ApacheConf
3
star
52

smart-health-card-decoder

Sample code for a SMART Health Card validator
JavaScript
3
star
53

smart-health-links

Static documentation site for SMART Health Links
JavaScript
3
star
54

ehi-app

EHI Export API Client Reference Implementation
TypeScript
3
star
55

ehi-server

An EHI export server reference implementation of Argonaut's EHI Export API IG
TypeScript
3
star
56

bulk-import-client

CLI Client app for Bulk Data Import
JavaScript
2
star
57

confidential-client-example

JavaScript
2
star
58

fiery-sublime

Sublime Text 3 Plugin for FHIR data models
Python
2
star
59

disease-monograph-app

JavaScript
2
star
60

fhir-crawler

Utility to download resources from a FHIR server
TypeScript
1
star
61

fhir-server-tasks

Maintenance web-hooks for FHIR servers
JavaScript
1
star
62

timeshift

Shift dates in FHIR datasets
JavaScript
1
star
63

client-js-examples

Contains examples of how to use the client-js library
HTML
1
star
64

registry

Registry of FHIR Profiles for SMART Platforms
HTML
1
star
65

bulk-import-consumer

Bulk Data Import Server (Data Consumer)
JavaScript
1
star
66

reachnet

JavaScript
1
star
67

cumulus-library-hypertension

Hypertension case definition to support CDC chronic disease management and CMS measures
Python
1
star