triple-s
A parser for reading parsing Triple-S datamap files (.sss), backend by rust via PyO3 and maturin.
Most of the core functions are completed, there are some imporvement coming in the future.
Documentations:
Rust: docs.rs
Python: readthedocs.org (under construction, more informative documentation coming soon)
Rust
Add the crate to your project:
cargo add triple_s
More detailed documentations can be foud in docs.rs
Python
Python API mirrors that of Rusts', with some minor tweaks to accomdate python's typing system.
Getting started
Install with:
pip install triple-s-survey
Read a datamap
from triple_s import read_datamap
datamap = read_datamap("path/to/datamap.sss")
print(datamap.title)
Accessing contents within a datamap:
# Lookup by question name, case insensitive
print(datamap["Q1"].label)
print(datamap['q1'].label) # this will also do
Edit the loaded datamap:
datamap["q1"].title = "New title"
question = datamap["Q1"]
question.text = "Updated question text"
Datamap can be iterated:
for question in datamap:
print(question.name)
Load triple-s data file
Read .asc data file:
from triple_s import read_datamap
datamap = read_datamap("path/to/datamap.sss")
datamap.load_data("path/to/data.asc")
For CSV data, use a datamap with <record format="csv"> and call
datamap.load_data("path/to/data.csv"). Each question's position start
is its one-based CSV field number. Set skip="1" on the record to skip a
header, or another non-negative number to skip that many initial records.
Quoted commas, escaped quotes, and multiline text fields are supported.
...And export to polars dataframe
df = datamap.to_polars()
Exporting
Export instance to sss classic (sss 1.1):
string = datamap.to_classic()
print(string)
Alternatively, insead of the entire datamap, you can also export individual datamap components (i.e., individual questions, question response, data location) as well:
question_string = datamap.record[3].to_classic()
print(question_string)
Development
Install the Python development dependencies and build the extension with:
maturin develop
Run the Rust tests with:
cargo test
AI usage
I handwrote majorities of the code with some very minor support of ai,
mostly on writing biolerplate getter & setters, the basic html of python's documentation page,
and some routine code realted with text parsing in src/classic.rs. Also, I used AI to evaluate some of the edge cases
that I missed.
Everything else, including the source code, the documentation, api interface, example usage etc., are written by myself. If any error/ typo feel free to pull request.
License
MIT license
Metadata
Release files for triple-s-survey 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| triple_s_survey-0.2.6.tar.gz | 118.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| triple_s_survey-0.2.6-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
Total release size: 4.2 MB
Release files / triple_s_survey-0.2.6.tar.gz
| Download URL | triple_s_survey-0.2.6.tar.gz |
|---|---|
| Size | 118.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9987c3b64d7beece26e4183e7c883a65955935e02664550c5fd782ac65b4b03
|
|
BLAKE2b-256 checksum How to use checksums |
732dd06f0b43ff58218f1e6aacb6bae51b693269d7c09d27f15ba3c63742c1a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / triple_s_survey-0.2.6-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | triple_s_survey-0.2.6-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
db70496b4e334b0284d0b2d369a8b049311e7681e78b3b67d7d20848eb0b63a4
|
|
BLAKE2b-256 checksum How to use checksums |
124f5768f35ab78df082522a9921adf10b3d9a341476b405d77aaccf64c7601a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for triple-s-survey 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.