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.1.tar.gz (7.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: notes_utils_nci-1.0.1.tar.gz
  • Upload date:
  • Size: 7.6 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.1.tar.gz
Algorithm Hash digest
SHA256 1149541c2162dff7256ec45373030559d3ed60d80c68855f595850a480589c88
MD5 0e68c46a5c80d4372aebcf22d2eb3ab0
BLAKE2b-256 4ae9f10ec28279c2e3ddf9cb8524e5586899192fdba371e533209abe424ba969

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