pitfalls and best practices for apps on fhir · amsterdam, 14-16 november | @hl7 @firelyteam |...

47
HL7®, FHIR® and the flame Design mark are the registered trademarks of Health Level Seven International and are used with permission. Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | www.fhirdevdays.com Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for Apps on FHIR

Upload: others

Post on 29-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

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

Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | www.fhirdevdays.com

Jenni Syed Cerner, Principal Engineer

Pitfalls and Best Practices for Apps on FHIR

Page 2: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Dos and Don’ts

Page 3: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Do

• Do try to recreate (in sandbox)

• Do note the X-Request-Id or Correlation Id

• Do note the error message in the response

• Do double-check the documentation

• Do use debugging tools, if available

Page 4: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Don’t

• Do NOT compromise PHI/PII

• Do NOT compromise secrets

• Don’t ignore errors

• Don’t assume it was a fluke

Page 5: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Know Where to Find Doc

Page 6: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

HTTP Spechttps://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Page 7: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Beyond HTTP Spechttps://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Page 8: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

HL7 FHIR Spechttp://hl7.org/fhir/dstu2/http.html#summary

Page 9: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Ignite Documentationhttp://fhir.cerner.com/millennium/dstu2/#client-errors

Page 11: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Pay Attention to OperationOutcome

Page 12: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Operation Outcomes

• It’s a resource

• http://hl7.org/fhir/dstu2/operationoutcome.html

• Limited use currently

• Fatal, error, informational, and warning

Page 13: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Example

Page 14: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Connection Troubleshooting

Page 15: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Firewalls

• Especially during initial install

• Can be to your application

• Can be to OAuth, SMART, or FHIR

Page 16: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Narrowing it Down• Load a URL in the browser

• For FHIR, the metadata endpoint can be used

• ping

• Can it connect?

• Is it only me?

• openssl

• More in a bit

Page 17: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Certificates

• These can look like connection issues

• Most important: know how to debug your stack

• Know how to add trust

• https://www.ssllabs.com/ssltest/

• openssl

• openssl s_client -showcerts -connect mysslhost.com:443

Page 18: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Google is Your Friend

Page 19: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Know Your Client Errors

Page 20: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

400

• Syntax was wrong

• Invalid parameters

• Missing fields

Page 21: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

401 and 403

• Authorization and Authentication

• 401: You need to authenticate

• 403: This isn’t allowed

• or… 404?

Page 22: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

404

• Not Found

• Check your URL!

• Not supported

• Accessing data without permissions

Page 23: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

406

• Not Acceptable

• Accept header

• application/json or application/json+fhir

• _format parameter

Page 24: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

409

• Conflict

• Update, Patch

• Updating the wrong version

Page 25: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

415

• Unsupported Media Type

• Content-type Header

• application/json or application/json+fhir

Page 26: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

422

• Unprocessable

• JSON was fine - something else wasn’t

• Most common when a value can’t be interpreted

• Mappings!

Page 27: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Watch Out for Server Errors

Page 28: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

5xx

• 500: Internal Server Error

• 503: Server Unavailable

• Correlation or X-Request-Id!!

Page 29: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Know Where to Ask For Help

Page 30: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Specification Help

• chat.fhir.org

• More: http://wiki.hl7.org/index.php?title=FHIR_Support_Page

• SMART Google Group: https://groups.google.com/forum/#!forum/smart-on-fhir

Page 31: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Cerner Specific

• Google Group

• https://groups.google.com/forum/#!forum/cerner-fhir-developers

Page 32: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for
Page 33: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

OAuth Troubles

Page 34: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

OAuth

• Display to user

• error_uri

• Correlation Id

• http://fhir.cerner.com/authorization/

• Compare to examples

• Watch your scopes!

Page 35: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

ExampleAuthorization error

Page 36: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

OAuth Mistakes

• Use the state parameter

• Use it correctly

• Don’t get hacked!

• Whitelist the FHIR server

• Validate signatures on id_tokens

• Protect your secrets

Page 37: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

SMART: Know Your Browser

Page 38: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Read Up!• http://fhir.cerner.com/smart/

• Know your developer tools

Page 39: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Browsers

• Know your development tools

• Know your minimums

• Publish your maximums

• Know your resolution and real estate (be responsive)

• Use the X-UA-Compatible header

Page 40: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Embedded Browsers

• Used by several venders

• Come with limitations…

• Running in compatibility mode

• Session storage isn’t partitioned by tab

• Cookies aren’t shared with popups

• https://fhir.cerner.com/smart/#embedded-browser-control

Page 41: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

The Errors that Weren’t

Page 42: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

No Data

• Scenario: 200 response, but no data!

• Causes:

• No access?

• No data?

• No data that matches filters?

• Data that’s not mapped…

Page 43: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Missing Data

• Scenario: 200 Response, but I don’t see everything I expect!

• Causes:

• User permissions

• Security

• Some data not mapped

Page 44: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Bad Data

• Scenario:

• Data is returned, but no codes

• Data is returned, but some fields are empty

• Data is returned, but not as expected

Page 45: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Bad Data Cont…

• Cause:

• Most common: data is not mapped

• Sanity check: ensure you see the data in Millennium (within PowerChart, for example)

Page 46: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Questions?

Page 47: Pitfalls and Best Practices for Apps on FHIR · Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | Jenni Syed Cerner, Principal Engineer Pitfalls and Best Practices for

Troubleshooting

http://bit.ly/chc_learning_lab