Helping people and businesses move smart with data.

Solving real-world problems with competence, logic, and code.

ABOUT ME

Hi, I’m petar stanic, a data scientist dedicated to transforming complex data into clear, actionable insight.
With a solid background in analytics and machine learning I specialize in building predictive models, designing intuitive visualizations, and creating data-driven solutions that solve real-world problems.

personal project

FERTILITY AND PREGNANCY CALCULATION WEBSITE

Overview of the Fertility Calculator Flask API

The script is a Flask-based API designed to calculate fertility dates. It starts by importing essential modules: Flask, request, and jsonify for web server functionality, datetime and timedelta for date calculations, and CORS from flask_cors to handle cross-origin requests—useful when the frontend and backend are on different domains.


App Setup

The Flask app is initialized with app = Flask(__name__), and CORS is enabled via CORS(app) to allow external client communication.


/calculate Endpoint

A POST endpoint, /calculate, is defined to process fertility calculations. When a POST request is received, the function extracts two values from the JSON body:

  • cycle_length (integer): The length of the menstrual cycle.
  • last_period (date string): The date of the last menstrual period.

Fertility Date Logic

Using the input:

  • Ovulation Date = last_period + (cycle_length - 14)
  • Fertile Window = Starts 5 days before ovulation, ends 4 days after

These dates are calculated using datetime operations.


Response Format

The API returns a JSON object with:

  • ovulation_date
  • fertile_window_start
  • fertile_window_end
    All dates are in ISO string format.

Running the App

If the script is run directly, it launches the Flask server on 0.0.0.0:5002, making the API accessible from any IP on that port.


MICROSERVICE

A standalone service focused on function, e.g., user authentication or order processing, built for scalability and fast deployment.

WEB TECH CODING

A clean, well-structured code, responsive layout, and basic interactive elements. The focus is on functionality, readability, and adherence to web development best practices.

EMAIL : [email protected]
PHONE NUMBER : 07305134250
LOCATION: LONDON.