Giter VIP home page Giter VIP logo

astrology-api's Introduction

astrology-api

Node.js CI Coverage Status GitHub tag (latest SemVer)

Getting started

Prerequisites

  • Nodejs >= 14 (also you can use docker)
  • python (python is used for node-gyp to compile c++ swiss ephemeris library)

Setup

  1. You need to install dependencies of node-gyp depending on your OS. Follow the instructions to install it depending on your OS https://github.com/nodejs/node-gyp#installation

  2. Clone the repo

    git clone [email protected]:ryuphi/astrology-api.git
  3. Install dependencies

    without Docker
    npm install
    npm start

    Also you can use npm run dev, this option run with nodemon to watch changes.

Usage

Example: Get the horoscope for date 1993-08-06, time 16:50:00 with timezone -04:00 at Santiago, Chile (latitude -33.41167 and longitude -70.66647) using Placidus houses system.

Fist, you need to transform the date & time to ISO8601, for this example 1993-08-06T16:50:00-04:00.

Second, you must escape the date and time when you make the request. This is because if the time zone is with a positive sign, for example +05:00, when sending it through the request, the url will take the + sign as a space and not as the + sign. For this example it would be 1993-08-06T16%3A50%3A00-04%3A00. See issue #10

If you don't want to escape the date and time, you can always send it to UTC 🙂

In UTC: 1993-08-06T20:50:00Z

Then, you need to select the house system from the houses system table.. in this case for the placidus system you need to send the P value in the houseSystem query param.

Now you can send this...

Using cURL
# escaped
curl --request GET \
  --url 'http://localhost:3000/horoscope?time=1993-08-06T16%3A50%3A00-04%3A00&latitude=-33.41167&longitude=-70.66647&houseSystem=P'
# in utc
curl --request GET \
  --url 'http://localhost:3000/horoscope?time=1993-08-06T20:50:00Z&latitude=-33.41167&longitude=-70.66647&houseSystem=P'

House system table

The values from each house system is extracted from sweph source code

Code value House system
A equal
B Alcabitius
C Campanus
D equal (MC)
E equal
F Carter poli-equ.
G Gauquelin sectors
H horizon/azimut
I Sunshine
i Sunshine/alt.
K Koch
L Pullen SD
M Morinus
N equal/1=Aries
O Porphyry
Q Pullen SR
R Regiomontanus
S Sripati
T Polich/Page
U Krusinski-Pisa-Goelzer
V equal/Vehlow
W equal/ whole sign
X axial rotation system/Meridian houses
Y APC houses

astrology-api's People

Contributors

dependabot[bot] avatar ryuphi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

astrology-api's Issues

The API is returning incorrect data

Many thanks to author for creating this. I think I am doing something wrong and nothing to do with this project.

I have the following details
27-Apr-1979
06.45 AM
Meerut (Uttar Pradesh)
+5.30

I setup the project locally and pass the information
Got the longitude/Latitude values from here https://www.latlong.net/

http://localhost:3000/horoscope?time=1979-04-27T06%3A45%3A00%2B05%3A30&latitude=28.984463&longitude=77.706413

Unescaped URL (for ref only)
http://localhost:3000/horoscope?time=1979-04-27T06:45:00+05:30&latitude=28.984463&longitude=77.706413

The result I am getting is incorrect, like Sun degree is 6 degree and sign is 2 which is incorrect. Kindly help with this, not sure what I am doing wrong.

Correct data

image

House calculations and planet longitudes not matching with Swiss Ephemeris

The effort put in by you is appreciable. However, when I checked with Swiss Ephemeris the results are at variance. To test it, I used following data: date =11th May 2000, place longitude 78.00, Latitude 13.00, Time 5:30AM Time zone +5:30 i.e. UT=0.00 , House system=Placidus
So the test url was :
https://dev-astrology-api.herokuapp.com/horoscope?time=2000-05-11T05:30:00%2B05:30&latitude=13.000&longitude=78.000
The Ascendant result was "{"asc":{"position":{"degrees":13,"minutes":17,"seconds":25,"longitude":43.29034759846253},"sign":2}"
While using test page of astro.com, https://www.astro.com/swisseph/swetest.htm with following "Option = -b11.05.2000 -p -house78.00,13.00,P -ut0:00" the result obtained are as follows:
/ulb/swetest -b11.5.2002 -n1 -s1 -fPLBRS -pp -eswe -b11.05.2000 -p -house78.00,13.00,P -ut0:00
date (dmy) 11.5.2000 greg. 0:00:00 UT version 2.10.01a
UT: 2451675.500000000 delta t: 63.931325 sec
TT: 2451675.500739946
geo. Long 78.000000, Lat 13.000000, alt 0.000000
Epsilon (t/m) 23°26'16.8419 23°26'21.2387
Nutation -0° 0'16.2303 -0° 0' 4.3967
Houses system P (Placidus) for long= 78° 0' 0.0000, lat= 13° 0' 0.0000
house 1 43°17'21.1025 394° 5'19.7268
house 2 72°11' 5.8018 344°39' 3.5695
house 3 98°14'41.3484 330°45'22.6552
house 4 124°44'25.4895 351°24'55.2438
house 5 154°26'51.7827 393°54'22.7902
house 6 188°15'42.1466 419°56'24.2202

Another software (using Swiss Ephemeris) gives exactly same House positions as above. But the result given by your implementation has a difference of about 4" of arc.

Please check and revert back.

Gracias!

Encontré tu trabajo por casualidad
investigando recursos para una App que quiero montar simulando el sistema solar.

Quedé asombrado con este trabajo:
https://github.com/eleanorlutz/asteroids_atlas_of_space
y voy a esforzarme por modelar bien un software que considere varias fuentes de datos, las procese con opciones flexibles y rinda como Cliente Web.

Ojalá mantengamos contacto para motivarnos en este tipo de proyectos
pues también me gustala astrología y quisiera mejores herramientas.
Saludos!

Got error while installing node modules

Error: Cannot find module 'C:\Workspace\Projects\astrology-api\node_modules\swisseph\lib/../build/Release/swisseph.node'
Require stack:

  • C:\Workspace\Projects\astrology-api\node_modules\swisseph\lib\swisseph.js
  • C:\Workspace\Projects\astrology-api\src\astrologer\astros.js
  • C:\Workspace\Projects\astrology-api\src\astrologer\index.js
  • C:\Workspace\Projects\astrology-api\src\api\index.js
  • C:\Workspace\Projects\astrology-api\app.js
  • C:\Workspace\Projects\astrology-api\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (C:\Workspace\Projects\astrology-api\node_modules\swisseph\lib\swisseph.js:1:16)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Workspace\Projects\astrology-api\node_modules\swisseph\lib\swisseph.js',
    'C:\Workspace\Projects\astrology-api\src\astrologer\astros.js',
    'C:\Workspace\Projects\astrology-api\src\astrologer\index.js',
    'C:\Workspace\Projects\astrology-api\src\api\index.js',
    'C:\Workspace\Projects\astrology-api\app.js',
    'C:\Workspace\Projects\astrology-api\index.js'
    ]
    }
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.