sociomemory 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. sociomemory-0.2.0/.github/workflows/ci.yml +36 -0
  2. sociomemory-0.2.0/.gitignore +34 -0
  3. sociomemory-0.2.0/CHANGELOG.md +49 -0
  4. sociomemory-0.2.0/LICENSE +21 -0
  5. sociomemory-0.2.0/PKG-INFO +726 -0
  6. sociomemory-0.2.0/README.md +643 -0
  7. sociomemory-0.2.0/pyproject.toml +122 -0
  8. sociomemory-0.2.0/sociomemory/__init__.py +442 -0
  9. sociomemory-0.2.0/sociomemory/config.py +49 -0
  10. sociomemory-0.2.0/sociomemory/data/amenity_categories.json +10 -0
  11. sociomemory-0.2.0/sociomemory/data/cultural_regions.json +18 -0
  12. sociomemory-0.2.0/sociomemory/data/india_cities.json +32 -0
  13. sociomemory-0.2.0/sociomemory/data/india_real_estate.json +22 -0
  14. sociomemory-0.2.0/sociomemory/data/school_boards.json +20 -0
  15. sociomemory-0.2.0/sociomemory/engine/__init__.py +0 -0
  16. sociomemory-0.2.0/sociomemory/engine/behavioral.py +135 -0
  17. sociomemory-0.2.0/sociomemory/engine/episodes.py +218 -0
  18. sociomemory-0.2.0/sociomemory/engine/income.py +119 -0
  19. sociomemory-0.2.0/sociomemory/engine/scorer.py +52 -0
  20. sociomemory-0.2.0/sociomemory/engine/temporal.py +91 -0
  21. sociomemory-0.2.0/sociomemory/engine/tradeoff.py +85 -0
  22. sociomemory-0.2.0/sociomemory/engine/versioning.py +66 -0
  23. sociomemory-0.2.0/sociomemory/graph/__init__.py +0 -0
  24. sociomemory-0.2.0/sociomemory/graph/builder.py +437 -0
  25. sociomemory-0.2.0/sociomemory/graph/cypher.py +299 -0
  26. sociomemory-0.2.0/sociomemory/graph/edges.py +69 -0
  27. sociomemory-0.2.0/sociomemory/graph/memory_graph.py +320 -0
  28. sociomemory-0.2.0/sociomemory/graph/nodes.py +127 -0
  29. sociomemory-0.2.0/sociomemory/graph/reasoner.py +137 -0
  30. sociomemory-0.2.0/sociomemory/graph/schema.py +52 -0
  31. sociomemory-0.2.0/sociomemory/llm/__init__.py +0 -0
  32. sociomemory-0.2.0/sociomemory/llm/base.py +12 -0
  33. sociomemory-0.2.0/sociomemory/llm/factory.py +35 -0
  34. sociomemory-0.2.0/sociomemory/llm/gemini.py +51 -0
  35. sociomemory-0.2.0/sociomemory/llm/local.py +58 -0
  36. sociomemory-0.2.0/sociomemory/llm/openai.py +75 -0
  37. sociomemory-0.2.0/sociomemory/llm/openrouter.py +80 -0
  38. sociomemory-0.2.0/sociomemory/models/__init__.py +0 -0
  39. sociomemory-0.2.0/sociomemory/models/coaching.py +41 -0
  40. sociomemory-0.2.0/sociomemory/models/profile.py +83 -0
  41. sociomemory-0.2.0/sociomemory/models/signals.py +52 -0
  42. sociomemory-0.2.0/sociomemory/pipeline/__init__.py +0 -0
  43. sociomemory-0.2.0/sociomemory/pipeline/enricher.py +33 -0
  44. sociomemory-0.2.0/sociomemory/pipeline/extractor.py +251 -0
  45. sociomemory-0.2.0/sociomemory/pipeline/implicator.py +140 -0
  46. sociomemory-0.2.0/sociomemory/pipeline/ner.py +119 -0
  47. sociomemory-0.2.0/sociomemory/privacy/__init__.py +0 -0
  48. sociomemory-0.2.0/sociomemory/privacy/anonymizer.py +30 -0
  49. sociomemory-0.2.0/sociomemory/privacy/api.py +81 -0
  50. sociomemory-0.2.0/sociomemory/privacy/boundaries.py +56 -0
  51. sociomemory-0.2.0/sociomemory/privacy/consent.py +67 -0
  52. sociomemory-0.2.0/sociomemory/providers/__init__.py +0 -0
  53. sociomemory-0.2.0/sociomemory/providers/base.py +20 -0
  54. sociomemory-0.2.0/sociomemory/providers/exa.py +255 -0
  55. sociomemory-0.2.0/sociomemory/providers/factory.py +58 -0
  56. sociomemory-0.2.0/sociomemory/providers/geocode.py +170 -0
  57. sociomemory-0.2.0/sociomemory/providers/offline.py +189 -0
  58. sociomemory-0.2.0/sociomemory/providers/place.py +224 -0
  59. sociomemory-0.2.0/sociomemory/py.typed +0 -0
  60. sociomemory-0.2.0/sociomemory/storage/__init__.py +3 -0
  61. sociomemory-0.2.0/sociomemory/storage/cache.py +58 -0
  62. sociomemory-0.2.0/sociomemory/storage/graph_backend.py +106 -0
  63. sociomemory-0.2.0/sociomemory/storage/keyword.py +111 -0
  64. sociomemory-0.2.0/sociomemory/storage/neo4j_backend.py +371 -0
  65. sociomemory-0.2.0/sociomemory/storage/paths.py +14 -0
  66. sociomemory-0.2.0/sociomemory/storage/vector.py +113 -0
  67. sociomemory-0.2.0/sociomemory/time.py +15 -0
  68. sociomemory-0.2.0/tests/test_behavioral.py +90 -0
  69. sociomemory-0.2.0/tests/test_configuration.py +79 -0
  70. sociomemory-0.2.0/tests/test_cypher_queries.py +46 -0
  71. sociomemory-0.2.0/tests/test_episode_segmenter.py +118 -0
  72. sociomemory-0.2.0/tests/test_extractor.py +219 -0
  73. sociomemory-0.2.0/tests/test_geocode.py +69 -0
  74. sociomemory-0.2.0/tests/test_income.py +87 -0
  75. sociomemory-0.2.0/tests/test_keyword_index.py +34 -0
  76. sociomemory-0.2.0/tests/test_memory_graph.py +152 -0
  77. sociomemory-0.2.0/tests/test_neo4j_backend.py +70 -0
  78. sociomemory-0.2.0/tests/test_ner.py +41 -0
  79. sociomemory-0.2.0/tests/test_openrouter_llm.py +52 -0
  80. sociomemory-0.2.0/tests/test_privacy.py +89 -0
  81. sociomemory-0.2.0/uv.lock +2536 -0
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ quality:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ python-version: ["3.11", "3.12"]
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: ${{ matrix.python-version }}
18
+ cache: pip
19
+ - run: python -m pip install --upgrade pip
20
+ - run: python -m pip install -e ".[dev]"
21
+ - run: ruff check .
22
+ - run: ruff format --check .
23
+ - run: mypy sociomemory
24
+ - run: pytest -m "not integration and not network" --cov=sociomemory --cov-report=term-missing --cov-fail-under=45
25
+
26
+ package:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.11"
33
+ - run: python -m pip install --upgrade build
34
+ - run: python -m build
35
+ - run: python -m pip install dist/*.whl
36
+ - run: python -c "import sociomemory; print(sociomemory.__version__)"
@@ -0,0 +1,34 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.pyo
4
+ .venv/
5
+ venv/
6
+ node_modules/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .pytest_cache/
11
+ .coverage
12
+ .ruff_cache/
13
+ *.faiss
14
+ *.map.json
15
+ *.bm25.json
16
+ ~/.sociomemory/
17
+ .env
18
+ .env.local
19
+ *.db
20
+ .DS_Store
21
+ *.log
22
+ *.bak
23
+ *.tmp
24
+ *.swp
25
+ *.swo
26
+ .idea/
27
+ .vscode/
28
+ .claude/
29
+ /docs/
30
+ # not part of the pip package
31
+ sociomemory/dashboard/
32
+ tests/test_dashboard_export.py
33
+ CLAUDE.md
34
+ AGENTS.md
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to `sociomemory` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-07-08
11
+
12
+ ### Added
13
+ - spaCy entity pre-pass and LLM-typed signal extraction replacing the regex extractor,
14
+ with graceful degradation when spaCy or an LLM backend is unavailable (`nlp` extra).
15
+ - Consent-scope mappings for housing, dietary, language, transport, family-structure,
16
+ sensory, lifestyle, and generic signals.
17
+ - `NodeType.CIVIC` as an allowed target of `NEIGHBORHOOD --HAS_CONTEXT-->` in the graph schema.
18
+ - `ECONOMIC --DERIVES--> INCOME` edge in the graph schema.
19
+ - BM25 keyword recall with persistent per-child indexes and FAISS-free fallback behavior.
20
+ - Optional fail-closed consent enforcement and consent-gated full data exports.
21
+ - Python 3.11/3.12 CI for linting, tests, coverage, and wheel installation.
22
+
23
+ ### Changed
24
+ - Split LLM/provider construction and privacy operations out of the public client module.
25
+ - Moved provider SDKs, FAISS, and geospatial dependencies into explicit package extras.
26
+ - Normalized model timestamps to timezone-aware UTC values.
27
+ - Consolidated tests under the top-level `tests/` directory.
28
+ - Removed decorative and implementation-narrating comments from the Python sources.
29
+
30
+ ### Fixed
31
+ - Prevented child identifiers from escaping local index directories.
32
+ - Erasure now evicts in-memory indexes and removes BM25 data in addition to FAISS data.
33
+ - Dynamic Cypher relationship names and traversal depths are validated before interpolation.
34
+ - `enrichment_cache_ttl_hours` is now honored by online providers.
35
+
36
+ ## [0.1.0] - 2026-05-16
37
+
38
+ Initial alpha release of the graph memory engine for social context inference.
39
+
40
+ ### Added
41
+ - `MemoryGraph` engine with Neo4j-backed graph storage and FAISS vector index.
42
+ - Signal extraction, enrichment, and coaching-implication pipeline
43
+ (`SignalExtractor`, `EnrichmentPipeline`, `CoachingImplicator`).
44
+ - Domain models: `SocioProfile`, `IncomeEstimate`, `CoachingImplication`, `TradeOff`.
45
+ - Privacy layer: `ConsentManager`, `ConsentScope`, GDPR-style erase/export APIs.
46
+ - LLM provider abstractions for Gemini, OpenAI, and local backends.
47
+ - Online/offline data providers (Exa optional via `online` extra).
48
+ - India-focused reference data: cities, real-estate tiers, school boards, cultural regions, amenity categories.
49
+ - Optional extras: `online` (Exa), `geo` (geopandas/shapely), `dev` (pytest, ruff, testcontainers).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Piyush Aryan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.