Planning Platform - ariel-fer/Araena GitHub Wiki

TOC

Questions

Suggestions

Data

  • It seems some stock quantity is expressed in KG and others in G, maybe others in other measures. we need to point this out in the graph and in the table

Some materials dont have data or they tend to 0 in stock/demand. we might need to review what to do with them (remove those materials, add an alert, etc)

  • 1010285 - PC4008; nnumbers tend to 0
  • 1020987 - DEHYDROASCORBIC ACID (DHAA): numbers tend to 0
  • 1026526 - CNS-enzyme: all numbers are 0
  • 1026530 - 40K PSC: stock total is 0. need to review if this should be right or not
  • 4481762 - Repaglinide Tabl. 0,25mg Japan: all numbers are 0
  • 4481764 - Repaglinide Tabl. 0,5mg Japan: all numbers are 0
  • 4481771 - Repaglinide Tabl. 1 Mg: numbers too high on each month
  • 5185090 - Sema C 0.5mg/Ml,Pfs 0.5ml: 0s until the very end of 2026
  • 5185290 - Sema C 1.0mg/Ml,Pfs 0.5ml: only quarantine data available
  • 5185301 - Sema K 9.6 MG/ML 0.75ML Pfs: numbers tend to 0

Graph

  • needs thousand separator. no need for the MOH axis on the right and the yellow line. just adding MOH on the X axis should be enough
  • columns until Stock Total should be fixed on the scroll
  • If the idea of the app is to compare 2 materials, the graph should have a fixed measure in the Y-axis

_calculatePercentageOfSS This function is basically defined just to multiply a list of safety stock rolling month. it can be included already in the original function that does that already, and this should be done using Dataframe methods. same happens with many other methods used in this app.

  • _sumOfQmLots is being used using double nested loops, and it can be resolved by using a method from pandas dataframe to aggregate data

StockQueryHandler

  • It seems the stock data is read twice, and filtered twice just to filter based on released vs quarantine. we should do something different to read it only once.

Scenarios

  • After trying to save one, the modal closes but the save/ save changes is not removed. seems like something is stuck there
  • Refreshing data makes the table to start being editable again. not sure if that should happen
  • when refreshing data, the MOH seems to change in the KPIs on the right. this is clearly a bug
  • when clickin on "Create Scenario", if one clicks on Save, gives a name and clicks Save again on the modal fast enough, this error appears:

image.png

Overall

  • Parquets are fully read, then filtered by columns and its data. it could be benefitial to do that already while reading the Parquet file
    • Some QueryHandlers are not filtering from the beginning by date, so it should be better to do it.
  • Loading animation for almost all actions that can be done on the app

Application description

It displays the supply chain progress, showcasing for a particular Material selected what is the stock available, the demand forecasted and based on that, analyzes how many months in the future the current available stock can supply the forecasted demand. It also allows the user to create some scenarios based on filters selected, which are:

  • Forecast by Month/week
  • MOH Target
  • Vendor
  • Plant

#Vocabulary

Word Description
Plants Related to Years. still to confirm
Material Material name
Lot
Batches Material Stock lots that seem to be filtered/discarded by the app due to some reason.
Resolution Date aggregation used for the data
Scenario Group of Filters and specific cells edited to showcase a particular snapshot of data
Moh Month on Hand
findHitsBelowSS number of times in an x amount of periods (defined by MOH) that the Stock forecasted is below the 25% Safety Stock Measure
findHitsAboveSS number of times in an x amount of periods (defined by MOH) that the Stock forecasted is above the 150% Safety Stock Measure
qtyToBeReceived
sumOfQtyToBeReleased
qmLots QM lots stands for "Inspection lot for quality management". When a quantity is in quarantine it will be tested and afterwards moved to the released status. it can consist of multiple batches or part of a batch, depending how big they are.
LtfDemand
POs

Application/Business analysis

Use cases

  • Load Scenarios list
  • Create Scenario (Allows table to be modified)
  • Save Scenario (Stores current table edits and filters)
  • Load Scenario
  • Refresh Data: - Pulls up again all data and re-calculates values for a scenario. If the Scenario had been created by an old app version, data that was not stored will then be filled by the data refresh executed.
  • Filter by Material, Resolution, Forecast in years, Moh, Vendor, Plant

Measures

