Skip to content
Prithwis Mukerjee edited this page Sep 27, 2022 · 26 revisions

Overview

Parashar21 is scheme to store horoscope chart data, not just as an image, but in a manner that can retrieved on the basis of one or more conditions. The conditions include but are not limited to aspects, conjuncts, exaltations, debilitations of grahas (or planets) and bhavs (or houses) as defined in Hindu astrology. Since these qualities or features of the horoscope chart are being stored, the same can be used to detect the presence of specific Yogs as well. The motivation behind this project is articulated in this LinkedIn article Astrology - An application of Data Science. The technical architecture, including the data structure used to store a horoscope chart as a JSON object in a MongoDB database are available in article Efficient storage and retrieval of horoscope data on a computer system. A case study using Python and MongoDB

Components

Given the complexity of the exercise, we have tried to break up the project into a set of reasonably independent modules that are explained below. Data is exchanged across these modules using global variable stored in py21.py.

1 Cast Horoscope Chart

Horoscope data is provided in the form of a CSV file with the following columns:
Gender,tag1,tag2,tag3,tag4,tag5,tag6,DoB_Day,DoB_Mon,DoB_Year,DoB_Time,TZ_Off,TZ_OffHours,PoB_Lat,PoB_Lon,TZ_Name,TZ_Type,Name
where the column names are self-explanatory. The 6 tags are strictly for documentation purposes and only 3 are captured but not used for any computation. They can be used to store any text information about the person. This CSV file is converted into a Pandas dataframe for subsequent processing

One or more rows of the CSV file are processed to create the basic horoscope consisting of the Longitudes of the grahas and their Retrograde status. This is done with the Python version of the Swiss Ephemeris software, as documented here using the user-defined functions in the library p21swe.py.

This module defines a basic horoscope in terms of the Longitude and Retrograde status of Grahas and of the Lagna, as captured in two Python dictonaries GLon, GRet. In case the Swiss Ephemeris software is no more available, or undergoes changes that are not backward compatible, then this component of the software must be rebuilt, to generate GLon, GRet.

2 Determine Position / Aspect / Conjunct (PAC)

The basic horoscope created in the previous step is used to determine more detailed positions, aspects and conjuncts. These are stored as dictionary p21.chart and then as JSON object whose structure is described in selCols variable in the p21.py file. This object, or a collection of similar objects, will be stored in a MongoDB file and retrieved.

The p21.chart dictionary is built up by adding or appending additional dictionaries to a base dictionary called p21.chart through successive functions defined in the p21utils.py.

Once the p21.chart dictionary is complete, it is stored in a JSON file

3 Load into MongoDB

The JSON file that is created in the previous step is next loaded into a MongoDB database. This could be a local database or a remote, hosted database for which login credentials are required. Steps 1 - 3 are implemented in the Google Colab Notebook, P21_45_01_Cast_Load.ipynb However, the credentials used in this demo are stored in the author's private G-Drive and cannot be used by public users, who need to have their own credentials.

4 Retrieval of Data

Horoscopes stored as JSON objects stored in the MongoDB database can be selectively retrieved using the query features of MongoDB query language

Retrieval of Charts with specific astrological Yogs

p21_45_04_YogFilter demonstrates how charts with specific Yogs can be filtered out from the database. Yogs are specified in the file p21YogInfo.py

5 Printing Reports

Once the horoscopes are retrieved from the MongoDB they need to be parsed so that the data recovered can be printed in human readable format. The functions required for these functions are stored in p21utilsR.py
A sample programs that demonstrate this retrieval and printing function is available at P21_45_02_Pull_Print This retrieves data from a remote, hosted MongoDB instance

Test Data

For testing purposes, we have a CSV file containing the birth data of 39663 persons sourced from Astro Databank Wiki. In addition to the required data on date, time, place of birth the file also contains limited information about the Vocation of the persons.

Limited Testing

The notebook P21_45_06_SingleChartDetails has the birth data of a few well known Indians and can be used to cast and analyse charts for these people. Additional data can be entered here to generate charts for any other person.