The opus_support Module
opus_support holds the conversions the import pipeline and the web application
both need. The import pipeline uses them to normalize what it reads out of a PDS
label; the web application uses them to parse what a user typed and to format what it
returns. Both have to agree exactly, which is why they are one package rather than two
copies.
It sits under both programs and imports neither, which is what lets both depend on it without depending on each other. The Configuration File is the other package in that position.
It is internal: it carries no API guarantees for anything outside this
distribution, even though its import name has no opus_app-style prefix. Its whole
public surface is re-exported from the package root, and both programs import from
there (from opus_support import parse_form_type) rather than from the module a
name happens to be defined in. The modules below are where to look for an
implementation, not what to import.
opus_support.unitsThe unit systems.
UNIT_FORMAT_DBmaps a unit id to its units, their conversion factors, and the functions that parse and format a value in each. It is whatparse_form_type(),get_valid_units()andget_default_unit()read, and therefore what decides which units an API call may ask a field’s values in.opus_support.time_parsingTimes, in every spelling OPUS accepts –
ymdhms,ydhms, Julian and modified Julian dates, ephemeris time – built onrms-julian.opus_support.sclkSpacecraft clock counts, whose format differs per mission and per instrument.
opus_support.anglesThe sexagesimal spellings a right ascension or declination is written in, and the conversions between them. The degree-to-radian factor itself is a unit conversion and lives with the others in
opus_support.units.opus_support.orbitsThe Cassini orbit (“rev”) numbering, whose first few orbits are named rather than numbered.
opus_support.collationcollation_key(), the form of a string the database server’s collation compares, ignoring case and accents. The import keys its cache of a mult field’s values with it, and the web application keys its copies of the import’s tables with it, so that a lookup in memory finds what a query would. opus_app.apps.tools.import_constants says where the key and the collation differ.UNSTORED_ASCII_CHARACTERis DEL, the one ASCII character no ASCII column holds: the import refuses it there, and the web application binds it for a character of a caller’s text that has no ASCII form.ASCII_COLLATIONis the collation of every ASCII column, which the import creates the column with and the models name.
The package’s header carries a standing demand for 100% test coverage, and
tests/opus_support/ is where it is met. A new unit system, clock format or angle
spelling comes with tests for its parse and its format, in both directions, including
the values it rejects. Adding a unit is the recipe for adding a unit,
and it is where the one non-obvious rule lives: the order units are listed in does not
decide the default.
Both programs reach these conversions. The import pipeline normalizes what it reads out of a PDS label with them (Inside one row), and the web application parses what a user typed and formats what it returns with the same functions (Turning a URL into a search). That both sides agree exactly is the whole reason this is one package.