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.2.tar.gz (10.8 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.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tsapiness-0.0.2.tar.gz
  • Upload date:
  • Size: 10.8 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.2.tar.gz
Algorithm Hash digest
SHA256 d42510f7273a896302acb3002dbda7b245b309e36526b961880c77eb447eb46e
MD5 5d6aa0b8b0ea03170137a64cc3b5ac4d
BLAKE2b-256 c675c2a4ee4f337de3c4aef730b45dfebbbcbf8bd8bf7df420f66cc018b4c2b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tsapiness-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 717b4df55a5f0c0b19abfae575487676ab852600394ffcdbdd05fad25e948b77
MD5 2212a6dc67e4d4ae327f6b18dcbbabb0
BLAKE2b-256 dcf5a2991b4503d7a983b748a1a8f96dc90b52538540b9cbe01a4077e9f4e3fc

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