Measure Description Affected by
Stock Released Amount of stock available - demand + qmLots
Stock Quarantine Amount of stock available - qmLots + openPOsToBeReceived
Demand Forecast Represents the demand that corresponds to the current period only
Demand Cumulative Sum Represents the cumulative demand from the first period until the current
Quantity to be released Related to QmLots. Defines the amount of product available
Quantity to be received Related to future product that will be available
Stock/SS ratio Multiplier of how many times the Stock calculated on the current month is superated by the Safety Stock Stock Released
25% SS 0.25x of the Safety Stock calculated. I assume this is because they want to set a lower limit of danger
150% SS 1.5x of the Safety Stock calculated. I assume this is because they want to set a higher limit where stock is too much available
SS rolling 1 months Calculates the Safaty Stock required for that month, based on the sum of the demand forecast of the current month and the consecutive x-1 months. x being dynamically set based on the MOH set as parameter.
MOH Month on hand identification number for a specific month. this should not be displayed if choosing the Week view. It represents how many months in the future the stock will satisfy the demand Stock Released

APIs

Url Description Notes
stockProfile_View Used on the first page load
materialSelect When choosing a material from the List, this executes after selection
tableEdit When trying to modify any of the editable cells
filters When trying to load Filters
applyFilters After Clicking on Apply Filters button from the dropdown
createScenario When clicking on "Create Scenario"
saveScenario
updateScenario
getScenarioList When Clicking in "View Scenarios"
loadScenario
deleteScenario Clicking on "Delete Scenario" From the Scenario "View Scenarios" view
health

Command Handlers (Write only)

Entity Description (Dev) Description (Ariel)
deleteScenarioCommandHandler When deleting one of the scenarios from the list of scenarios
saveFilterCommandHandler When Applying Filters. These are stored globally as a single file
saveScenarioCommandHandler Used when saving an scenario. Scenarios are saved by Material Number

Query Handlers (Read only)

Entity Description (Dev) Description (Ariel)
MaterialListQueryHandler Retrieves a list of materials for the filter
FiltersQueryHandler Retrieves current Filters selected & stored. there is a SaveFilterCommandHandler that stores them first when put_applyFilters is called
TableDataRetriever Centralized handler that calls many others to prepare the full data set.
BatchesQueryHandler Retrieves batches from vendors that need to be excluded due to an external reason
StockQueryHandler We shouldn't look much into this, is basically what is on the warehouses right now. Retrieves and processes stock data for a given material number and stock status while optionally excluding certain plants and batches
DemandQueryHandler This gives the first of the month demand and what month it is. One entry per month, at the beginning of the month, with the demand per month. In this story https://dev.azure.com/ADO-Agile2/GCM%20Digital/_workitems/edit/51408 we can obtain a de-aggregated way to get the demand from another place and there is some sample code that can be used to retrieve the demand per week. There are different codes to look for, which are what it is "the demand". And when we get that we would get the demand for an specific date (meaning day), and not for the beginning of the month like the demand query handler. Retrieves demand data for a specific material, processes it, and returns it in a structured format as a DemandQuery object.
LtfDemandQueryHandler This is for Long Term Forecast, so Stig doens't think we should look into this.
LeadtimeQueryHandler It's given in days. It is used to calculate when the given batch is moved from one store location to another store location. This is because it comes with a quarantee first, and then it will be released for use. Then we calculate the lead time for when it comes and when we can use it (when it is released for use). This is basically what we do on the next query handlers ReceivedQtyQueryHandler and BatchesQueryHandler.
OpenPosQueryHandler Source not used anymore Source not used anymore
ClosedPOsQueryHandler Source not used anymore Source not used anymore
PlantsQueryHandler
VendorQueryHandler
ReceivedQtyQueryHandler It's basically batches that are coming into warehouses, it's quantity that will be put in quanranteen. We use it for calculating the row for quantity to be received in the UI, but also used to calculate the stock in quarantee.
OpenPOtoExcludeQueryHandler This is a list where batches are excluded if they don't want to look at an specific vendor. If we don't want to look at a vendor we need to separate those batches from what we are looking at. I think it is a parameter for BatchesQueryHandler so these are excluded from them.
QmLotQueryHandler This is an element to for when an specific quantity is moved out of quaranteen to released. There is a row which is the quantity to be released and this i sgoing to say, we substracted from the quarantee and we added to the quantity on the pool. Retrieves and processes "QM lot" (Quality Management lot) stock requirement data for a specific material number from an S3 data lake and returns a QmLotQuery object, with a list of Receipt_Requirement_Quantity and another list for Receipt_Requirement_Date.
ScenarioListQueryHandler Retrieves list of scenarios (only read, does not write any scenarios from here)

Sources

