APIs

Show:

Events soap_load

Methods

_validateChildCollection

(
  • key
  • collection
  • errors
)
Boolean

CAUTION errors param will be modified

Parameters:

  • key String

    Attribute key

  • collection awa.mvc.Collection

    Collection to check

  • errors Object

    Object of errors

Returns:

Boolean:

Indicates this method found errors in the collection

add

(
  • attribute
  • value
  • [id]
  • [options]
)
type

The add method is used primarily for arrays.

Parameters:

  • attribute String

    attribute name

  • value Object

    value to be added to the array

  • [id] Integer optional

    the specific index

  • [options] Object | String optional

    refer to Backbone.js

Returns:

type:

[description]

addRules

(
  • key
  • rules
)
type

appends rules to the model

Parameters:

  • key Object | String

    desc

  • rules Object | String

    desc

Returns:

type:

[description]

destroy

(
  • options
)
type

Stolen from backbone and completely overridden. Look in method for change

Parameters:

  • options Object

    configuration object with various properties

Returns:

type:

[description]

difference

(
  • obj
)
type

Parameters:

  • obj Object

    configuration object with various properties

Returns:

type:

[description]

displayName

() type

Override to return the name of the model (i.e. for a patient, it would be their last name, comma, space, and then first name). By default, this returns attribute name, id, then cid.

Returns:

type:

[description]

enable

(
  • [options]
)
type

If the model has a disabledAttribute, this method will automatically re-enable by setting the property to 0

Parameters:

  • [options] Object optional

    configuration object with various properties

Returns:

type:

[description]

get

(
  • attr
)
type

Get the current value of an attribute from the model Overwritten to create collections and sub models only when needed.

Parameters:

  • attr String

    desc

Returns:

type:

[description]

getAttributeProp

(
  • attr
  • prop
)
type

Gets the attribute property for a specified attribute.

Parameters:

  • attr String

    Attribute key (i.e pat_fname)

  • prop String

    Property key (i.e displayMethod)

Returns:

type:

[description]

getDisplay

(
  • attr
  • options
)
type

Like get, but this uses the displayMethod.

Parameters:

  • attr String

    desc

  • options Object

    desc

Returns:

type:

[description]

getDisplayMethod

(
  • attr
)
type

returns the displayMethod for a given attribute

Parameters:

  • attr String

    desc

Returns:

type:

[description]

getName

(
  • attr
  • fullName
)
String

Gets the name of an attribute. This can be set by an attribute's attributeProp name. An attribute property can have a getName function to define how to name nested portions NOTE: The containing object of a property should decide the properties name. i.e. if a model has a "period" attribute prop, that should be named in the model, not the period attributeProps returns the attribute if not set.

Parameters:

  • attr String

    Attribute key desired. If nothing is provided, the model's displayName is returned.

  • fullName Boolean

    If true returns the full name for nested properties from the context of the root model. i.e. "Encounter Primary Insurance Period Start" v. "Start"

Returns:

String:

attribute name

getScope

(
  • options
)
type

Id this is a nested model inside of a collection or another model, this will provide the extended id to grab it from the root model.

Parameters:

  • options Object

    desc

    • [cssSafe] Boolean optional

      replaces attribute separator with dashes for css selection if true

    • [cid] Boolean optional

      by default uses cid. if set to false, will use ID instead

Returns:

type:

[description]

getTip

(
  • attr
)
type

Gets the tip for an attribute. This can be set by an attribute's attributeProp tip. returns the attribute if not set.

Parameters:

  • attr String

    desc

Returns:

type:

[description]

getType

(
  • attr
)
type

Gets the attribute type (i.e. string, collection, date), the default type is string

Parameters:

  • attr String

    desc

Returns:

type:

[description]

isDisabled

() Boolean

Tells whether or not an individual has disabled status.

Returns:

Boolean:

desc

isIncomplete

() Boolean

Tells whether or not an individual has incomplete status. Override this method if you want to use it in a model.

Returns:

Boolean:

desc

isNotDone

() Boolean

Tells whether or not an item was not done. Primarily for medical events (i.e. procedures, care plans, prescriptions)

Returns:

Boolean:

desc

isValid

(
  • Refer
)
type

A convenience function for returning boolean values instead of objects

Parameters:

  • Refer Object

    to validate() for parameter list and notes.

Returns:

type:

[description]

objectAccess

(
  • obj
  • property
)
Object | Undefined

Parameters:

  • obj Object

    Object to retrieve nested property from

  • property String

    Property string to access

Returns:

Object | Undefined:

returns the nested property or undefined

objectFilter

(
  • object
  • iterator
)
type

this does something....

Parameters:

  • object Object

    desc

  • iterator Function

    desc

Returns:

type:

[description]

removeRules

(
  • key
  • rules
)
type

Replaces all rules for an individual key in a model

Parameters:

  • key Object | String

    desc

  • rules Object | String

    desc

Returns:

type:

[description]

restore

(
  • options
)
type

The restore method rewinds back to the last created store point.

Parameters:

  • options Object

    desc

Returns:

