Manual Reference Source Test
public class | source

ApproverGroup

Mixin Extends:

ApproverGroupModel, Helper

Helper class representing an approver group.

Example:

// To get a list of ApproverGroups use clinical6.get
import { clinical6, ApproverGroup } from 'clinical6';
clinical6.get(ApproverGroup).then(a => console.log(a));

// To get a single approverGroup, you can also use clinical6
clinical6.get({ id: 5, type: 'consent__approver_groups'});

// To save or insert, you can either use the .save() capability or clinical6
myApproverGroup.save(); // insert if no id, save if id
clinical6.insert(new ApproverGroup({...}));
clinical6.update(ApproverGroup);

// To delete you can use the .delete() capability or clinical6
myApproverGroup.delete();
clinical6.delete(myApproverGroup);

Test:

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

Constructor for helper class representing an ApproverGroup

Member Summary

Public Members
public get
public set
public get
public set
public get
public set

Method Summary

Public Methods
public

async addApprover(approver: ConsentApprover): Promise<ApproverAssignment

This will create a ApproverAssignment and save it to the server based on this current approver and the approver parameter

public

async addFormVersion(formVersion: User): Promise<ApproverGroupAssignment

This will create an ApproverGroupAssignment and save it to the server based on this current ApproverGroup and the Consent Form Version parameter

public

async getApproverAssignments(params: Object, options: String): Promise

Gets the approver group assignment associated to this approver group.

public

Gets the list of approvers after calling this.getApproverAssignments()

public

Removes an assignment from a ApproverGroup.

public

Removes an assignment from an ApproverGroup.

public

Saves an approverGroup (insert if id doesn't exist, update if it does)

Inherited Summary

From class ApproverGroupModel
public
public
public
public

Static Public Members

public static get type: String source

Public Constructors

public constructor(json: Object) source

Constructor for helper class representing an ApproverGroup

Override:

ApproverGroupModel#constructor

Params:

NameTypeAttributeDescription
json Object

json api response from server

Public Members

public get approverAssignments: Object[] source

public set approverAssignments: Object[] source

public get approvers: ConsentApprover[] source

public set approvers: ConsentApprover[] source

public get formVersions: ConsentFormVersion[] source

public set formVersions: ConsentFormVersion[] source

Public Methods

public async addApprover(approver: ConsentApprover): Promise<ApproverAssignment source

This will create a ApproverAssignment and save it to the server based on this current approver and the approver parameter

Params:

NameTypeAttributeDescription
approver ConsentApprover

The approver to be added to this approver

Return:

Promise<ApproverAssignment

Returns the approver assignment

Example:

import { clinical6, ConsentApprover, ApproverGroup } from 'clinical6';
const approverAssignments = await clinical6.get(ApproverGroup);
const approver = new ConsentApprover({...}); // some new approver
const assignment = await approverAssignments[0].addApprover(approver);

Test:

public async addFormVersion(formVersion: User): Promise<ApproverGroupAssignment source

This will create an ApproverGroupAssignment and save it to the server based on this current ApproverGroup and the Consent Form Version parameter

Params:

NameTypeAttributeDescription
formVersion User

The consent form version to be added to this Approver Group

Return:

Promise<ApproverGroupAssignment

Returns the Approver Group Assignment

Example:

import { clinical6, ConsentFormVersion, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const consentFormVersion = new ConsentFormVersion({...}); // some new ConsentFormVersion
const assignment = await approverGroups[0].addFormVersion(consentFormVersion);

Test:

public async getApproverAssignments(params: Object, options: String): Promise source

Gets the approver group assignment associated to this approver group.

Params:

NameTypeAttributeDescription
params Object
  • optional

Parameters used to get information from server

params.id Number
  • optional

Id to get data from the server

params.type String
  • optional

Type to be used for storage

params.filters Object
  • optional

Filters to be used for get

options String
  • optional

Modify the nature of the call and response

options.url String
  • optional

Override the url for this call

options.cacheMode String
  • optional

Override the caching method for this call

Return:

Promise

Promise with data (array or object)

Example:

import { ApproverGroup, clinical6 } from 'clinical6';
const approverGroup = new ApproverGroup({ id: 23 });
approverGroup.getApproverAssignments({ id: 5 });

// Combined with clinical6.get
clinical6.get(ApproverGroup).then(approverGroups => { approverGroups[0].getAssignments() });

Test:

public async getApprovers(): Promise<ConsentApprover[]> source

Gets the list of approvers after calling this.getApproverAssignments()

Return:

Promise<ConsentApprover[]>

Promise returning an array of approvers

Example:

import { clinical6, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const approvers = await approverGroups[0].getApprovers();
console.log(approvers);

Test:

public async removeApprover(obj: ApproverAssignment | ConsentApprover): Promise source

Removes an assignment from a ApproverGroup.

Params:

NameTypeAttributeDescription
obj ApproverAssignment | ConsentApprover

Object that is to be removed from current ApproverGroup.

Return:

Promise

Promise likely with an empty string or error

Example:

import { clinical6, ConsentApprover, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const approver = new ConsentApprover({...}); // some new approver
const assignment = await approverGroups[0].removeApprover(approver);

Test:

public async removeFormVersion(obj: ApproverGroupAssignment | ConsentFormVersion): Promise source

Removes an assignment from an ApproverGroup.

Params:

NameTypeAttributeDescription
obj ApproverGroupAssignment | ConsentFormVersion

Object that is to be removed from current ApproverGroup.

Return:

Promise

Promise likely with an empty string or error

Example:

import { clinical6, ConsentFormVersion, ApproverGroup } from 'clinical6';
const approverGroups = await clinical6.get(ApproverGroup);
const formVersion = new ConsentFormVersion({...}); // some new formVersion
const assignment = await approverGroups[0].removeFormVersion(formVersion);

Test:

public async save(): Promise<ApproverGroup> source

Saves an approverGroup (insert if id doesn't exist, update if it does)

Return:

Promise<ApproverGroup>

Returns a promise via ajax call.

Example:

import { ApproverGroup, clinical6 } from 'clinical6';

// Inserts new approver group (no existing id)
const approverGroup = new ApproverGroup({
  "type": "consent__approver_groups",
  "attributes": {
      "name": "an approver group name"
  }
});
approverGroup.save();

// Updates existing approverGroup(has existing id)
clinical6.get(ApproverGroup).then(capproverGroups => approverGroups[0].save());

Test: