spr migrated books, and tester

This commit is contained in:
buenosairesam
2025-12-31 09:07:27 -03:00
parent 21b8eab3cb
commit cccc6b5a93
136 changed files with 15763 additions and 472 deletions

156
data/__init__.py Normal file
View File

@@ -0,0 +1,156 @@
"""
Pawprint Data Layer
JSON file storage (future: MongoDB)
"""
import json
from pathlib import Path
from typing import List, Optional
# Add parent to path for models import
import sys
sys.path.insert(0, str(Path(__file__).parent.parent))
from models.pydantic import (
Vein, Nest, Larder, Template, Tool,
Pulse, Book, Table,
VeinCollection, NestCollection, LarderCollection,
TemplateCollection, ToolCollection,
PulseCollection, BookCollection, TableCollection,
Status
)
DATA_DIR = Path(__file__).parent.resolve()
# Debug: print data dir on import
print(f"[data] DATA_DIR: {DATA_DIR}")
print(f"[data] DATA_DIR exists: {DATA_DIR.exists()}")
print(f"[data] veins.json exists: {(DATA_DIR / 'veins.json').exists()}")
def _load_json(filename: str) -> dict:
filepath = DATA_DIR / filename
if filepath.exists():
with open(filepath) as f:
data = json.load(f)
print(f"[data] Loaded {filename}: {len(data.get('items', []))} items")
return data
print(f"[data] File not found: {filepath}")
return {"items": []}
def _save_json(filename: str, data: dict):
filepath = DATA_DIR / filename
with open(filepath, 'w') as f:
json.dump(data, f, indent=2)
# === Loaders ===
def get_veins() -> List[Vein]:
data = _load_json("veins.json")
return VeinCollection(**data).items
def get_nests() -> List[Nest]:
data = _load_json("nests.json")
return NestCollection(**data).items
def get_larders() -> List[Larder]:
data = _load_json("larders.json")
return LarderCollection(**data).items
def get_templates() -> List[Template]:
data = _load_json("templates.json")
return TemplateCollection(**data).items
def get_tools() -> List[Tool]:
data = _load_json("tools.json")
return ToolCollection(**data).items
def get_cabinets() -> list:
"""Load cabinets (simple dict, no pydantic yet)."""
data = _load_json("cabinets.json")
return data.get("items", [])
def get_monitors() -> list:
"""Load monitors (simple dict, no pydantic yet)."""
data = _load_json("monitors.json")
return data.get("items", [])
def get_pulses() -> List[Pulse]:
data = _load_json("pulses.json")
return PulseCollection(**data).items
def get_books() -> List[Book]:
data = _load_json("books.json")
return BookCollection(**data).items
def get_tables() -> List[Table]:
data = _load_json("tables.json")
return TableCollection(**data).items
# === Helpers ===
def get_vein(name: str) -> Optional[Vein]:
for v in get_veins():
if v.name == name:
return v
return None
def get_nest(name: str) -> Optional[Nest]:
for n in get_nests():
if n.name == name:
return n
return None
def get_larder(name: str) -> Optional[Larder]:
for l in get_larders():
if l.name == name:
return l
return None
# === For frontend rendering ===
def get_artery_data() -> dict:
"""Data for artery frontend."""
return {
"veins": [v.model_dump() for v in get_veins()],
"nests": [n.model_dump() for n in get_nests()],
"larders": [l.model_dump() for l in get_larders()],
"pulses": [p.model_dump() for p in get_pulses()],
}
def get_album_data() -> dict:
"""Data for album frontend."""
return {
"templates": [t.model_dump() for t in get_templates()],
"larders": [l.model_dump() for l in get_larders()],
"books": [b.model_dump() for b in get_books()],
}
def get_ward_data() -> dict:
"""Data for ward frontend."""
return {
"tools": [t.model_dump() for t in get_tools()],
"monitors": get_monitors(),
"cabinets": get_cabinets(),
"nests": [n.model_dump() for n in get_nests()],
"larders": [l.model_dump() for l in get_larders()],
"tables": [t.model_dump() for t in get_tables()],
}

