eam_doc_helper
This package provides helper classes for working with user documents and form distributions in the 8am system. It is used to fetch user documents, format OCR output for reporting, and build/export form distribution reports from Cosmos DB.
Installation
pip install eam_doc_helper
Usage
All classes take a DatabaseHelper (from eam_db_helper) in their constructor.
Helper (user_doc.py)
The Helper class fetches user documents from the database.
Helper(database)- constructs the helperget_by_user_ids(user_ids)- fetchesuserDocitems for a list of user IDs of any size. IDs are queried in batches of 2000 (MAX_BATCH_SIZE) and the results merged.
from eam_doc_helper.user_doc import Helper
user_docs = helper.get_by_user_ids(['id1', 'id2'])
Formatter (ocr_output.py)
The Formatter class normalizes OCR output and user document questions into a consistent shape for reporting.
Formatter(database)- constructs the formatterget_vals_from_ocr_output(user_docs)- processes a list ofuserDocitems and returns each with a normalizedoutputlist:- If a document's
ocrOutputcontains usable values, they are normalized fromocrOutput['values'](usingupdatedValuewhen present, otherwiseocrValue). - If
ocrOutputis empty, values are sourced from the correspondinguserDocQuestionrecords'answerfield. - The original
ocrOutputkey is replaced byoutputon each returned item.
- If a document's
Each normalized value has the shape:
{
'userDocId': '<doc id>',
'key': '<field key>',
'reportValue': '<value>',
'source': 'ocrOutput' | 'userDocQuestion'
}
Get (form_distribution.py)
The Get class fetches and groups form distribution details for a template/company.
Get(db, template_id, company_id=None)- constructs the fetcherget_form_template()- fetches a singleformTemplateby id, optionally filtered by company idget_distribution_details()- returns the distribution detail for a template owned by a company, in the shape:
{
"template": <template dict>,
"distribution": [
{
"id": "<company id>",
"name": "<company name>",
"users": [<user row>, ...],
"dateSent": "YYYY-MM-DD",
"completedOn": "YYYY-MM-DD",
"incomplete": <int>,
"completed": <int>,
"total": <int>
},
...
]
}
Each user row contains id, name, email, createdOn, expiryDate, reminders, completedOn, distributionId, certificateId, and optionally canRetake.
ReportBuilder (form_distribution.py)
The ReportBuilder class exports form distribution details as flat report rows.
ReportBuilder(db, template_id, company_id=None)- constructs the builder (fetches distribution details on construction)export_distribution_details()- returns a list of report rows. For each user, archived (formArchive) completions are included first with status"Expired", followed by the current distribution record with status"Completed"(if a certificate exists) or"Incomplete".
Each row contains id, templateName, companyName, userName, email, createdOn, completedOn, and status.
Metadata
Release files for eam-doc-helper 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eam_doc_helper-0.0.7.tar.gz | 5.1 kB | Without provenance | Details for eam_doc_helper-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eam_doc_helper-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for eam_doc_helper-0.0.7-py3-none-any.whl |
Total release size: 12.2 kB
Release files / eam_doc_helper-0.0.7.tar.gz
| Download URL | eam_doc_helper-0.0.7.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6be039bb30399024dbadf5622637bd2594291d15661a9086abbd13319638bcf0
|
|
BLAKE2b-256 checksum How to use checksums |
d4e41e7284e79549ad06b382e6b7df9e496158fd61ee1fedb69f2297bed2291d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.0
|
Release files / eam_doc_helper-0.0.7-py3-none-any.whl
| Download URL | eam_doc_helper-0.0.7-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e50673c6fa1895480d9c755e2501739b3d679161269d3f1f6e2d3f812541e54
|
|
BLAKE2b-256 checksum How to use checksums |
ee0a33d1707e97046f0a83a5c2d3f27943a512370cec4ac666a2e06d2b4718cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.0
|
Security for eam-doc-helper 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.