SampleSampletypeA worked example you read or clone. Evidence: it demonstrates, it never provides.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Reference

analytics-cloud-rpt15-prediction-demo

A FastAPI backend that triggers SAP-RPT-1.5 payment-delay predictions from an SAP Analytics Cloud Multi Action and writes the results back to HANA.

Calling a predictive model from SAP Analytics Cloud needs an intermediary that SAC's asynchronous External API step can poll, and this project is that intermediary: a FastAPI service on the Cloud Foundry runtime that reads every row of a V_PAYMENT_DELAY_PREDICTION view in SAP Datasphere or SAP HANA Cloud, sends the rows whose Days_Late is null to an RPT-1.5 deployment on SAP AI Core with the scored rows alongside them as context, and upserts the predicted value and confidence interval into a staging table for the SAC story to read. A Multi Action button starts the job and polls a second endpoint until it reports done. It answers one scenario, payment-delay prediction, and needs its own SAP AI Core, Datasphere or HANA Cloud and Cloud Foundry setup already in place.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Demonstrates
Predictive modelsBTPPredictive modelscapabilityTraining, deploying and calling a model that predicts a value from tabular business data: a classification, a regression, a forecast. Distinct from [LLM integration](capability:llm-integration), where a language model generates text, even where both run on the same service.
Requires
SAP AI CoreSAP AI Coreartifactthe RPT-1.5 Large deployment the service calls for every predictionSAP BTP, Cloud Foundry RuntimeSAP BTP, Cloud Foundry Runtimeartifactthe space the FastAPI service is deployed to; the README gives no other deployment target
Optional
SAP DatasphereSAP Datasphereartifactwhere the V_PAYMENT_DELAY_PREDICTION view and the staging table live, when the data sits in DatasphereSAP HANA CloudSAP HANA Cloudartifactwhere the V_PAYMENT_DELAY_PREDICTION view and the staging table live, when the data sits in HANA Cloud

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerjonas-200PersonContributes to this
In the atlas: contributes to 1
@jonas-200
1 contributor

What it declares

Every artifact

Type
Sample
Origin
By SAP
Use as
A reference

As a sample

Form
A reference application

Connections8

analytics-cloud-rpt15-prediction-demo connectionsanalytics-cloud-rpt15-prediction-demoPROVIDES→ demonstrates1demonstrates authoredPredictive modelsNEEDS→ connects to3connects to stated sends the rows to predict with the already-scored rows as context, and takes the predicted value and confidence interval back SAP-samples/analytics-cloud-rpt15-prediction-demo — README: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demo SAP-samples/analytics-cloud-rpt15-prediction-demo — README, data processing: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP AI Coreconnects to stated SAC opens the connection: a Multi Action starts the job, polls it, and brings the predicted values into the story SAP-samples/analytics-cloud-rpt15-prediction-demo — README: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP Analytics Cloudconnects to stated If: the data sits in SAP Datasphere; the README's requirement names SAP Datasphere or SAP HANA Cloud reads every row of the V_PAYMENT_DELAY_PREDICTION view and upserts the predictions into a staging table SAP-samples/analytics-cloud-rpt15-prediction-demo — README: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demo SAP-samples/analytics-cloud-rpt15-prediction-demo — README, results: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP Datasphereif→ needs2needs stated the RPT-1.5 Large deployment the service calls for every prediction SAP-samples/analytics-cloud-rpt15-prediction-demo — README, Requirements: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP AI Coreneeds stated the space the FastAPI service is deployed to; the README gives no other deployment target SAP-samples/analytics-cloud-rpt15-prediction-demo — README, Requirements: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP BTP, Cloud Foundry Runtime→ optionally needs2optionally needs stated If: the requirement names SAP Datasphere or SAP HANA Cloud; this is the Datasphere half of that choice where the V_PAYMENT_DELAY_PREDICTION view and the staging table live, when the data sits in Datasphere SAP-samples/analytics-cloud-rpt15-prediction-demo — README, Requirements: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP Datasphereifoptionally needs stated If: the requirement names SAP Datasphere or SAP HANA Cloud; this is the HANA Cloud half of that choice where the V_PAYMENT_DELAY_PREDICTION view and the staging table live, when the data sits in HANA Cloud SAP-samples/analytics-cloud-rpt15-prediction-demo — README, Requirements: https://github.com/SAP-samples/analytics-cloud-rpt15-prediction-demoSAP HANA Cloudif

README

quoted from SAP-samples/analytics-cloud-rpt15-prediction-demo under Apache-2.0, read
SAP-samples/analytics-cloud-rpt15-prediction-demo/README.mdOn GitHub

RPT-1.5 Payment Delay Prediction — SAP Analytics Cloud Demo

REUSE status

Description

Run RPT-1.5 predictions directly from SAP Analytics Cloud (SAC).

This project is the backend for an end-to-end setup that predicts how many days late a customer will pay. RPT-1.5 is deployed in SAP AI Core, the data lives in SAP Datasphere, and this FastAPI service — deployed to Cloud Foundry — wraps the prediction call. From SAC, a Multi Action button triggers the prediction, polls for the result, and writes the predicted values back so they show up in a story.

How it works
SAC Multi Action  ──POST /predict──▶  FastAPI (Cloud Foundry)
      │                                     │
      │                                     ├─ read V_PAYMENT_DELAY_PREDICTION (Datasphere / HANA)
      │                                     ├─ call RPT-1.5 deployment (AI Core)
      │                                     └─ write predictions → PREDICTION_RESULTS (HANA)
      │                                     │
      └──GET /predict/{job_id}──poll──────▶ status / result
  1. SAC calls POST /predict, which starts a background job and returns a jobId plus a Location header (async pattern SAC's External API step expects).
  2. The job reads every row from the V_PAYMENT_DELAY_PREDICTION view. Rows with a NULL Days_Late are marked [PREDICT]; all other rows are sent as context so RPT-1.5 can make accurate in-context predictions.
  3. Predictions (value + confidence interval) are upserted into a staging table (<HANA_USER>.PREDICTION_RESULTS).
  4. SAC polls GET /predict/{job_id} until the job is done, then reads the results back into the story.
Project structure
FilePurpose
main.pyFastAPI app — async /predict (start job) and /predict/{job_id} (poll), with HTTP Basic auth
prediction.pyReads from HANA, builds the RPT-1.5 payload, calls the AI Core deployment, writes results back
manifest.yamlCloud Foundry deployment manifest
requirements.txtPython dependencies
.env.exampleTemplate for required environment variables
test.ipynbNotebook for local experimentation
API

All endpoints require HTTP Basic auth (API_USERNAME / API_PASSWORD).

MethodPathDescription
GET/Health check → {"status": "ok"}
POST/predictStart a prediction job. Returns 202 with jobId and a Location header
GET/predict/{job_id}Poll job status → running / done / failed, plus predicted count

Requirements

  • SAP AI Core with an RPT-1.5 Large deployment
  • SAP Datasphere / SAP HANA Cloud with a V_PAYMENT_DELAY_PREDICTION view
  • Cloud Foundry space (SAP BTP) for deployment
  • Python 3.10+

Download and Installation

Run locally
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env   # then fill in your values
uvicorn main:app --reload

Run the prediction pipeline directly (without the API):

python prediction.py
Deploy to Cloud Foundry
cf push

Set the environment variables in Cloud Foundry (e.g. cf set-env rpt1-demo <KEY> <VALUE>) or bind them through a service — do not commit your .env.

Configuration

Copy .env.example to .env and fill in the values:

  • SAP HANA Cloud — HANA_HOST, HANA_PORT, HANA_USER, HANA_SCHEMA, HANA_PASSWORD
  • SAP AI Core — AICORE_AUTH_URL, AICORE_CLIENT_ID, AICORE_CLIENT_SECRET, AICORE_BASE_URL, AICORE_RESOURCE_GROUP, RPT1.5LARGE_DEPLOYMENT_ID
  • API auth — API_USERNAME, API_PASSWORD

Known Issues

No known issues.

How to obtain support

Create an issue in this repository if you find a bug or have questions about the content.

For additional support, ask a question in SAP Community.

Contributing

If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.

License

Copyright 2026 SAP SE or an SAP affiliate company and analytics-cloud-rpt15-prediction-demo contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.

Apache-2.0, read

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/analytics-cloud-rpt15-prediction-demotree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, ai-and-agents
Contributors1

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-analytics-cloud-rpt15-prediction-demo
JSON
/artifacts/sap-samples-analytics-cloud-rpt15-prediction-demo.json
MCP
Connecting an agent