View File

@@ -6,16 +6,16 @@
"title": "Architecture Model",
"status": "ready",
"template": null,
"depot": {
"larder": {
"name": "arch-model",
"slug": "arch-model",
"title": "Architecture Model",
"status": "ready",
"source_template": null,
"data_path": "atlas/book/arch-model"
"data_path": "album/book/arch-model"
},
"output_depot": null,
"system": "atlas"
"output_larder": null,
"system": "album"
},
{
"name": "feature-flow",
@@ -23,16 +23,16 @@
"title": "Feature Flow Pipeline",
"status": "ready",
"template": null,
"depot": {
"larder": {
"name": "feature-flow",
"slug": "feature-flow",
"title": "Feature Flow Pipeline",
"status": "ready",
"source_template": null,
"data_path": "atlas/book/feature-flow"
"data_path": "album/book/feature-flow"
},
"output_depot": null,
"system": "atlas"
"output_larder": null,
"system": "album"
},
{
"name": "gherkin-samples",
@@ -40,16 +40,16 @@
"title": "Gherkin Samples",
"status": "ready",
"template": null,
"depot": {
"larder": {
"name": "gherkin-samples",
"slug": "gherkin-samples",
"title": "Gherkin Samples",
"status": "ready",
"source_template": null,
"data_path": "atlas/book/gherkin-samples"
"data_path": "album/book/gherkin-samples"
},
"output_depot": null,
"system": "atlas"
"output_larder": null,
"system": "album"
},
{
"name": "feature-form-samples",
@@ -61,19 +61,19 @@
"slug": "feature-form",
"title": "Feature Form Template",
"status": "ready",
"template_path": "atlas/template/feature-form",
"system": "atlas"
"template_path": "album/template/feature-form",
"system": "album"
},
"depot": {
"larder": {
"name": "feature-form",
"slug": "feature-form",
"title": "Feature Forms",
"status": "ready",
"source_template": "feature-form",
"data_path": "atlas/book/feature-form-samples/feature-form"
"data_path": "album/book/feature-form-samples/feature-form"
},
"output_depot": null,
"system": "atlas"
"output_larder": null,
"system": "album"
}
]
}

View File

@@ -6,7 +6,7 @@
"title": "Feature Forms",
"status": "ready",
"source_template": "feature-form",
"data_path": "atlas/book/feature-form-samples/feature-form"
"data_path": "album/book/feature-form-samples/feature-form"
}
]
}

View File

@@ -5,18 +5,18 @@
"slug": "turnos",
"title": "Turnos Monitor",
"status": "dev",
"system": "station",
"system": "ward",
"description": "Pipeline view of requests → turnos. Shows vet-petowner at a glance.",
"path": "station/monitor/turnos"
"path": "ward/monitor/turnos"
},
{
"name": "data_browse",
"slug": "data-browse",
"title": "Data Browse",
"status": "ready",
"system": "station",
"description": "Quick navigation to test users and data states. Book/depot pattern with SQL mode for manual testing workflows.",
"path": "station/monitor/data_browse"
"system": "ward",
"description": "Quick navigation to test users and data states. Book/larder pattern with SQL mode for manual testing workflows.",
"path": "ward/monitor/data_browse"
}
]
}

View File

@@ -1,11 +1,5 @@
{
"items": [
{
"name": "soleprint-local",
"slug": "soleprint-local",
"title": "Soleprint Local",
"status": "dev",
"config_path": "mainroom/soleprint"
}
{"name": "pawprint-local", "slug": "pawprint-local", "title": "Pawprint Local", "status": "dev", "config_path": "deploy/pawprint-local"}
]
}

View File

