Skip to main content

An open source python package to connect survey data to the survey definition defined by tsapi

Project description

tsapiness

tsapiness (pronounced "zappiness") aims to make the TSAPI easy to access via Python.

Currently, the project provides a python representation of the TSAPI so that the data can be manipulated accordingly. More details on TSAPI can be found here. https://www.tsapi.net/

These are early days for the project, in this early version you can:

  • convert an SPSS sav file to tsapi format
  • convert a triple-s file to tsapi format
  • read tsapi from a webserver

Future development intends to:

  • convert other survey platform APIs to the tsapi format
  • provide tools for converting flat tsapi structures that occur when importing from sav or triple-s into the more native hierarchical tsapi structure
  • provide full documentation on how to use tsapiness effectively.

A simple implementation is below...



import tsapiness as ts
import json

# Create tsapi object from TSAPI demo server

SERVER = 'https://tsapi-demo.azurewebsites.net'
conn = ts.connector_tsapi.Connection(server=SERVER)
surveys = ts.connector_tsapi.Surveys(connection=conn)
survey_id = surveys[0]['id']
survey_from_api = ts.connector_tsapi.Survey(survey_id=survey_id, connection=conn)

# create tsapi from triple s file:

sss_file = '../data/example.sss'
asc_file = '../data/example.asc'

conn = ts.connector_sss.Connection(sss_file=sss_file, asc_file=asc_file)
survey_from_sss = ts.connector_sss.Survey(connection=conn)

# save back to json
with open('../data/data.json', 'w', encoding='utf8') as f:
    json.dump(survey_from_sss.metadata.survey.to_tsapi(),
              f,
              indent=4,
              ensure_ascii=False)

# create tsapi from sav file

# source:
# https://www.pewresearch.org/global/dataset/2014-spring-global-attitudes/

sav_file = '../data/Pew Global Attitudes Spring 2014.sav'
conn = ts.connector_sav.Connection(sav_file=sav_file)
survey_from_sav = ts.connector_sav.Survey(connection=conn)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsapiness-0.0.3.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsapiness-0.0.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file tsapiness-0.0.3.tar.gz.

File metadata

  • Download URL: tsapiness-0.0.3.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for tsapiness-0.0.3.tar.gz
Algorithm Hash digest
SHA256 64a9e65493f999d3491461a4d139aafe9041c064758e0a35ec7cb32fba3b092d
MD5 d3a921a995460a6559f815ea245a0138
BLAKE2b-256 5e58d1de26053476e5e8fe1b21adcae26a7296f79b398232a4d60230b2fb81fe

See more details on using hashes here.

File details

Details for the file tsapiness-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tsapiness-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for tsapiness-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 24d9e834f766cf43d93e3a42a41d49d7f8c5790a77962904a2fd494aee4f54d5
MD5 13c118503e696b6cd6b5040472daa34e
BLAKE2b-256 dc87c82855e0b73cc34aca3e539c203a9060d7000f5078ddfd4af16d10384fc8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page