type:

[description]

set

(
  • attributes
  • [options]
)
type

The set method does everything outlined in Backbone.js library. It has been overridden to handle building inferred attributes that are outlined in the child class. Sometimes you may want another attribute to update another set in a model. In this case, you may override the set method. If you do, be sure to call super on set so that these processes are handled.

Parameters:

  • attributes Object | String

    refer to Backbone.js

  • [options] Object | String optional

    refer to Backbone.js

Returns:

type:

[description]

setRules

(
  • key
  • rules
)
type

set rules to the model for an attribute

Parameters:

  • key Object | String

    desc

  • rules Object | String

    desc

Returns:

type:

[description]

store

() type

The store method sets a store point for the model in a stack. Use restore to rewind the model to previous store points. FIFO

Returns:

type:

[description]

subAction

(
  • options
)
XHRObject

Call a subaction of a model. (i.e. if you have a document that has a copy action) The url should follow the pattern of resource/:id/:action (documents/2/copy)

var PatientModel = awa.mvc.Model.extend({ urlRoot: awa.url.BAREBONES + 'V1/patients', idAttribute: 'pat_id' });

var model = new PatientModel({pat_id: 75});

//the following will make a GET request to //[barebones_root]V1/patients/75/sync

model.subAction({ type: 'GET', action: 'sync', success: function(){

}
                    

});

Parameters:

  • options Object

    configuration object with various properties

    • action String

      name of action

    • type String

      http method to use (POST, GET, DELETE, etc)

    • success Function

      desc

    • error Function

      desc

    • data Object

      desc

Returns:

XHRObject:

Avoid using this as it is subject to change.

sync

(
  • method
  • model
  • options
)
Object

Overridden from Backbone.Model.fetch to handle not so restful backend.

Parameters:

  • method Object

    configuration object with various properties

  • model Object

    desc

  • options Object

    desc

Returns:

Object:

result of api_sync

toDisplayJSON

() type

Uses the displayRules/Methods that are set in either the displayRules property or the attributeProps to generate a javascript object (w/o getters and setters) that represents the model's data in a displayable format.

Returns:

type:

[description]

toJSON

(
  • [options]
)
type

Overwritten to provide more control on the resulting json output

Parameters:

  • [options] Object optional

    Options object

    • [skipKeys] Array optional

      Set of keys to skip.

    • [sync] String optional

      If calling for syncing purposes. see awa.mvc.Model.SYNC

Returns:

type:

[description]

url

() String

stolen from backbone and altered to not throw exception in case of no urlRoot

Returns:

String:

URL for model instance

validate

(
  • attributes
  • [options]
)
type

The validate method does everything outlined in Backbone.js library. It has been overridden to handle the rules set in the attributeProps and the rules property. In some cases, you may want to do extensive validating on attributes that dont fit the model rules functions (i.e. making sure a date of birth is not in the future). Be sure to call the super version of validate to handle the other rules. !!!PLEASE NOTE!!! This method will evaluate all rules if you don't pass in attributes but if you do, then it only validates the ones you pass in. Keep this in mind when overriding this method. passing in a small set of attributes will cause all of the unset variables to be ignored.

Parameters:

  • attributes Object | String

    refer to Backbone.js

  • [options] Object | String optional

    refer to Backbone.js

Returns:

type:

[description]

Properties

__attributePropsProcessed

Boolean

just leave it alone.

Default: false

_stores

Array

Used by the model object to set and access store points.

Default: empty

api

String

Specifies what backend protocol to use to communicate with the server. 'api' will use the old standard of adding the method in the URL. 'barebones' will accomodate barebones

Default: api

className

String

Specifies what backend protocol to use to communicate with the server. 'api' will use the old standard of adding the method in the URL. 'barebones' will accomodate barebones

Default: Model

disabledAttribute

String

Specifies the disabled attribute in the model

Default: undefined

displayRules

Object keys: attribute/field names, value: name of the function outline in awa.func that will be called to format the data for output.

Rule set for validation. Used by Form validators.

Default: undefined

inferred

Object keys: attribute/field names, value: Objects that specify the rules to follow. Used in conjuction with model rule functions

Any attributes that are built with primary data goes here. i.e. a patients full name is derived from the combination of it's first, middle, and last name and the suffix

Default: undefined

name

String

Override to return the name of the model (i.e. for the patient model, it would be Patient).

Default: undefined

pluralName

String

Override to return the plural name of the model. You should only use this if the plural does not just append a 's' (i.e. for the Diagnosis model, it would be Diagnoses).

Default: undefined

rules

Object keys: attribute/field names, value: Objects that specify the rules to follow. Used in conjuction with jquery forms.

Rule set for validation. Used by Form validators.

Default: undefined

syncBlackList

Array

Lists the attributes that will not be synced back. doesn't prevent anything from being sent if empty or undefined. Given priority of over syncWhiteList

Default: undefined

syncWhiteList

Array

Lists the attributes that can be synced back. sends back all attributes if the list is empty or undefined

Default: undefined

Events

rules

Called when rules change on an individual model