Skip to content

Instantly share code, notes, and snippets.

@SSTPIERRE2
Last active July 13, 2016 13:54
Show Gist options
  • Save SSTPIERRE2/550cf28807f8c8146f1163145991e953 to your computer and use it in GitHub Desktop.
Save SSTPIERRE2/550cf28807f8c8146f1163145991e953 to your computer and use it in GitHub Desktop.

Learn the Basics of Rest!

So, there's no single, comprehensive definition of REST, it's just an architectural standard with which to design a server that stores and retrieves information so that it can communicate with other servers of the like. There are four principles presented by IBM that illustrate the concepts of REST:

  • Use HTTP methods explicitly
  • Retrieve data using GET, create data using POST, update or change data using PUT, delete data using DELETE
  • Be stateless
  • "don't store state information on the server"
  • Instead, save state on client-side via cookies
  • Expose directory structure-like URIs
  • Basically, your resource links should be paths to the file being accessed
  • Transfer XML, JSON, or both
  • Only send XML or JSON from the back-end, this way you can more easily manipulate data in the presentation layer without having to hit the servers
BDT Reference

Now that I've been introduced to full-stack of development and sat in with other developers for new additions to BDT, I can better understand what's actually going on with the BDT project. BD Technologies in conjunction with Partner's are developing a native application with a web portal to help diabetes patients with self-care and to track their current healthcare plan.

From the ground up, the application design process for us starts with the wireframes provided by the UCD team, which express functionality and data needs. This leads to the setup of the back-end, then the front-end backbone setup. By then, we should have a full mockup of the application to begin implementing on the full-stack, which we continue polishing until it meets the specifications.

chiClient.js

I would include the full code, but it's not yet finalized and merged. The client code that Dan is writing interacts with a specified server (in production it will be BDT's server) to pull/request patient data (such as insulin levels/blood glucose values) in one's specific instance of the app in a clean, meaningful way so that it can be presented on the front-end to the user's in the pretty, meal card page shown in the mockup.

  • The 'resources' we're working with on FHIR are basically tables of data
    • We designed a custom Resource Basic, called Meals. One can loop through a patient's Meals like an array, then nest another loop to iterate through the values contained within. Meals is a parent class to two children we are particularly interested in: Blood Glucose Value and Insulin Level. The children classes can't pass information to each other.
BDT Front End Introduction

So what do you do with patient data once it's pulled from BDT's server? Organize it into visuals that make will make sense and look good to users. The main players on the front-end are HTML,CSS, Bootstrap, and Javascript (JQuery is particularly useful for $(selecting).action() elements to perform actions on them)

  • JQuery Notes
  • $ the Element Selector
    • Selects an element based on the element name (like for p or div elements)
    • Example - When the user clicks on a button, all p elements will be hidden
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
  • the id Selector

    • Uses the id attribute of an HTML tag to find the specific element, which should be unique within a page
    • Example - When a user clicks on a button, the element with id="test" will be hidden:
$(document).ready(function(){
  $("button").click(function(){
    $("#test").hide();
  });
});
  • The .class Selector
    • Finds elements with a specific class
    • In the following example, when a user clicks on a button, the elements with class="test" will be hidden:
$(document).ready(function(){
    $("button").click(function(){
        $(".test").hide();
    });
});
  • Sidenote: use $("[attribute]") to select element/s with a specified attribute Check out W3Schools' JQuery Guide for more examples!

FHIR Notes

  • All resources and attributes have a free-text expression, an encoded expression, or both
  • Mark up is direct xhtml
  • Common infrastructural elements are not shown in the xml. They must appear prior to any other defined child elements, first the elements from the base resource, in order, and second the elements from the domain resource
  • FHIR elements are never empty
  • Every element in a resource or data type includes an optional extension child element
  • Primitive Types specific to FHIR:
  • uri - Uniform Resource Identifier Reference (a JSON string)
  • instant - an instant in time, mainly for system logs, always includes timezone
  • date - for human input, no time zone
  • dateTime - like date, but must include seconds
  • time - a time during the day, must provide seconds
  • Complex Types:
  • Elements: * Attachment - additional data content defined in other formats, like to include images or reports in some report format like PDF, but can be used for any data that has a MIME type * Coding - a reference to a code defined by a terminology system, with 5 types:
    • system - uri
    • version - string
    • code - code (base type string)
    • display - string
    • userSelected - boolean * CodeableConcept - reference to a terminology or just text
    • no meaning to the ordering of coding within a CodeableConcept
    • typical use is to send the local code that the concept was coded with; important for debugging * Quantity - a measured amount (if a code for the unit is present, the system shall also be present
    • must include a comparator element (= | > | <= etc)
    • different types of quantity include: Age, Count, Money, Distance, Duration, SimpleQuantity (fixed quantity, no comparator) * Range - set of values bounded by low and high * Ratio - A ratio of two Quantity values (numerator and denominator) * Period - time range defined by start and end date/time * Identifier - a string associated with a single object or entity * HumanName - name of a human * Address - a postal address * ContactPoint - details of a Technology mediated contact point (a system, like phone/fax/email/etc is required if a value is provided) * Timing - a timing schedule that specifies an event that may occur multiple times (when they're expected to occur) * Signature - a digital Signature - XML DigSig, JWT, Graphical image, etc
    • some rules apply to XML Sigital Signatures (contentType = application/signature+xml)
    • XML signature is detached from data object (can reside within same XML doc, but are sibling elements)
    • 3 levels of signature verification * Annotation - text note containing info about who made the statement and when * Open Type Element - represented by the wildcard symbol "*" (can be a primitive or complex data type) * Other Types:
    • Resource - conceptual base class for all resources
    • Reference - for references from one resource to another
    • Extension - used to convey additional data in a resource
    • Narrative - conveys a human-readable representation of the content of a response
FHIR Resources Notes
  • Patient - DomainResource containing information about an individual receiving health care services
  • careProvider - Reference to the patient's primary care provider
  • MedicationOrder - DomainResource containing prescription of medication for patient
  • medication - 1..1 relation with name of medication + reference to medication resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment