Declare the source version
Add the key
sourceVersion to a query of your mapping. The key takes two entries:
This example is trimmed from the reference mapping of SCR 3040:
What Reporter refuses when you save
Reporter refuses the mapping with HTTP400 and the code RPT-0143 in these cases:
- The query reads the rows of another query.
- The query filters by the values of another query.
- The query reads the Midaz CRM data source.
- The key has no
column, orcolumnis empty. - The key has an entry other than
columnanddigest.
What your data must hold
Each declared column must hold one value for the rows that the query reads. A generation can fail withRPT-0143 when a row holds no version, or when the rows hold more than one value.
What a filing records
Reporter stores the source version with the draft. The filing then shows the field
sourceReads on GET /v1/reports/{id} and on the list of reports. The field is a list of reads. A filing from a mapping with no declaration has no sourceReads. A report from a template has none either.
When the source changes during a generation
The source can change while Reporter reads it. The filing would then mix two versions of the data. Reporter does not accept this. The generation fails with
RPT-0261. The report ends in the status Error. Its metadata holds the code, the title, and a message that names the data source and the table. Generate the filing again.
How Reporter marks a filing
Reporter checks the sources on a schedule. The check runs once every hour by default. The check reads a filing only when it meets these conditions:
- The filing is
DraftorFinal. - The filing carries
sourceReads. - The filing was created within the window. The window is 400 days by default.
- When the states differ, Reporter adds one mark to
republishedReads. - When the states are the same, Reporter writes nothing and sends nothing.
The list
republishedReads only grows. Reporter does not remove a mark. A source can return to the state that the filing read. Reporter then adds a new mark, because the new state differs from the newest mark.
If the source of a read does not answer, Reporter adds no mark for that read. It tries again at the next check. Reporter does not check a filing again after its window ends. The marks that the filing already has stay.
What a mark does not do
A mark does not say that the file would come out different. It records a change in what the source shows for the data that the filing read. Reporter never refuses an approval because of a mark. A mark changes neither the file nor the status of the filing. Reporter does not generate a new filing by itself. What you do with a marked filing is your decision.
Find the filings to review
Use the query parameter
republished on GET /v1/reports. The values are true and false. The value false narrows nothing.
Send republished=true with regulatory=true, with document_id, or with subscription_id.
With republished=true, Reporter returns a filing only when all three conditions are true:
- The filing is
DraftorFinal. - No newer
DraftorFinalexists for the same document, the same CNPJ of the institution, and the same filing period. - The source shows another version of what the filing read.
Draft or Final of the same document, CNPJ, and filing period exists. Or the source returns to the state that the filing read. The marks stay on the filing in both cases. A newer generation that is still Processing, or ended in Error, does not take the filing out of the result.
The list keeps its cursor pagination. A page holds only filings that pass the filter.
Reporter refuses the request with HTTP 400 and RPT-0019 in these cases:
- You send
republished=trueon a list that is not a list of filings. - You send
republished=truewithcurrent=true. - The value is not
trueorfalse.
The event
Reporter emits the event
regulatory.source_republished when it adds a mark. The delivery profile is Critical.
The payload carries no report status, because a status can be old when you read the event. Read the filing to get its status. The
ce-type of the event is studio.lerian.reporter.regulatory.source_republished.
Reporter sends events only when event publication is enabled. When it is off, Reporter still writes the marks and sends no event. Reporter does not send later an event for a mark that it wrote while publication was off.
If a Streaming Hub subscription lists its event types, add regulatory.source_republished to its event_types.
For the deduplication by event id, read Delivery. A repeated delivery of the same mark carries the same event id.
Settings
Two environment variables set the check.
A value of zero or less stops the service at start. See Environment variables for the other settings.
SCR 3040
From version
1.1.0 of the SCR 3040 document, the reference mapping declares the source version. It declares it on the queries that read the three Lender views. Reporter then stores the version of each view that a filing read. It marks the filing when a view shows another version of the same reference month. For the document itself, read SCR 3040.
The version of the views is per reference month of the source database. It is not per institution. A correction that Lender publishes for another institution of the same database also marks your filing.
A subscription that you activated before version 1.1.0 gets the declaration in one of two ways:
- Adopt version
1.1.0, then restart the mapping from the reference. Adopting a version alone keeps your current mapping. The restart builds your mapping again from the reference mapping, and that brings in the declaration. Copy your mapping before the restart. The restart does not keep themanualOverridesvalues or your edits to the queries of the reference. Enter them again after the restart. - Add the declaration by hand. Edit the mapping and add
sourceVersion: {column: version, digest: dataset_digest}to each query that reads one of the three views. Use this way when you customized your mapping and want to keep it.
Next steps
SCR 3040
The catalog document, its data sources, and its reference mapping.
Regulatory mapping reference
The keys, values, and refusals of a mapping.
Reporter events
The event catalog, the envelope, and the delivery rules.
File datasets
Files that your systems deliver each day. Reporter records the revision of each day.

