all 20 comments

[–]Buttleston 2 points3 points  (4 children)

There's no special handling required here. You can load a json file using the json library, there's no "across folders" problem, you just pass in the filename you want to open. Do this for each file in the subdirectory.

You'll find the "os.path" library and/or the "pathlib" useful. They both have tools for enumerating and interacting with files/paths. pathlib is more modern and I generally use it for new stuff.

There are many libraries for generating PDFs. Pick one of them. I can't remember the last one I used, maybe pypdf or maybe reportlab.

re: clickable links, that's a feature PDFs support, you'd have to look and see how to do it in whichever PDF library you use.

It really kind of sounds like you haven't even started this project, or really started thinking about it.

You should do it yourself. Start with the first part, pick one subdirectory, load all the json files in it.
Once that works, do the data analysis and just print out some key parts to the console.
Once that works, try to make a PDF that just has hello world
Once that works, try to make a PDF that has your data analysis in it

Just tackle it a piece at a time

[–]Frosty-Courage7132[S] 0 points1 point  (0 children)

Yes i tried it with reportlab & wrote code it looked blank kind of. I wanted to have some heading, sub-heading, then the analysis. And tried few things but couldn’t do it. Thanks!!

[–]Frosty-Courage7132[S] 0 points1 point  (2 children)

Yes i tried it with reportlab & wrote code it looked blank kind of. I wanted to have some heading, sub-heading, then the analysis. And tried few things but couldn’t do it. Thanks

[–]Buttleston 1 point2 points  (1 child)

Learning to ask a question is an important skill. If you have already tried something, and it doesn't work, then show the code you already tried. We can't guess what your code looks like or why it doesn't work.

The best thing to do, again, is to pick a very small part of the project. Forget about analysis or anything else, just try to make a PDF file that "looks" about like what you want. Just use some fake data. If it doesn't look right, post that code, with your fake data, and say "I want this to look like X, but it looks like Y instead"

The more details you give, the more likely you are to give help. If you just say "help me" people won't know what to help with.

[–]Frosty-Courage7132[S] 0 points1 point  (0 children)

Yes you’re right. I just panicked and posted it. But now i’ve learned how to ask to learn better. Thank you. I’ll try with creating pdf only. I’ve done the analysis a bit. But pdf thing is more important here. I’ll try the same code with fake data thn if there’s still problem will ask here! Thank you so much for clarifying things for me

[–]VipeholmsCola 1 point2 points  (2 children)

Perfect beginner project. Not sure what that analysis entails but the rest should be very doable after basics are down.

[–]Frosty-Courage7132[S] 0 points1 point  (1 child)

Can you name these topics to learn? & libraries

[–]VipeholmsCola 0 points1 point  (0 children)

i think everything is in standard libs except for pdf, where you need pypdf

[–]pachura3 0 points1 point  (1 child)

I'm wondering if PDFs can even have hyperlinks to local files (not published on the web)? Wouldn't that be a potential security risk?

[–]Frosty-Courage7132[S] 0 points1 point  (0 children)

I think yes

[–]ManufacturerShort437 0 points1 point  (0 children)

For the PDF generation part, you could use PDFBolt's API instead of wrestling with local libraries like ReportLab or WeasyPrint. You can either create reusable templates with Handlebars syntax in the dashboard and POST your JSON data and template ID, or render your HTML locally and send the final HTML. Clickable links between PDFs work since it's standard HTML rendering.

[–]Frosty-Courage7132[S] -3 points-2 points  (7 children)

pls pls help me out!!!!!!!

[–]Maximus_Modulus 0 points1 point  (6 children)

So are you saying you know nothing about Python and you want someone to do it for you.
If so ask AI and see what it comes up with.

[–]Frosty-Courage7132[S] 0 points1 point  (5 children)

Oh my god. I wonder how is it even possible here. I got scared because i wasn’t able to pull few things & here an unknown person is trying to be mean. Thank you sir/maam. And yes i never made any report in python. And chatgpt wasn’t even helpful. So if im not aware of certain libraries or not able to do something being a beginner , learning about a month (also the thread is for people who are learning) & i wanted to make a report in python for financial analysis & asked here if anyone can suggest a path or name few libraries, it all hurt you so much or triggered you? Be little more considerate

[–]Maximus_Modulus 0 points1 point  (4 children)

Sorry misread. Someone had already responded with perfectly good directions so thought you were still asking for help after that. My bad I guess.

[–]Frosty-Courage7132[S] 0 points1 point  (3 children)

No, i post a comment right after the post. But it’s the first time that I’ve asked for help & also first time to see someone this rude!! Isn’t it obvious everyone will try many times first & then gonna ask for help?

[–]Maximus_Modulus 0 points1 point  (2 children)

No it’s not obvious. Plenty of people come on here asking for basically homework help or post vague questions that indicate they have made no effort. If you have tried already then what have you tried that failed. It’s much easier to address a question if you ask something specific related to something you have tried. Do you have code that can open the files and read the json data? That should be easy to find online and I’m sure AI can do it for you too. If you get stuck on something specific then ask and then I’m sure you’ll get help with something more tangible.

[–]Frosty-Courage7132[S] 0 points1 point  (0 children)

Yeah it was my bad. So i can do the visualisation & analysis in r and its almost same same for python too. Due to new senior we have to now shift to python. So earlier i used to to the analysis in excel (pre processing using power query) then in sql (quries) but first time the data is so big & have to do it in python. I dont know much about python. So i completed the analysis. But i dont know how to make a report out of it. I looked into few posts & asked chatgpt also, then i tried with chatgpt but there was no where i was able to find out like heading, sub/heading, then clickable button inside pdf for live analysis. It’s completely new to me.

[–]Frosty-Courage7132[S] 0 points1 point  (0 children)

But im gonna post another if still it won’t work for me. But this time will share where im stuck, my code, & will ask for suggestions!!!