timetoshare.tables.columns#
The columns of the two table types and the cells they hold.
A number is three members, filled by its number type and never mirrored:
an int is its numerator alone, a fraction its numerator and
its denominator (at least 1), a float its finite value alone;
every other member is null. A coordinate cell of the MatchClaim table adds
the unit and the number_type of its coordinate; a row of the
Projections table states them once, in its own unit and number_type
columns, for its start and its duration. number_cell() writes
a number’s members and coordinate_value() reads them back.
Both tables’ columns and the structs of their cells are read from one file,
tables.json beside the manifest schema (tables_path()), never
declared a second time here.
- timetoshare.tables.columns.ANCHOR_TYPE = StructType(struct<coordinate_a: struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string>, coordinate_b: struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string>>)#
An AlignmentAnchor: one coordinate of each of the row’s two timelines,
coordinate_aon itstimeline_a_id,coordinate_bon itstimeline_b_id.
- timetoshare.tables.columns.BELIEF_KEYS = ('actor', 'belief', 'date', 'note')#
The members of a belief: the keys of the provenance schema’s
Belief.
- timetoshare.tables.columns.BELIEF_TYPE = StructType(struct<actor: string, belief: string, date: string, note: string>)#
A belief, each member a string (
beliefone oftimetoshare.BELIEFS).
- timetoshare.tables.columns.COORDINATE_KEYS = ('numerator', 'denominator', 'value', 'unit', 'number_type')#
The members of a coordinate cell.
- timetoshare.tables.columns.COORDINATE_TYPE = StructType(struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string>)#
A coordinate on one timeline’s axis: a number with its unit and number type.
- timetoshare.tables.columns.MATCH_CLAIM_REQUIRED = ('timeline_a_id', 'timeline_b_id', 'is_synchronous', 'event_a_id', 'event_b_id', 'id')#
The columns of the MatchClaim table that hold no null, in its order.
- timetoshare.tables.columns.MATCH_CLAIM_SCHEMA = timeline_a_id: string timeline_b_id: string start_anchor: struct<coordinate_a: struct<numerator: int64, denominator: int64, value: double, unit: string, numbe (... 126 chars omitted) child 0, coordinate_a: struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string> child 0, numerator: int64 child 1, denominator: int64 child 2, value: double child 3, unit: string child 4, number_type: string child 1, coordinate_b: struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string> child 0, numerator: int64 child 1, denominator: int64 child 2, value: double child 3, unit: string child 4, number_type: string end_anchor: struct<coordinate_a: struct<numerator: int64, denominator: int64, value: double, unit: string, numbe (... 126 chars omitted) child 0, coordinate_a: struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string> child 0, numerator: int64 child 1, denominator: int64 child 2, value: double child 3, unit: string child 4, number_type: string child 1, coordinate_b: struct<numerator: int64, denominator: int64, value: double, unit: string, number_type: string> child 0, numerator: int64 child 1, denominator: int64 child 2, value: double child 3, unit: string child 4, number_type: string is_synchronous: bool provenance: struct<stated_by: list<item: string>, date: string, method: string, service: string, basis: list<ite (... 128 chars omitted) child 0, stated_by: list<item: string> child 0, item: string child 1, date: string child 2, method: string child 3, service: string child 4, basis: list<item: string> child 0, item: string child 5, match: string child 6, note: string child 7, beliefs: list<item: struct<actor: string, belief: string, date: string, note: string>> child 0, item: struct<actor: string, belief: string, date: string, note: string> child 0, actor: string child 1, belief: string child 2, date: string child 3, note: string certainty: double event_a_id: string event_a_name: string event_b_id: string event_b_name: string id: string#
The MatchClaim table: one row per MatchClaim, one column per property, each MatchClaim addressed by its ID alone.
- timetoshare.tables.columns.NUMBER_KEYS = ('numerator', 'denominator', 'value')#
The members of a number.
- timetoshare.tables.columns.NUMBER_MEMBERS: Mapping[str, tuple[str, ...]] = mappingproxy({'int': ('numerator',), 'fraction': ('numerator', 'denominator'), 'float': ('value',)})#
The members a number of each number type fills; the others are null.
- timetoshare.tables.columns.NUMBER_TYPE = StructType(struct<numerator: int64, denominator: int64, value: double>)#
A number: a Projection’s
startorduration, whose row states the unit and the number type.
- timetoshare.tables.columns.PROJECTION_REQUIRED = ('id', 'timeline_id', 'unit', 'number_type', 'start')#
The columns of the Projections table that hold no null, in its order.
- timetoshare.tables.columns.PROJECTION_OF_TYPE = StructType(struct<timeline_id: string, event_id: string>)#
The event a Projection stands for, by its timeline and its ID.
- timetoshare.tables.columns.PROJECTION_SCHEMA = id: string timeline_id: string unit: string number_type: string start: struct<numerator: int64, denominator: int64, value: double> child 0, numerator: int64 child 1, denominator: int64 child 2, value: double duration: struct<numerator: int64, denominator: int64, value: double> child 0, numerator: int64 child 1, denominator: int64 child 2, value: double projection_of: struct<timeline_id: string, event_id: string> child 0, timeline_id: string child 1, event_id: string#
The Projections table: one row per Projection, its
unitandnumber_typestated once for itsstartand itsduration;durationnull for an instant.
- timetoshare.tables.columns.PROVENANCE_KEYS = ('stated_by', 'date', 'method', 'service', 'basis', 'match', 'note', 'beliefs')#
The members of a row’s provenance: the keys of the provenance schema.
How it was made, then who believes it, in the schema’s order. The manifest’s entries add
propertyandvalue, which a row needs no more than it needs a subject: the row is what the entry is about.
- timetoshare.tables.columns.PROVENANCE_METADATA_KEY = 'timetoshare:provenance'#
The schema-metadata key holding, as JSON, a provenance shared by every row.
- timetoshare.tables.columns.PROVENANCE_TYPE = StructType(struct<stated_by: list<item: string>, date: string, method: string, service: string, basis: list<item: string>, match: string, note: string, beliefs: list<item: struct<actor: string, belief: string, date: string, note: string>>>)#
A row’s provenance, the members of
PROVENANCE_KEYSwith their types.
- timetoshare.tables.columns.TABLES_DOCUMENT = 'tables.json'#
The file name of the column types beside the manifest schema.
- timetoshare.tables.columns.coordinate_value(cell, number_type=None)[source]#
The exact value of a well-formed number, read from its number type.
A fraction is read in whatever terms it is written:
(2, 4, null)is the value1/2.
- timetoshare.tables.columns.fixture_path(name)[source]#
The path of one file of the table fixture, by its name.
The fixture is a manifest (
manifest.yaml), its two tables (match_claims.parquet,projections.parquet) and the anchors and potential MatchStamps expected of the MatchClaim table (expected.yaml).
- timetoshare.tables.columns.number_cell(value, number_type)[source]#
The members of a number of the number type
number_type.An
inttakes an integer (or a Fraction whose denominator is 1), afractionan integer or a Fraction, written as its numerator and denominator, afloata finite float or an integer a double holds exactly; a float is never written as a Fraction, nor a Fraction as a float, and an exact number’s members are 64-bit integers.- Raises:
ValueError – If
number_typeis no number type orvalueis no number of it.
- timetoshare.tables.columns.tables_path()[source]#
Return the path of the column types of the two tables,
tables.json.The one source of
MATCH_CLAIM_SCHEMAandPROJECTION_SCHEMA: itstypesdeclare the structs a cell holds, itstableseach table’s status and its columns, in order.