Entity Date aggregation Bucket Parquet
FiltersQueryHandler No dates used planningplatform PlanningConfig/saveFilter.parquet
ScenarioListQueryHandler N/A planningplatform SaveScenarios/ + materialNumber + /savedScenario.parquet
SaveScenarioCommandHandler N/A planningplatform SaveScenarios/ + materialNumber + /savedScenario.parquet
BatchesQueryHandler No dates used cmo-datalake-ada-curated Batches/ada.dso.scm_fact_dw_gcm_batches.parquet
MaterialListQueryHandler No dates used cmo-datalake-ada-curated Material_Vendor/ada.dso.scm_dim_dw_gcm_material_vendor.parquet
VendorQueryHandler No dates used cmo-datalake-ada-curated Material_Vendor/ada.dso.scm_dim_dw_gcm_material_vendor.parquet
LeadtimeQueryHandler No dates used cmo-datalake-ada-curated Material_Plant/ada.dso.scm_dim_dw_gcm_material_plant.parquet
TableDataRetriever N/A N/A N/A
StockQueryHandler No dates used cmo-datalake-ada-curated Current_Stock/ada.dso.scm_fact_dw_gcm_current_stock.parquet
PlantsQueryHandler No dates used cmo-datalake-ada-curated Current_Stock/ada.dso.scm_fact_dw_gcm_current_stock.parquet
DemandQueryHandler YEAR_MONTH is being used to aggregate data. we need less aggregation to work at weeks level cmo-datalake-ada-curated Demand/ada.dso.scm_fact_dw_gcm_demand.parquet
LtfDemandQueryHandler Last_Update seems to be at the day level, but not used cmo-datalake-ada-curated Long_Term_Forecast/ada.dso.scm_fact_dw_gcm_long_term_forecast.parquet
OpenPosQueryHandler Source not used anymore cmo-datalake-ada-curated Open_PO/ada.dso.scm_fact_dw_gcm_open_po.parquet
OpenPOtoExcludeQueryHandler No dates used cmo-datalake-ada-curated Open_PO/ada.dso.scm_fact_dw_gcm_open_po.parquet
ClosedPOsQueryHandler Source not used anymore cmo-datalake-ada-curated Closed_PO_Batch/ada.dso.scm_fact_dw_gcm_closed_po_batch.parquet
ReceivedQtyQueryHandler Finish_Av_Date at the day level, but validations done at the month level cmo-datalake-ada-curated Stock_Requirements_List/ada.dso.scm_fact_dw_gcm_stock_requirements_list.parquet
QmLotQueryHandler Receipt_Requirement_Date at the day level cmo-datalake-ada-curated Stock_Requirements_List/ada.dso.scm_fact_dw_gcm_stock_requirements_list.parquet

Data Examples

MaterialListQueryHandler

GCM_Mat_ID GCM_Mat_Name ASL_Mat_Name SAP_Mat_Number Category GCM_Site_ID GCM_Mat_Group_ID Vendor_Number Vendor_Name Plant Phase State Effective_Time Expire_Time ADA_Load_User ADA_Load_Time ADA_Load_Job
1 Enterokinase Light Chain ENTEROKINASE LIGHT CHAIN 1000067 Raw Materials 1 9 35178 AGC BIOLOGICS A/S 2040 Operations True 2018-04-30 1816-03-29 05:56:08.066277376 CYPU 2024-04-09 14:09:25 \amznfsxr0ugknxs.corp.novocorp.net\filesforada\2_DSO\GCM\GCM_Master_Data\Material_Vendor\Material_Vendor.yxmd
2 NNC3027 DC20-GGLU-DIADO-OSU 1000106 Raw Materials 29 20 25099 SIEGFRIED LTD 2040 Operations True 2019-07-08 1816-03-29 05:56:08.066277376 CYPU 2024-04-09 14:09:25 \amznfsxr0ugknxs.corp.novocorp.net\filesforada\2_DSO\GCM\GCM_Master_Data\Material_Vendor\Material_Vendor.yxmd

using only: 'SAP_Mat_Number', 'GCM_Mat_Name'

FiltersQueryHandler

Material_Number forecastRange MohTarget plantsToExclude vendorsToExclude resolution
5903101 2 14 [] [] None
5903201 2 6 [] [] None

BatchesQueryHandler

Batch_ID Batch Purchase_Order Item Material_Number Vendor_Number Plant Posting_Date Batch_TR_DT Batch_TR_Init Batch_TR_FRM_CD Batch_TR_TO_CD Batch_Status Pending_Release_Date Batch_Released_Date On_Hold ADA_Load_User ADA_Load_Time ADA_Load_Job
1 H5UDP09 1278260 00070 1025701 47419 2040 2018-10-19 2019-05-27 HLQQ Q L Released 2019-05-23 2019-05-27 False psrpalteryx 2024-12-15 00:07:01 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\QC_Batches\QC_Batch_Flow.yxmd
2 H5UEE71 1247749 00010 1021311 25099 2040 2018-11-21 2021-05-19 MENV Q A Released 2019-05-27 2019-06-14 False psrpalteryx 2024-12-15 00:07:01 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\QC_Batches\QC_Batch_Flow.yxmd

