MiCyte

← The wiki

44 — Project documents

BuiltRendered from 44-project-documents.md in the public repository. Edits belong there.

A project is a datum document on the instance's tree, built from four row archetypes; a website reads it through its own resolver.

The number of rows varies from project to project; the shape of each row does not. A project with forty photographs and one with three use the same four archetypes.

The four archetypes

Declared in scripts/mint_archetype_sandbox.py, members of the project class (scripts/mint_class_library.py), read by micyte/core/datum_ops/project_document.py.

ArchetypeCells, in orderOne row per
project_profile (header)msn_id owner · site_msn site · lcl_id kind · title name · utc opened (optional) · status_ref standing (optional) · hyphae_ref owner's profile (optional)Document
project_textlcl_id role · nominal order (then line order, for a paragraph of more than one line) · title textParagraph line or fact line
project_artifactlcl_id slot · lcl_id role · nominal order · title caption (optional)Picture placement
project_factnominal value · lcl_id kind · title word (optional)Detail
  • The header is the project_profile archetype that projects documents already use; its two optional cells are last, so older rows still match.
  • Roles and kinds are nodes under the instance's classes branch (feature, gallery, tour, plan, hidden; summary, story, fact; beds, baths, square_feet, and others), seeded by the convention (43). An instance can add more without a new archetype.
  • Cell order distinguishes the archetypes from each other and from class_record and job_service. ArchetypeRegistry.ambiguities() is empty with all four defined, and a test keeps it empty.
  • A title babelette holds 64 characters, so a longer paragraph is stored as several project_text rows, one per line; micyte.tools.note_books.wrap_lines splits it and the reader joins it.

Reading

read_project(document, registry=, namespace=, labels=) returns a ProjectView with fixed keys:

KeyContent
title, kind, owner, site, opened, status, owner_profile, header_addressFrom the header
texts{role: [{order, text}]}
artifacts{role: [{slot, order, caption}]}
facts{kind: {value, word}}
extras{archetype: [{address, fields}]} for rows of any other archetype the registry covers
unmatchedAddresses of rows no archetype covers

No row is dropped. A site that needs a shape the four cannot express defines a derived archetype in the library as a member of the project class; the reader returns its rows under extras, and only that site's resolver needs to read them.

Pictures

A project_artifact names an artifact slot: a node under the tree's artifacts › image (or video) kind whose art. document holds the bytes, filed with file_artifact.

Export

site_hosting project.export writes the project's view as JSON beside the site's assets (<date>.datum-project.<slug>.json), copies any picture the site's image pool lacks (matched by SHA-256 of the bytes), and derives the site profile the pages are generated from (feature image, order, hidden pictures, captions, name, descriptions). Profile fields the document does not hold are left unchanged. The host implements it in project_export_runtime.py and utilities_extensions/site_profiles.py.

After a profile has been exported, a profile.edit on it is applied to the document and the document is exported again (project_edit_runtime.py). An upload through the page files the picture in the datum store and in the document's gallery in the same step.