An open source python package to connect survey data to the survey definition defined by tsapi
Project description
TSAPI-py
The TSAPI-py 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 but the aim is to create a PYPI package that other applications can rely on.
A simple implementation is below...
import tsapi 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsapiness-0.0.1.tar.gz.
File metadata
- Download URL: tsapiness-0.0.1.tar.gz
- Upload date:
- Size: 21.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e344499f9937e4875470381f92f7992413dd62ab8bb4150b99db2f529844f9db
|
|
| MD5 |
b49418199da67dc49869b768b8f9490e
|
|
| BLAKE2b-256 |
4512b235caa789690a1899837b663677c7504beebcca4d31faff623f3ea9754d
|
File details
Details for the file tsapiness-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tsapiness-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa81816af7a47aef60b9f3d0d372c0c293cd948c91cf086e0e4445386a7d8db9
|
|
| MD5 |
06b7e7d4b3eb81bca8f68a46e91391c5
|
|
| BLAKE2b-256 |
8c7dd584aef91b6c0eec32b9cb97f1d107896b2d3d8a4471c77d8ea1c07a07aa
|