StockQueryHandler

GCM_Current_Stock_ID Material_Number Material_Name Plant Plant_Name Plant_Country Stock_Type Stock_Status Storage_Location Batch Stock Unit GCM_Related Status Expiry_Date ADA_Load_User ADA_Load_Time ADA_Load_Job
NaN 1010285 SIDECHAIN PC4008 4212 TM New Hampshire (HQ) US Transit (Plant) Transit Not assigned # 1.047 KG None True None psrpalteryx 2025-02-28 00:04:17 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Stock\Current_Stock.yxmd
NaN 1026836 FMOC-L-HIS-AIB-OH TFA,LS 1843 TM DAPI US WH (HQ) US Transit (Plant) Transit Not assigned # 1408.790 KG None True None psrpalteryx 2025-03-05 00:02:55 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Stock\Current_Stock.yxmd

DemandQueryHandler

Material_Number Material_Name Plant SNP_Datetime Year_Month Total_Demand Forecast Tender_Demand Clinical_Demand Other_Demand Sales_Order Inter_Site_Demand Distribution_Demand__Planned_ Distribution_Demand__Tlb-confirmed_ Distribution_Demand__Subcontracting_ Dependent_Demand Base_Unit ADA_Load_User ADA_Load_Time ADA_Load_Job
5185700 SEMAGLUTIDE D 2.0MG/ML,PFS 0.5 1846 2024-12-25 09:31:23 2024-06-01 280000.0 None None None None None None None None None None EA psrpalteryx 2024-12-25 09:31:23 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Demand\Alteryx\GCM_Demand_Data.yxmd
5185700 SEMAGLUTIDE D 2.0MG/ML,PFS 0.5 1846 2024-12-25 09:31:23 2024-08-01 18000000.0 None None None None None None None None None None EA psrpalteryx 2024-12-25 09:31:23 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Demand\

LtfDemandQueryHandler

Material_Number Material_Name Forecast_Type LTF_Year Forecast Component_unit_of_measure Last_Update ADA_Load_User ADA_Load_Time ADA_Load_Job
1000067 ENTEROKINASE LIGHT CHAIN LTF24 HIGH RANGE 2026 6038.23 KG 2024-07-03 CYPU 2024-07-03 14:52:54 Long-term Forecast
1000067 ENTEROKINASE LIGHT CHAIN LTF24 HIGH RANGE 2027 6871.66 KG 2024-07-03 CYPU 2024-07-03 14:52:54 Long-term Forecast

LeadtimeQueryHandler

Material_Number Material_Name Forecast_Type LTF_Year Forecast Component_unit_of_measure Last_Update ADA_Load_User ADA_Load_Time ADA_Load_Job
1000067 ENTEROKINASE LIGHT CHAIN LTF24 HIGH RANGE 2026 6038.23 KG 2024-07-03 CYPU 2024-07-03 14:52:54 Long-term Forecast
1000067 ENTEROKINASE LIGHT CHAIN LTF24 HIGH RANGE 2027 6871.66 KG 2024-07-03 CYPU 2024-07-03 14:52:54 Long-term Forecast

OpenPosQueryHandler

ClosedPOsQueryHandler

PlantsQueryHandler

GCM_Current_Stock_ID Material_Number Material_Name Plant Plant_Name Plant_Country Stock_Type Stock_Status Storage_Location Batch Stock Unit GCM_Related Status Expiry_Date ADA_Load_User ADA_Load_Time ADA_Load_Job
NaN 1010285 SIDECHAIN PC4008 4212 TM New Hampshire (HQ) US Transit (Plant) Transit Not assigned # 1.047 KG None True None psrpalteryx 2025-02-28 00:04:17 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Stock\Current_Stock.yxmd
NaN 1026836 FMOC-L-HIS-AIB-OH TFA,LS 1843 TM DAPI US WH (HQ) US Transit (Plant) Transit Not assigned # 1408.790 KG None True None psrpalteryx 2025-03-05 00:02:55 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Stock\Current_Stock.yxmd

VendorQueryHandler

