VedAstro / VedAstro.Python

A Python Libray for Vedic Astrology calculations.
https://vedastro.org
MIT License
24 stars 18 forks source link

Bhava Chart API #16

Open Pablo-korea opened 1 month ago

Pablo-korea commented 1 month ago

Sir! I want to make a Bhava Chart. But I can not find API. what is the api for bhava chart?

sengiv commented 1 month ago

@Pablo-korea thank you for your interest πŸ™πŸ™ (this is what keeps the project going)

There is only 1 code base calculating Bhava Chart (South/Indian D1,D2... Chart) --> CODE

But there is 2 ways to access the same code

  1. API --> https://vedastroapi.azurewebsites.net/api/Calculate/SouthIndianChart/Location/Delhi,India/Time/12:05/13/11/2026/+05:30/Ayanamsa/LAHIRI
  2. Python --> it should be possible, look for method named Calculate.SouthIndianChart(...)
  3. C# --> similar to Python, call method directly Calculate.SouthIndianChart(...)

PS: I recommend you use the API, it is free & you can support the project πŸ’ŒπŸ™πŸ˜Š

Pablo-korea commented 1 month ago

Thank you for the prompt response. The Bhava chart has been successfully generated as follows.

image

I have one more question. Could I return the house numbers of the planets in the Bhava chart in a JSON format as shown below? { "bhava_planet_data": [ { "name": "Ma", "houseno": 1 }, { "name": "Sa", "houseno": 2 }, { "name": "Mo", "houseno": 3 }, { "name": "Ke", "houseno": 4 }, { "name": "Asc", "houseno": 6 }, { "name": "Ju", "houseno": 9 }, { "name": "Ra", "houseno": 10, "name_kor": "라후" }, { "name": "Su", "houseno": 11, "name_kor": "νƒœμ–‘" }, { "name": "Me", "houseno": 11 }, { "name": "Ve", "houseno": 12 } ] }

sengiv commented 1 month ago

πŸš€πŸ₯° Awesome that you got it working! (i was afraid the library was broken πŸ˜…)

@Pablo-korea please post your working code for Bhava Chart so others can be helped too πŸ™πŸ™

As for the JSON output, it is technically possible with 1 method call after the Calculate.... call (but i forgot 🀯, it should be something like ToJson() or Tools.AnyToJson() )

Also missed to mention earlier that there is an EASY Python Code Generator (not fully tested, & you'll have to use under construction access) --> HOW GUIDE

image

API CALL https://vedastroapi.azurewebsites.net/api/Calculate/HousePlanetOccupies/PlanetName/All/Location/Singapore/Time/00:00/29/09/2024/+08:00

OUTPUT

{
"Status": "Pass",
"Payload": {
"HousePlanetOccupies": [
{
"Sun": "House4"
},
{
"Moon": "House3"
},
{
"Mars": "House2"
},
{
"Mercury": "House4"
},
{
"Jupiter": "House1"
},
{
"Venus": "House5"
},
{
"Saturn": "House10"
},
{
"Rahu": "House10"
},
{
"Ketu": "House4"
}
]
}
}

If the above output does not suite your needs 🫠 There is 430 calculate methods, you can experiment and find the one you need. image

PS: Based on your sample output & your name, looks like your from the wonderful land of Korea 🌸☯️? Truly happy to see Vedic Astrology practiced all over the world πŸŒπŸ˜„ I hope it is of great use to you.

Pablo-korea commented 1 month ago

Hi! Good Morning As I mentioned last time, I created the Bhava chart as follows, but the result is coming out the same as the Rashi chart.

bhavachart = Calculate.SouthIndianChart(birth_time,chart_type='Bhava')

So, I tried giving 'Test' as a parameter, but the result still comes out as the Rashi chart. Therefore, I believe the Bhava chart parameter is not being passed correctly

bhavachart = Calculate.SouthIndianChart(birth_time,chart_type='Test')

I would appreciate your input on how to pass the parameters correctly to generate the Bhava Chart.

sengiv commented 1 month ago

@Pablo-korea if I'm not mistaken Rasi chart is already coded, and Bhava chart is "WIP" left with TODO comment. To implement it, you'll need to touch the C# code, in main repo.

Don't let that scare you, it should be very easy....and I sincerely wish I could do it for you. But unfortunately, the planets are extremely not favorable too me now, I'm having Rahu, Ketu, Rahu, Saturn Dasa stacked now. πŸͺ (hence even the site I can't bring up, even after much trial) Mercury which is needed for coding is completely nullified now....I hope you don't see this as an excuse for the delays (just want you to know why I can't help you with code now)

But don't worry my bad planets won't last forever, in December, there is some improvements. And I'll definitely help implement the code, as soon as I'm able to. πŸ™

sengiv commented 1 month ago

@Pablo-korea after a quick check....I'm starting to think there is a misunderstanding in terms here. What do you mean exactly when you say "Bhava Chart"? image Above are all the possible chart types. Basically the same as D1, D2, D3.... Thus by this logic. "Rasi" == "D1" == "Bhava" If you meant to say "Bhava Chart" is the method by which planets are grouped into houses by degrees instead of by a sign. Then that lies at deeper level in the logic. Technically it is possible, to alter that as well via a flag.

Pablo-korea commented 1 month ago

@sengiv I sincerely thank you for your prompt response. I learned that even when using the same birth information, the Rashi Chart and Bhava Chart can yield different results because they interpret the position and influence of the planets in different ways. Therefore, I learned that especially in the case of the Bhava Chart, Dasha-Bhukti analysis is conducted based on it. So, I am planning to create a separate Bhava Chart apart from the Rashi Chart. Previously, I implemented the Rashi Chart and Bhava Chart using the Prokerala API as follows.

image

I am now considering using VedAstro instead of Prokerala.

sengiv commented 1 month ago

Yes, both methods are equally valid and it depends on the astrologer's preference.

APIs for both exist, as visible in screenshot below :

image

https://vedastroapi.azurewebsites.net/api/Calculate/PlanetsInHouse/HouseName/All/Location/Singapore/Time/00:00/01/10/2024/+05:30

PS : @Pablo-korea I'm very happy to see that you like the quick responses πŸ˜πŸŽοΈπŸƒβ€β™‚οΈ. I do try hard to reply ASAP. People often think that open source or non-profits are slow & unreliable....this should not be the case. I'm just following in the footsteps of Brother La Salle, who created 100% free schools in 1600s, and today they are some of the best schools in the world and still FREE & OPEN FOR ALL...πŸ€—

sengiv commented 1 month ago

πŸ€” @Pablo-korea are you still waiting on me to add an extra parameter to allow bhava chart (for SVG charts output) or is the existing calculate methods (JSON output) sufficient for you?