-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Description
Often countries want to print a list of all the records in a workqueue. To support existing paper processes.
To give flexibility to different country requirements. The user can print the output that may contain PII and have multiple pages in a template that they can visually configure, such as HTML.
Countries should be able to configure what to include in the export. As the workqueue row has limited information about the record.
Note. the user would require internet to generate the document.
This ticket is to:
- Add a scope:
record.export-records - Add a CTA to Workqueue and search results: 'Export'
- Icon name = "Export"
- Confirmation dialog showing the amount of records that will be exported
- Export the records in the Workqueue / search results to .csv
- Exports all records in all pages (includes paginated pages)
- Configure what data to show in the export
- Add action to user audit when they export a workqueue / search results
- Filename format: WQName_location_user_datetime.csv
Design
Workqueue (TopActionButtons)
Use Button component - icon variant

ACs
GIVEN I am on a workqueue
WHEN i have the scope to export-workqueues-searchresults
THEN I can see the option Export in the workqueue menu
GIVEN I am on an advanced search result
WHEN i have the scope to export-workqueues-searchresults
THEN I can see the option Export in the advanced search results menu
Tech tasks
-
Add a scope:
record.export-records- This already exists
RECORD_EXPORT_RECORDS: 'record.export-records', and is not used anywhere at the moment. - Should this perhaps be renamed to
workqueue.export?
- This already exists
-
Countries should be able to provide an "export" config in country-config, and define in it what data fields to include when exporting advanced search result items or workqueue items.
- Define a type called
ExportConfigfor the config object. This will be used in exporting both workqueues and advanced search results. - The GET /workqueues example here would be a good fit for extending and adding configs for workqueues.
- The template can be added under opencrvs-countryconfig/src/api/workqueues for example
- Implement corresponding route and handler for returning the newly created config in src/index.ts here
- The export configs for advanced searches will need to be defined separately in event-specific config for search that we can extend with another
exportkey
- Define a type called
-
In opencrvs-core, in the eventRouter define a new sub-router called export
- Within it define a procedure called
config(this will be a query), which fetches workqueue "export" configurations from country config GET /workqueues endpoint. - Define a second procedure called
create(this will be a mutation), which will initiate the export process.- The
createmutation will take in as parameters a list of event ids and the export configs - For the provided list of event ids, fetch the event data from Elasticsearch using the same function calls of the APIs built in this task
- After fetching data from Elasticsearch, clean up the PII fields that are not going to be exported based on the export configs
- Stream the results back to the client
- The
- Define procedure defaults for the two new procedures in the export sub-router.
- Define lifecycle hooks (such as onMutate, onSuccess and onError) for the
export.createmutation - Define a
useExporthook, which wraps the two new procedures in the export sub-router. This hook will be used in the client side component.
- Within it define a procedure called
-
Frontend implementation should take into account:
- The workqueues and advanced search results view will use the same shared component called
<SearchResults />. The export feature should be added to the parent component of the<SearchResults />component.- Adding a button that triggers the
export.createmutation - Add state for tracking the export processing state
- Listen to the
onSuccesslifecycle hook for theexport.createmutation and handle the pdf stream and generate a link for the user. - It is highly likely that users will want the export to be in a form of a PDF (to be confirmed in business requirements gathering stage).
- Generation of the PDF should be done on the frontend side if we want values and column names to be formatted and human readable. Formatting and & i18n logic is purely on the client side. Check useStringifier of one of our input components for reference.
- Add a modal according to design which initially shows that export is processing, and eventually displaying a link to user to download PDF / and or error in case of failure.
- Adding a button that triggers the
- The workqueues and advanced search results view will use the same shared component called
Aspects that need further thought:
- Auditing
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
