Participant Info

The SDK allows you to obtain basic participant information. See Participants for general information about participant identifiers, custom fields, and other participant data.

Get Participant Info

MyDataHelps.getParticipantInfo()

Retrieve demographic information about the current participant, as well as project-specific custom fields.

Returns

Promise<ParticipantInfo>

Resolves to a result object containing participant info fields.

result.participantIdentifier string

Project-set, unique participant identifier.

result.participantID

Internal, stable, unique ID for the participant.

result.projectID string

The project identifier.

result.secondaryIdentifier string

(DEPRECATED) An alias for a custom field named SecondaryIdentifier, if one exists. See deprecation notice.

result.enrollmentDate date

Date when the participant completed enrollment, in ISO8601 format.

result.linkIdentifier string

Auto-generated identifier used to complete surveys via link, if that feature is enabled for the project.

result.demographics object

Object containing properties for all demographic fields populated for the participant. Unpopulated values are not included.

result.demographics.email string
result.demographics.mobilePhone string
result.demographics.firstName string
result.demographics.middleName string
result.demographics.lastName string
result.demographics.street1 string
result.demographics.street2 string
result.demographics.city string
result.demographics.state string
result.demographics.postalCode string
result.demographics.dateOfBirth string
result.demographics.preferredLanguage string

Preferred language, automatically determined during enrollment. Used to determine language of notifications.

result.demographics.gender string

Gender code: M, F, O, or null.

result.demographics.utcOffset string

Timezone represented as a UTC offset, e.g., -04:00:00.

result.customFields object

Object whose properties represent key/value pairs as project-specific custom fields.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps
Retrieving Participant Info
MyDataHelps.getParticipantInfo()
	.then( function(result) {
		console.log(result);
	} );
MyDataHelps.getParticipantInfo() .then( function(result) { console.log(result); } );
Console Output
{
  "participantIdentifier": "4c9d3554-7cb1-456e-89ca-5387bda4803c",
  "linkIdentifier": "be0ec303-3abd-49ac-a5ce-78c6695d7d96",
  "enrollmentDate": "2021-04-15T18:55:53.766+00:00",
  "projectID": "0971fbcd-ec92-414c-bd49-41a3c8b6547b",
  "demographics": {
    "email": "somebody@example.com",
    "firstName": "John",
    "lastName": "Smith",
    "dateOfBirth": "2000-06-16",
    "preferredLanguage": "en",
    "gender": "M",
    "utcOffset": "-04:00:00"
  },
  "customFields": {
    "Medication1": "Warfarin",
    "Smoker": "0",
    "SurgeryDate": null
  }
}
{ "participantIdentifier": "4c9d3554-7cb1-456e-89ca-5387bda4803c", "linkIdentifier": "be0ec303-3abd-49ac-a5ce-78c6695d7d96", "enrollmentDate": "2021-04-15T18:55:53.766+00:00", "projectID": "0971fbcd-ec92-414c-bd49-41a3c8b6547b", "demographics": { "email": "somebody@example.com", "firstName": "John", "lastName": "Smith", "dateOfBirth": "2000-06-16", "preferredLanguage": "en", "gender": "M", "utcOffset": "-04:00:00" }, "customFields": { "Medication1": "Warfarin", "Smoker": "0", "SurgeryDate": null } }

Persist Participant Info

MyDataHelps.persistParticipantInfo(demographics, customFields)

Updates participant information.

Parameters

demographics

Object containing properties for all demographic fields populated for the participant. Unspecified fields will not be changed.

demographics.email string
demographics.mobilePhone string
demographics.firstName string
demographics.middleName string
demographics.lastName string
demographics.street1 string
demographics.street2 string
demographics.city string
demographics.state string
demographics.postalCode string
demographics.dateOfBirth string
demographics.preferredLanguage string

Preferred language, automatically determined during enrollment. Used to determine language of notifications.

demographics.gender string

Gender code: M, F, O, or null.

demographics.utcOffset string

Timezone represented as a UTC offset, e.g., -04:00:00.

customFields object

Object whose properties represent key/value pairs as project-specific custom fields. Unspecified fields will not be changed.

Returns

Promise<ParticipantInfo>

Resolves to a result object containing participant info fields.

result.participantIdentifier string

Project-set, unique participant identifier.

result.participantID

Internal, stable, unique ID for the participant.

result.projectID string

The project identifier.

result.secondaryIdentifier string

(DEPRECATED) An alias for a custom field named SecondaryIdentifier, if one exists. See deprecation notice.

result.enrollmentDate date

Date when the participant completed enrollment, in ISO8601 format.

result.linkIdentifier string

Auto-generated identifier used to complete surveys via link, if that feature is enabled for the project.

result.demographics object

Object containing properties for all demographic fields populated for the participant. Unpopulated values are not included.

result.demographics.email string
result.demographics.mobilePhone string
result.demographics.firstName string
result.demographics.middleName string
result.demographics.lastName string
result.demographics.street1 string
result.demographics.street2 string
result.demographics.city string
result.demographics.state string
result.demographics.postalCode string
result.demographics.dateOfBirth string
result.demographics.preferredLanguage string

Preferred language, automatically determined during enrollment. Used to determine language of notifications.

result.demographics.gender string

Gender code: M, F, O, or null.

result.demographics.utcOffset string

Timezone represented as a UTC offset, e.g., -04:00:00.

result.customFields object

Object whose properties represent key/value pairs as project-specific custom fields.

Availability

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps
Persist Participant Info
MyDataHelps.persistParticipantInfo(
   { 'firstName': 'Bob' }, 
   { 'Medication1': 'Aspirin' })
.then( function(result) {
  console.log(result);
} );
MyDataHelps.persistParticipantInfo( { 'firstName': 'Bob' }, { 'Medication1': 'Aspirin' }) .then( function(result) { console.log(result); } );
Console Output
{
  "participantIdentifier": "4c9d3554-7cb1-456e-89ca-5387bda4803c",
  ...
  "demographics": {
    "email": "somebody@example.com",
    "firstName": "Bob",
    "lastName": "Smith"
  },
  "customFields": {
    "Medication1": "Aspirin",
    "Smoker": "0",
  }
}
{ "participantIdentifier": "4c9d3554-7cb1-456e-89ca-5387bda4803c", ... "demographics": { "email": "somebody@example.com", "firstName": "Bob", "lastName": "Smith" }, "customFields": { "Medication1": "Aspirin", "Smoker": "0", } }