How to retrieve the T-score interpretation through the API

Syntax

  • http://acapi.kgvp.org//2021-10/Interpretation/{FormOID} - returns the specified interpretation ranges and labels as an html page
  • http://acapi.kgvp.org//2021-10/Interpretation/{FormOID}.xml - returns the specified interpretation ranges and labels in xml format
  • http://acapi.kgvp.org//2021-10/Interpretation/{FormOID}.json - returns the specified interpretation ranges and labels in json format

API Home

Try it!

Sample code for http://acapi.kgvp.org//2021-10/Interpretation

  • Javascript
  • C#
  • JSON Formatted Response
  • XML Formatted Response
<script langauge="javascript" src="jquery-1.7.1.min.js"></script>
<script language="javascript" src="crypto.js"></script>
<script type='text/javascript' version='1.3'>

var Server = http://acapi.kgvp.org/;
var FormOID = "96FE494D-F176-4EFB-A473-2AB406610626";   // PROMIS Bank v1.0 - Depression

function displayInterpretation(FormOID) {
    $.ajax({
        url: Server + "/2021-10/Interpretation/" + FormOID + ".json",
        cache: false,
        type: "POST",
        data: "",
        dataType: "json",

        beforeSend: function(xhr) {
            var reg = document.getElementById("txtRegistration").value;
            var token = document.getElementById("txtToken").value;
            var bytes = Crypto.charenc.Binary.stringToBytes(reg + ":" + token);
            var base64 = Crypto.util.bytesToBase64(bytes);
            xhr.setRequestHeader("Authorization", "Basic " + base64);
        },

        success: function(data) { 
	var container = document.getElementById("Content");

	for(var k= container.childNodes.length - 1 ; k > -1; k--){
		container.removeChild(container.childNodes[k])
	} 

	var _divDirection = document.createElement("div");
	_divDirection.appendChild(document.createTextNode(data.Interpretations[0].direction));
	container.appendChild(_divDirection);

	for(var i= 0; i < data.Interpretations.length; i++){
		var _div = document.createElement("div");
		_div.appendChild(document.createTextNode(data.Interpretations[i].label + ": range (" + data.Interpretations[i].low_score + " - " +  data.Interpretations[i].high_score  + ")"));
		container.appendChild(_div);
	}  

        },
	
        error: function(jqXHR, textStatus, errorThrown) {
            alert('displayInterpretation:' + jqXHR.responseText + ':' + textStatus + ':' + errorThrown);
        }
    })
}
                                
Based on twillio example to call RESTful services. (http://www.twilio.com/docs/api/rest)
using System;
using System.Collections;
using System.Configuration;
using System.IO;
using System.Net;
using System.Web;
using System.Text;
using System.Text.RegularExpressions;

public class TestHarness
{
    static void Main(string[] args)
    {
	string REGISTRATIONID ="31839849-ECE0-4F5E-BEAE-3D655ED65E31";      // Sample registration -- replace with your RegistrationOID
	string TOKEN ="F3738486-5A7D-41EF-8044-DCBAF800E2D4";               // Sample token -- replace with your TokenOID
	string FormOID = "96FE494D-F176-4EFB-A473-2AB406610626";      // PROMIS Bank v1.0 - Depression
	string API_URL =  "http://acapi.kgvp.org//2021-10/Interpretation/" + FormOID + ".xml";

	string authstring = Convert.ToBase64String(Encoding.ASCII.GetBytes(String.Format("{0}:{1}", REGISTRATIONID, TOKEN)));
	ServicePointManager.Expect100Continue = false;
	ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;      
	Byte[] postbytes = Encoding.ASCII.GetBytes(string.Empty);
	WebClient client = new WebClient();
	client.Headers.Add("Authorization", String.Format("Basic {0}", authstring)); 
	client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");    
	byte[] resp = client.UploadData(API_URL, "post", postbytes);
	Console.WriteLine(Encoding.ASCII.GetString(resp));
    }
}
                                
// Requesting the T-score interpretation for PROMIS Bank v1.0 - Depression
Request:http://acapi.kgvp.org//2021-10/Interpretation/96FE494D-F176-4EFB-A473-2AB406610626.json

Response:
{
    "Interpretations": [
        {
            "direction": "Lower is better",
            "low_score": "10",
            "high_score": "55",
            "label": "within normal limits",
            "order": "1",
            "version": "1"
        },
        {
            "direction": "Lower is better",
            "low_score": "56",
            "high_score": "60",
            "label": "mild",
            "order": "2",
            "version": "1"
        },
        {
            "direction": "Lower is better",
            "low_score": "61",
            "high_score": "70",
            "label": "moderate",
            "order": "3",
            "version": "1"
        },
        {
            "direction": "Lower is better",
            "low_score": "71",
            "high_score": "90",
            "label": "severe",
            "order": "4",
            "version": "1"
        }
    ]
}
                                
// Requesting the T-score interpretation for PROMIS Bank v1.0 - Depression
Request:http://acapi.kgvp.org//2021-10/Interpretation/96FE494D-F176-4EFB-A473-2AB406610626.xml

Response:
<Interpretations>
	<Interpretation Direction="Lower is better" Low_score="10" High_score="55" Label="within normal limits" Order="1" Version="1" />
	<Interpretation Direction="Lower is better" Low_score="56" High_score="60" Label="mild" Order="2" Version="1" />
	<Interpretation Direction="Lower is better" Low_score="61" High_score="70" Label="moderate" Order="3" Version="1" />
	<Interpretation Direction="Lower is better" Low_score="71" High_score="90" Label="severe" Order="4" Version="1" />
</Interpretations>