VedAstro / VedAstro

A non-profit, open source project to make Vedic Astrology easily available to all.
https://vedastro.org
MIT License
202 stars 87 forks source link

Unable to add persons #137

Open Sanidhya3101 opened 1 month ago

Sanidhya3101 commented 1 month ago

I created an account on the web platform using my Google Account and tried to add a new person so that I could use the Good Time Finder feature. However, I am thrown the following error every time I try to create a user

Screenshot 2024-07-17 at 14 20 24

Could someone point me to the cause and a potential fix. Also is there an API for the Good Time Finder feature as well (if there is I can't seem to find it) or is it a standalone feature only for the web interface?

sengiv commented 1 month ago

Hey πŸ‘‹...thanks for the report πŸ™

Sanidhya3101 commented 1 month ago

Thanks for the prompt response. Following up on the above, I have the following queries (I have no knowledge of C sharp and have only had a very limited time to browse the desired functionalities of the repo)

  1. With regards to the Good Time Finder functionality, how exactly is the result displayed to the user (as I am not being able to trigger it)? Is it only in the form of chart? For instance if I have the details of a person and select the Good Time Finder for a period of 1 week, what output would I get exactly (just a chart or actual days/dates specifying favorable, unfavorable days, etc.)

  2. From what I have been able to understand is that there is a set of 9 events in a file EventDataListStatic for BuyingSelling based on which operations etc would be done but I am still lost as to how exactly the calculation is being done based on the user attributes. As I am on a tight schedule, it would be great if I could be directed towards the logical flow of the actual calculation starting from clicking the Calculate button on the Good Time Finder till the result is obtained (a file and function flow would be appreciated - I do understand that ShowChart and EventCharts is responsible but not in detail).

  3. It was mentioned that Good Time Finder is just a GUI version of the Life Predictor. So does that mean that I have an API to call the Life Predictor? I couldn't find it in the API builder. However I did see this thread #133 (but api doesn't seem to work currently). Does this mean that currently there is no way to get this functionality working (considering that adding new people isn't working)? Basically the functionality that I want to implement into my application is that based on user's attributes, recommend days and/or dates which are favorable for buying and selling.

Update: I have finally narrowed things down to the fact that

//do calculation for this event to get prediction data var predictionData = eventData.EventCalculator(time, person);

on line 131 in the file EventManager.cs in Logic of Library is responsible for the actual calculation. However, I am stuck here. I can't seem to find an appropriate constructor for the EventCalculator which utilizes such a definition. The only thing I see is

public delegate CalculatorResult EventCalculatorDelegate(Time eventTime, Person person);

in the CalculatorDelegates file. However, I don't see where the eventTime and person details are actually being used for calculation. I researched what a delegate is but it doesn't seem to provide the answer.

sengiv commented 1 month ago

πŸ˜€ Very happy to see someone seriously digging into VedAstro code .....trust me this does not happen often. πŸ“«

πŸ“Ί Check out this video guide, it should answer 80% of the question you asked above GUIDE 1 --> https://youtu.be/dc8Q-r38LsI?si=btL10CDYkEGKUD29 GUIDE 2 --> https://youtu.be/A8JLNOTHDYo?si=BpLbQUPLwVZaB3Kj

After the video if you still have doubts πŸ˜•....just contact me. 24/7 πŸ“ž We can do a google meet and I can onboard you much faster... πŸš€

WhatsApp --> +601113395387 Telegram --> https://t.me/vedastro_org

PRATHAMU200 commented 1 month ago

Hey @sengiv, I was also facing the same issue while adding a person. I tried to look into you code and try to debug it, though i am not having any azure cloud api still i am writing some of my findings. For adding person , there is a function called AddPerson in the file PersonAPI.cs in line number 115. The issue in this function is mainly i guess related to Line 146 AzureTable.PersonList.UpsertEntity(newPerson.ToAzureRow()); Which is link to AzureTable.cs . So if i am going right the issue is coming from AzureTable.cs. I have some small changes but can't able to check because of lack of API key i request you to please check these: 1.) Add a validation or check for StorageAccountKey = Secrets.VedAstroCentralStorageKey; if it is missing or incorrect or somthing. 2.) To check for initialization of TableClient objects. Ensure the StorageAccountKey and other details are correctly formatted and accessible. It will be great if you add Exceptional handeling in this file: I can give you a sample for exceptional handeling for your file which goes like:

private static TableClient? InitializeTableClient(string tableUri, string tableName)
        {
            try
            {
                var serviceClient = new TableServiceClient(new Uri(tableUri), new TableSharedKeyCredential(AccountName, StorageAccountKey));
                Console.WriteLine($"Successfully initialized TableClient for {tableName}.");
                return serviceClient.GetTableClient(tableName);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error initializing TableClient for {tableName}: {ex.Message}");
                return null;
            }
        }

Try to debug on your side and tell us what is the respose. Please i guess any person visiting website has this major issue bacause all other website functionality are dependent upon this feature only so lets try to resolve this issue as early as possible. Thankyou!!

Edit:: Also please try to check you credentials and API keys, there might be an issue.

sengiv commented 1 month ago

@PRATHAMU200 nicely done! πŸ‘Œ Very impressed you managed to navigate the code.

As you mentioned, the API keys have been under suspicion as the cause of this. πŸ—οΈπŸ€”

I guess i have to make a confession too....partly the reason I didn't fix it is because finally decided to move away from Blazor! πŸ™‹β€β™‚οΈ (Blazor is getting super heavy and very bad on mobile)

So i started working on a new website from scratch with only HTML & JS (strictly no frameworks!) πŸ—οΈ The new site is about 50% complete, just pushed the code....check out --> Code folder

As expected the new site is showing great promise when comes to speed 🏎️🏎️⚑ But HTML GUI has to be slowly made....piece by piece, any help would be greatly appreciated! πŸ™πŸ™

So @PRATHAMU200 in conclusion....it saddens me to see the site down. But this is only temporary! Sooner or later it will be fixed....and mark my words it will be a dam good fix! πŸš€ Nothing short of the best. 🀩

Btw @PRATHAMU200 , since you're good at code....you can join me on coding session in google meet. Then we can split the task and maybe hash it out faster or better 😁

PRATHAMU200 commented 1 month ago

@sengiv , I very well understood what you said and agree with it too πŸ™‹β€β™‚οΈ, even i was going to discuss the issue related to speed of you website⚑. Maybe using too many frameworks not only making site slow but making really hard to understand and debug the code.

Also i like this project very much trust me and i am happy to be a part of it, wanted to contribute in a bigger project from scratch. It will be a great idea to build together working with a team rather than working alone. 🀩SO Lets build it I AM IN πŸ’―.

You seems to be more experienced and i really want to learn from you experience and give all what i can give to team. Also it seems the project line up with my idea of opensource and i really like how you made it opensource for so much years. Lets build this time something more stable bigger and more usefull.

Edit:: Is there any official group or something for this project like on discord or slack? So we can connect & discuss the project and start with it?

sengiv commented 1 month ago

@PRATHAMU200 See you in Slack....

Slack Invite Link -- https://join.slack.com/t/vedastro/shared_invite/zt-1u7pdqjky-hrJZ7e3_vM2dZOmVY8FeHA

avinashkr29 commented 1 month ago

Alright so, it is a known issue now. I tried again today to add a person suing API, and got the same results. Get call to URL : https://api.vedastro.org/AddPerson/OwnerId/<my_id>/Name/Random_Name/Gender/Male/Location/Japan/Time/13:21/01/02/2020" Response: {'Status': 'Fail', 'Payload': "The type initializer for 'VedAstro.Library.AzureTable' threw an exception."}

sengiv commented 1 month ago

@avinashkr29 πŸ™ thanks again for reporting.....at least now I know people are eagerly waiting, will try to fix ASAP πŸ˜πŸš€

@avinashkr29 on a unrelated note.....are you the one who lives in Japan? or was trying to parse Japanese city names and got errors?