GCM_Mat_ID GCM_Mat_Name ASL_Mat_Name SAP_Mat_Number Category GCM_Site_ID GCM_Mat_Group_ID Vendor_Number Vendor_Name Plant Phase State Effective_Time Expire_Time ADA_Load_User ADA_Load_Time ADA_Load_Job
1 Enterokinase Light Chain ENTEROKINASE LIGHT CHAIN 1000067 Raw Materials 1 9 35178 AGC BIOLOGICS A/S 2040 Operations True 2018-04-30 1816-03-29 05:56:08.066277376 CYPU 2024-04-09 14:09:25 \amznfsxr0ugknxs.corp.novocorp.net\filesforada\2_DSO\GCM\GCM_Master_Data\Material_Vendor\Material_Vendor.yxmd
2 NNC3027 DC20-GGLU-DIADO-OSU 1000106 Raw Materials 29 20 25099 SIEGFRIED LTD 2040 Operations True 2019-07-08 1816-03-29 05:56:08.066277376 CYPU 2024-04-09 14:09:25 \amznfsxr0ugknxs.corp.novocorp.net\filesforada\2_DSO\GCM\GCM_Master_Data\Material_Vendor\Material_Vendor.yxmd

ReceivedQtyQueryHandler

Material_Number Material_Name Plant Base_Unit Receipt_Requirement_Date Mrp_Element Mrp_Element_Data Rescheduled_Date Receipt_Requirement_Quantity Available_Quantity Storage_Location Finish_Av_Date ADA_Load_User ADA_Load_Time ADA_Load_Job
1000067 ENTEROKINASE LIGHT CHAIN 2040 KG 2025-01-22 OI-SL 1413683/00110 None 1.00 625.73 20407006 2024-12-03 psrpalteryx 2025-03-06 16:35:53 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Demand\Alteryx\MD04_Extract.yxmd
1000067 ENTEROKINASE LIGHT CHAIN 2040 KG 2025-02-02 QM lot 0000000000000000000000000000000000727095 None 191.02 816.75 20407006 2025-02-02 psrpalteryx 2025-03-06 16:35:53 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Demand\Alteryx\MD04_Extract.yxmd

OpenPOtoExcludeQueryHandler

GCM_Open_PO_ID Purchase_Order PO_Item Material_Number Material_Name Batch Final_Delivery Created_On Goods_Receipt Purchasing_Group Purchasing_Group_Name Purchasing_Group2 APO_SNP_Planner Plant Plant_Name Storage_Location GCM_Site_ID Vendor_Number Vendor_Name Del_Ind_Pur_Doc Del_Date_Final Del_Date_Final_Non_Exw GR_Date_Non_Exw Stat_Del_Date_Final Stat_Del_Date_Final_Non_Exw Received_Qty Oty_In_Open_POs Exw_Del_Qty_La Conf_Quant_Ab Base_Unit Is_Disregard Account_Assign_Category ADA_Load_User ADA_Load_Time ADA_Load_Job
1 4501469585 00010 5185701 SEMA K 2.0 MG/ML 0.5ML PFS PAR1201 None None 2025-02-24 X E42 Jonathan Reck E71 P95 1846 Subcontracting US (HQ) 18468001 31 52030 PATHEON MANUFACTURING SERVICES, LLC None None None None None None 0.0 750000.0 0.0 0.0 EA False None psrpalteryx 2025-03-06 10:08:52 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\PO_Batch\Alteryx_Flow\GCM_Open_PO_Table.yxmd
2 4501220845 00010 7155654 PRANDIN 2 MG, 90 COMPRIMIDOS KL40251 None None 2020-09-08 X E55 Rowayda Nazmy C87 DG1 1035 Subcontracting DE (HQ) 10358001 8 10203 CATALENT GERMANY SCHORNDORF GMBH None 2021-04-16 2021-04-16 None 2020-11-16 2020-11-16 0.0 15000.0 0.0 15000.0 EA False None psrpalteryx 2025-03-06 10:08:52 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\PO_Batch\Alteryx_Flow\GCM_Open_PO_Table.yxmd

QmLotQueryHandler

Material_Number Material_Name Plant Base_Unit Receipt_Requirement_Date Mrp_Element Mrp_Element_Data Rescheduled_Date Receipt_Requirement_Quantity Available_Quantity Storage_Location Finish_Av_Date ADA_Load_User ADA_Load_Time ADA_Load_Job
1000067 ENTEROKINASE LIGHT CHAIN 2040 KG 2025-01-22 OI-SL 1413683/00110 None 1.00 625.73 20407006 2024-12-03 psrpalteryx 2025-03-05 16:35:49 \amznfsxr0ugknxs.corp.novocorp.net\FilesForADA\2_DSO\GCM\GCM_Fact_Data\Demand\Alteryx\MD04_Extract.yxmd
1000067 ENTEROKINASE LIGHT CHAIN 2040 KG 2025-02-02 QM lot 0000000000000000000000000000000000727095 None