@@ -0,0 +1,38 @@
# {{nombre_flujo}}
## Tipo de usuario
{{tipo_usuario}}
## Donde empieza
{{punto_entrada}}
## Que quiere hacer el usuario
{{objetivo}}
## Pasos
1. {{paso_1}}
2. {{paso_2}}
3. {{paso_3}}
## Que deberia pasar
- {{resultado_1}}
- {{resultado_2}}
## Problemas comunes
- {{problema_1}}
- {{problema_2}}
## Casos especiales
- {{caso_especial_1}}
## Flujos relacionados
- {{flujo_relacionado_1}}
## Notas tecnicas
- {{nota_tecnica_1}}

View File

@@ -6,7 +6,7 @@
"title": "Feature Form Template",
"status": "ready",
"template_path": "data/template/feature-form",
"system": "atlas"
"system": "album"
}
]
}

View File

@@ -5,10 +5,10 @@
"slug": "tester",
"title": "Contract Tests",
"status": "live",
"system": "station",
"system": "ward",
"type": "app",
"description": "HTTP contract test runner with multi-environment support. Filter, run, and track tests against dev/stage/prod.",
"path": "station/tools/tester",
"path": "ward/tools/tester",
"url": "/tools/tester/"
},
{
@@ -16,22 +16,33 @@
"slug": "datagen",
"title": "Test Data Generator",
"status": "live",
"system": "station",
"system": "ward",
"type": "cli",
"description": "Generate realistic test data for Amar domain (users, pets, services) and MercadoPago API responses. Used by mock veins and test seeders.",
"path": "station/tools/datagen",
"path": "ward/tools/datagen",
"cli": "python -m datagen"
},
{
"name": "generate_test_data",
"slug": "generate-test-data",
"title": "DB Test Data Extractor",
"status": "dev",
"system": "ward",
"type": "cli",
"description": "Extract representative subsets from PostgreSQL dumps for testing/development.",
"path": "ward/tools/generate_test_data",
"cli": "python -m generate_test_data"
},
{
"name": "modelgen",
"slug": "modelgen",
"title": "Model Generator",
"status": "live",
"system": "station",
"status": "dev",
"system": "ward",
"type": "cli",
"description": "Generic model generation tool. Generates typed models (Pydantic, etc.) from config files, JSON Schema, or by extracting from existing codebases (Django, SQLAlchemy). Used by build.py and databrowse.",
"path": "station/tools/modelgen",
"cli": "python -m station.tools.modelgen"
"description": "Generate platform-specific models (Pydantic, Django, Prisma) from JSON Schema.",
"path": "ward/tools/modelgen",
"cli": "python -m modelgen"
}
]
}

View File

@@ -1,11 +1,11 @@
{
"items": [
{"name": "jira", "slug": "jira", "title": "Jira", "status": "live", "system": "artery"},
{"name": "amar", "slug": "amar", "title": "Amar (Mock)", "status": "ready", "system": "artery", "description": "Mock Amar API for testing turnero flow without hitting real backend"},
{"name": "mercadopago", "slug": "mercadopago", "title": "MercadoPago (Mock)", "status": "ready", "system": "artery", "description": "Mock MercadoPago API for payment integration testing"},
{"name": "slack", "slug": "slack", "title": "Slack", "status": "building", "system": "artery"},
{"name": "amar", "slug": "amar", "title": "Amar API", "status": "ready", "system": "artery", "mock": true, "description": "Mock Amar backend - configure endpoint responses"},
{"name": "mercadopago", "slug": "mercadopago", "title": "MercadoPago", "status": "ready", "system": "artery", "mock": true, "description": "Mock MercadoPago API - configure payment responses"},
{"name": "google", "slug": "google", "title": "Google", "status": "planned", "system": "artery"},
{"name": "maps", "slug": "maps", "title": "Maps", "status": "planned", "system": "artery"},
{"name": "slack", "slug": "slack", "title": "Slack", "status": "building", "system": "artery"},
{"name": "whatsapp", "slug": "whatsapp", "title": "WhatsApp", "status": "planned", "system": "artery"},
{"name": "gnucash", "slug": "gnucash", "title": "GNUCash", "status": "planned", "system": "artery"},
{"name": "vnc", "slug": "vnc", "title": "VPN", "status": "planned", "system": "artery"},