2025-03-05 13:50:43 +00:00
# Query Orchestration
2025-03-10 11:03:00 +00:00
## clientSyncRunner
**Listens For ** : Body Containing Client ID
**Action ** .
Adds an event for each document into the DOCSYNC queue for the given Client.
2025-03-05 13:50:43 +00:00
## docCleanRunner
2025-03-06 19:26:01 +00:00
**Listens For ** : Body Containing Document ID.
**Action ** .
2025-03-10 11:03:00 +00:00
If the document is not already clean according to the collector standards, a clean is triggered.
2025-03-06 19:26:01 +00:00
An event with the document id is pushed to the DOCTEXT queue.
2025-03-05 13:50:43 +00:00
## docInitRunner
2025-03-06 19:26:01 +00:00
**Listens For ** : S3 Event notifications - limited to PUT notifications.
**Action ** .
Checks if the uploaded document is a duplicate.
2025-03-10 11:03:00 +00:00
Currently whether the document content is a duplicate or not is determines using the document ETag, and check if it already exists for the client.
2025-03-06 19:26:01 +00:00
Find reference entity.
If NOT a duplicate - Create a document reference entity.
Create a document entry to log the successful upload of a document.
Add an event to the DOC SYNC queue.
2025-03-05 13:50:43 +00:00
## docSyncRunner
2025-03-06 19:26:01 +00:00
**Listens For ** : Body Containing Document ID.
**Action ** .
Checks if the document is eligible for syncing.
2025-03-10 11:03:00 +00:00
By validating: the client can_sync parameter.
2025-03-06 19:26:01 +00:00
If eligible, send an event to the DOCCLEAN queue.
2025-03-05 13:50:43 +00:00
## docTextRunner
2025-03-06 19:26:01 +00:00
**Listens For ** : Body Containing Document ID
**Action ** .
2025-04-02 18:50:03 +00:00
If the document text is not already extracted according to the collector standards, trigger the textract job for text detection.
2025-03-06 19:26:01 +00:00
2025-04-02 18:50:03 +00:00
Otherwise, add an event to the QUERYSYNC queue.
2025-03-06 19:26:01 +00:00
2025-03-05 13:50:43 +00:00
## metricsExample\_test
This main.go serves as an example of how to use the custom Prometheus metrics package.
It demonstrates:
1. Setting up metrics with proper context handling
2. Configuring different types of metrics (Counter, Gauge, Histogram, Summary)
3. Recording metrics safely in a concurrent environment
4. Implementing graceful shutdown
5. Proper error handling
2025-03-17 18:14:15 +00:00
## queryAPI
2025-03-05 13:50:43 +00:00
This API currently manages all user entities to be managed. This allows users of the service to change required entities and processes.
The entities in question:
2025-03-10 11:03:00 +00:00
- Client - A client is a single client of the Doczy project, all configurations and clients for a client will be in reference to the respective client.
2025-03-05 13:50:43 +00:00
2025-03-10 11:03:00 +00:00
- Collector - A collector specifies the required queries for export for a given client.
2025-03-05 13:50:43 +00:00
2025-03-10 11:03:00 +00:00
- Sample - A sample is a subset of documents to be used for testing. When it is active a client will only process documents in the sample.
2025-03-05 13:50:43 +00:00
- Query - A query is a block of processing of data which takes an input and produces an output.
2025-03-10 11:03:00 +00:00
- Export - An export is a manually started process which outputs the results for a client to a given location.
2025-03-05 13:50:43 +00:00
2025-03-17 18:14:15 +00:00
## queryRunner
**Listens For ** : Body Containing Document ID and Query ID
**Action ** .
Run the query for the given document and store the result.
Events with the document id and downstream query ids are pushed to the QUERY queue.
2025-03-05 13:50:43 +00:00
## querySyncRunner
2025-03-06 19:26:01 +00:00
**Listens For ** : Body Containing Document ID
**Action ** .
Find the queries with no dependencies that do not have a valid result for a document.
The reasoning for only extracting these is to start the query extraction process only for necessary queries, and the query runner will manage updating downstream dependencies.
There are 2 situations that cause a query to show up in this list:
The query has no required dependencies.
All required dependencies have a valid result.
An event with the document id is pushed to the DOCTEXT queue.
2025-03-05 13:50:43 +00:00
## queryVersionSyncRunner
2025-03-06 19:26:01 +00:00
**Listens For ** : Body Containing Query ID
**Action ** .
2025-03-10 11:03:00 +00:00
Adds an event for each client into the CLIENTSYNC queue for the given query, i.e. each client that contains the query in its dependency tree.
2025-03-06 19:26:01 +00:00
2025-04-02 18:50:03 +00:00
## storeEventRunner
**Listens For ** : S3 Event
**Action ** .
It will identify the type of event and the location of said event, and forward the task accordingly.
2025-04-22 14:40:16 +00:00
It supports the document initialisation and document text processing stages. Events may be pushed to the DOCINIT queue.
2025-04-02 18:50:03 +00:00
2025-03-05 13:50:43 +00:00
Generated by Doczy