Skip to main content

Utility library for the Student Notes cloud application built on AWS

Project description

notes-utils-nci

A Python utility library for the Student Notes cloud-based application built on AWS. Provides note validation, formatting, search filtering, Redis cache key generation and speech-to-text transcription via AWS Transcribe.

Installation

pip install notes-utils-nci

Classes

NoteValidator

Validates note fields before they are persisted to DynamoDB. Checks title length, body length, category values and tag limits.

from notes_utils import NoteValidator

validator = NoteValidator()
cleaned   = validator.validate_note(
    title    = "My AWS Notes",
    body     = "Today I learned about DynamoDB...",
    category = "study",
    tags     = ["aws", "cloud", "dynamodb"]
)

NoteFormatter

Formats raw DynamoDB note items for consistent API responses. Handles timestamp formatting, tag display and body summarisation.

from notes_utils import NoteFormatter

formatter = NoteFormatter()
print(formatter.format_timestamp("2026-03-25T20:31:42.892879+00:00"))
# Output: 25 Mar 2026, 20:31

print(formatter.generate_summary("This is a very long note body...", max_length=50))

NoteSearch

Filters a list of notes by title keyword, tag or category.

from notes_utils import NoteSearch

search  = NoteSearch()
results = search.search(notes, keyword="aws", category="study")

CacheKeyGenerator

Generates consistent namespaced Redis cache keys for notes data. Centralises key generation to prevent typos and ensure reliable cache invalidation.

from notes_utils import CacheKeyGenerator

keygen = CacheKeyGenerator()
print(keygen.user_notes_key("user-123"))
# Output: notes_app:user:user-123:notes

print(keygen.single_note_key("user-123", "note-456"))
# Output: notes_app:user:user-123:note:note-456

SpeechTranscriber

Converts audio recordings to text using AWS Transcribe. Uploads audio to S3, runs a transcription job, fetches the result and cleans up.

from notes_utils import SpeechTranscriber

transcriber = SpeechTranscriber(
    aws_access_key_id     = "YOUR_KEY",
    aws_secret_access_key = "YOUR_SECRET",
    region                = "eu-west-1",
    bucket_name           = "your-s3-bucket",
)

with open("recording.wav", "rb") as f:
    text = transcriber.transcribe(f.read(), "recording.wav")

print(text)
# Output: "This is a test note about AWS cloud computing"

Requirements

  • Python 3.9+
  • boto3 >= 1.34.0
  • An AWS account with Transcribe and S3 access

License

MIT

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

notes_utils_nci-1.0.5.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

notes_utils_nci-1.0.5-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file notes_utils_nci-1.0.5.tar.gz.

File metadata

  • Download URL: notes_utils_nci-1.0.5.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for notes_utils_nci-1.0.5.tar.gz
Algorithm Hash digest
SHA256 0c5ff886593ee7b39fcbc51f2786f034bbdbc867b966a7afe1a7586a4beb8515
MD5 658fbcc903abb9b40d3f3b26d8f5096d
BLAKE2b-256 d4af27456d64299c650eef288afdb47059a9b1351c105d42e9466253094cff85

See more details on using hashes here.

File details

Details for the file notes_utils_nci-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for notes_utils_nci-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aa55239d90768b68de24609c3e5137ae46191a04b358c092c466d73ff54c7e6e
MD5 8eec1537f786ac0022367c71fc5e9e72
BLAKE2b-256 19ff4ae36e2c32a5133915f5f424ac25e6078ad856b278d49986eb366cc6d362

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