Metadata-Version: 2.4
Name: notes-utils-nci
Version: 1.0.3
Summary: Utility library for the Student Notes cloud application built on AWS
Home-page: https://github.com/chiibuzor/students_notes_app
Author: Chibuzor Duru
Author-email: duruchibuzor2015@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: boto3>=1.34.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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

```bash
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.

```python
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.

```python
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.

```python
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.

```python
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.

```python
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
