Shape Data Integration

This script integrates Touchpoint with this product: http://www.pointsnorthsys.com/web/SHAPE

It is a Giftedness Assessment System. From their web site:

This web-based application is designed for churches to assess the gifts, talents, and interests of its membership. S.H.A.P.E. allows for individuals to register online and take 5 online assessments covering areas of spiritual gifts, heart passions, abilities & skills, personality, and experience. After completing the assessments, the individual will be able to view their results and print them out.

This Python script can be run manually, or put into the Morning Batch service by adding the line…

model.CallScript("UpdateShapeData")

To Install

  1. Establish an account with Points North Systems.

  2. Install the Python script (below) called UpdateShapeData. You will modify the API, user_token and password to what is provided you by Points North Systems. You can add this file to MorningBatch.

  3. Install the SQL script (below) called PeopleWithShapeData. No changes to this script are needed.

Once all that is in place, you can send your people to the Points North Systems site to take the test. Then it will automatically populate TouchPoint whenever this script runs.

There will be an ExtraValue called ShapeData on the records of people who have taken the test. It is an adhoc value. You can click the Attributes link next to that Extra Value and it will show a report for that person.

Caution

You should leave the ShapeData extra value as an adhoc value. Making it a standard extra value will break the function of the link and you will be unable to access the record from a person’s profile.

You can also run the PeopleWithShapeData SQL report and see everybody with their attributes. Click the link on any one person to go directly to their report.

Important

The report will run on the people records in the current context. For example, if you are viewing an organization, the report will list only people in that organization who have taken the assessment. If you wish to find all people in your database who have ShapeData, you must run the report while displaying a full list of people records in the database.

With SearchBuilder, you can also use a Condition called PeopleExtraAttr to select people who have one or more specific attributes from a dropdown.

Tip

The PeopleExtraAttr condition can be found in Search Builder under the Extra Value category. There it is called Extra Value Code: Select the Extra Value Attr from the list.

UpdateShapeData Python Script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Roles=Edit

# change the SHAPE_API part to the one that PointsNorthSys gives you
# also change the user_token and password they give you.
url = 'http://shape.pointsnorthsys.com/SHAPE_API/api/Rest/Get?lastUpdated={}'
headers = {
    "user_token": 'YOUR USER TOKEN FROM POINTSNORTHSYS',
    "password": 'YOUR PASSWORD FROM POINTSNORTHSYS',
    "content-type": 'application/json'
}

lastdate = model.FormatDate(model.ParseDate(model.Setting("ShapeDataLastDate", "2/1/17")))
url2 = url.format(lastdate)
model.SetSetting("ShapeDataLastDate", model.DateTime)

s = model.RestGet(url2, headers)
o = model.JsonDeserialize(s)

print '<pre>'
print url2

for m in o.members:
    pid = model.FindAddPeopleId(m.firstName, m.lastName, m.birthdate, m.emailAddress, m.phone)
    attr = str(m.attributes)
    print pid
    model.AddExtraValueAttributes(pid, "ShapeData", attr)
print '</pre>'

PeopleWithShapeData SQL Script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT 
    linkfornext = '/Person/Attributes/ShapeData/' + CONVERT(VARCHAR, p.PeopleId) 
    , p.Name2
    , Attribute = a.name
    , Value = a.value
FROM dbo.Attributes a
JOIN dbo.People p ON p.PeopleId = a.PeopleId
JOIN dbo.TagPerson tp ON tp.PeopleId = p.PeopleId AND tp.Id = @qtagid
WHERE Field = 'ShapeData'
ORDER BY p.Name2, Attribute, Value