[WIP Guide] JSON to PDF to cloud storage

More
1 year 11 months ago - 1 year 11 months ago #24146 by prashant
This is a running diary , as I make a guide for myself / other users
  • Purpose is to document the entire process from receiving JSON input to having a PDF file delivered to place of your choice
  • Currently I am mapping what I use , team ETL can give any guidance
    • I have Advanced ETL Processor - Enterprise
    • I have URL logger
    • I am using Gravity Forms on Wordpress for capturing forms
    • My cloud storage is Google Drive
    • I like PDF but you can choose other formats
    • Little bit of python is OK for me
 

PS: Forms make the mind map image looks super sad , dont' know why
Last edit: 1 year 11 months ago by prashant.
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24150 by admin
Looks great.

We use Obsidain + Excalidraw plugin for this kind of stuff

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24151 by prashant

We use Obsidain + Excalidraw plugin for this kind of stuff

Thanks will check them out both ! Obsidian seem to have crazy cult following doing a quick search on google
 

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #24156 by prashant
Update #2

Since all the forms discussed here, can have multiple companies , we also need to solve the problem , of different logos for each companies in header. To resolve this we ensure that all the forms have few compulsory admin fields.

Assume the candidate name is Elon Musk
  • joining_company - name of the company - Le't say we do Disney
  • company_logo - name of the logo files as stored on ETL server - here we have disney_logo.jpg
    • This single field ensure our code becomes Easy in FastFields .
      • procedure Picture1OnBeforePrint(Sender: TfrxComponent); begin   Picture1.filelink:='C:\Users\Superadmin\Documents\KBIAutomation\static masters\'+<ADOQuery."company_logo">; end;
  • company_address - address of the company 
  • filename - Name of the document being printed , calculated field , it will have value of ELON Musk - 01 - Appointment Letter.pdf
Of course all of these fields can be derived using calculations(company logo and company address) inside FastReports , but I am a complete n00b at it, so I simply pass all the variables I need pre-filled.

 
Last edit: 1 year 11 months ago by prashant.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #24161 by prashant
Update #3

Another Modular piece we have here , all the information regarding the form is received via webhook in URL Logger, once we make the OFFER letter, appointment letter IN PDF format , we upload it to Gdrive , the outgoing webhook must have the information of the newly uploaded file. 

Which means JSON received from URL logger has to appended , currently as my information this can only be done with script (team ETL let me know if I am wrong), since I am a chatgpt programmer , here's the script we will use in all of our cases 

Code:
import etltools import json try:     # Retrieve JSON and gdrive values     xjson = etltools.GetVariable('<json_variable>')     gdrive_value = etltools.GetVariable('gdrive_value')     # Update JSON with gdrive link     xjson_value = json.loads(xjson)     xjson_value["{{g_link}}"] = f"https://drive.google.com/file/d/{gdrive_value}/view?usp=drive_link"     etltools.SetVariable('updated_json', json.dumps(xjson_value))    


Above code changes the JSON like below
{
  "{{mobile}}": "09562312563",
  "{{candidate_id}}": "372",  
"{{candidate_name}}": "Tanvi_Musk",
  "{{candidate_position}}": "HR manager",  
"{{candidate_ctc}}": "540000",
  "{{join_date}}": "2024-05-08",
  "{{candidate_address}}": "yo mama my address is here",
"{{company_logo}}": "firkee_logo.png",  
"{{letter_type}}": "04-Appointment_Letter",  
"{{filename}}": "Tanvi_Musk_ID_372-Letter_Type_04-Appointment_Letter",
"{{gdrive_link}}":"mygdrive_link"
}
Last edit: 1 year 11 months ago by prashant.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24162 by prashant
Update #4

Items are uploaded to Gdrive using the following script - Click to open my forum post

This again is a module I use in alll items requiring me to upload items to Gdrive. It takes input of service work , user to impersonate , folder to upload in and file to upload.
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save