CREATE TABLE "customers" (
profilenum character varying NOT NULL,
seg_category text NULL,
geographyzone character varying NULL,
return_behavior_profile jsonb NULL,
    PRIMARY KEY (profilenum)
);

First 3 rows:
profilenum    seg_category    geographyzone    return_behavior_profile
------------  --------------  ---------------  ---------------------------------------------------------------------------------
CUS00181      Individual      Cambodia         {'total_returns': 10, 'return_frequency_score': 5, 'similar_previous_returns': 1}
CUS00009      Wholesale       Burkina Faso     {'total_returns': 8, 'return_frequency_score': 5, 'similar_previous_returns': 3}
CUS00042                      Bermuda          {'total_returns': 5, 'return_frequency_score': 8, 'similar_previous_returns': 4}
...


CREATE TABLE "products" (
itemcode character varying NOT NULL,
itemcategory character varying NULL,
subcat character varying NULL,
unit_value real NULL,
product_traceability jsonb NULL,
    PRIMARY KEY (itemcode)
);

First 3 rows:
itemcode    itemcategory    subcat      unit_value  product_traceability
----------  --------------  --------  ------------  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PRD00023    Apparel         Shoes           186.05  {'trace': {'lot_reference': '4119LO', 'serial_number': 'SN258151', 'batch_reference': '6730', 'manufacture_date': '2024-04-21'}, 'compliance': {'recall_flag': 'Yes', 'hazardous_material': 'Yes', 'regulatory_compliance': 'Compliant'}}
PRD00058    Home Goods      Laptops         151.37  {'trace': {'lot_reference': '6279LO', 'serial_number': 'SN310365', 'batch_reference': 'BT1693', 'manufacture_date': '2023-04-07'}, 'compliance': {'recall_flag': 'No', 'hazardous_material': 'No', 'regulatory_compliance': 'Non-compliant'}}
PRD00079    Electronics     Shoes           752.89  {'trace': {'lot_reference': 'lot8331', 'serial_number': 'SN774661', 'batch_reference': 'BT7204', 'manufacture_date': '2024-10-17'}, 'compliance': {'recall_flag': 'No', 'hazardous_material': 'No', 'regulatory_compliance': None}}
...


CREATE TABLE "returns" (
casenum character varying NOT NULL,
logtime character varying NULL,
srctxn character varying NULL,
itemlink character varying NULL,
revdate text NULL,
dayslapsed bigint NULL,
return_channel character varying NULL,
return_details jsonb NULL,
    PRIMARY KEY (casenum),
    FOREIGN KEY (srctxn) REFERENCES orders(txnnum),
    FOREIGN KEY (itemlink) REFERENCES products(itemcode)
);

First 3 rows:
casenum    logtime              srctxn    itemlink    revdate       dayslapsed  return_channel    return_details
---------  -------------------  --------  ----------  ----------  ------------  ----------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RL781345   Jun 15, 2024         ORD67804  PRD00357    2025-02-14            56  Store             {'fraud': {'risk_level': 'Low', 'fraud_flags': 5}, 'shipping': {'fee': 99.57, 'carrier': 'Local', 'insurance_amount': 314.86, 'estimated_arrival': '2025-03-03', 'tracking_reference': '84825'}, 'reasoning': {'client_notes': 'Late impact process.', 'reason_notes': 'Ok light model fish country.', 'primary_reason': 'Quality Issue', 'secondary_reason': 'Not as Described'}, 'authorization': {'auth_status': 'Pending', 'warranty_claim': 'WC2710', 'warranty_status': 'Not Applicable'}}
RL862996   February 18th, 2025  ORD46009  PRD00219    2025-02-18            40  Courier           {'fraud': {'risk_level': 'High', 'fraud_flags': 5}, 'shipping': {'fee': 29.78, 'carrier': 'UPS', 'insurance_amount': 720.27, 'estimated_arrival': '2025-02-22', 'tracking_reference': '486848'}, 'reasoning': {'client_notes': 'Keep team of could.', 'reason_notes': 'Tell carry degree true.', 'primary_reason': 'Wrong Item', 'secondary_reason': 'Defective'}, 'authorization': {'auth_status': 'Rejected', 'warranty_claim': 'WC8592', 'warranty_status': 'Expired'}}
RL253528   2024-08-13           ORD93572  PRD00053    2025-02-10            43  Mail              {'fraud': {'risk_level': None, 'fraud_flags': 1}, 'shipping': {'fee': 19.57, 'carrier': 'Local', 'insurance_amount': 788.41, 'estimated_arrival': '2025-03-02', 'tracking_reference': 'rt921107'}, 'reasoning': {'client_notes': 'Get use shake rise. Address future hit current scientist.', 'reason_notes': 'Art nice budget for.', 'primary_reason': 'Wrong Item', 'secondary_reason': 'Damaged'}, 'authorization': {'auth_status': 'Approved', 'warranty_claim': None, 'warranty_status': 'Not Applicable'}}
...


CREATE TABLE "orders" (
txnnum character varying NOT NULL,
buyerlink text NULL,
transaction_value real NULL,
txndate text NULL,
    PRIMARY KEY (txnnum)
);

First 3 rows:
txnnum    buyerlink      transaction_value  txndate
--------  -----------  -------------------  ---------
ORD89293  CUS00181                       0
ORD66774  CUS00009                       0
ORD57926  CUS00042                       0
...


CREATE TABLE "quality_assessment" (
inspectref character varying NOT NULL,
assessment_summary jsonb NULL,
    PRIMARY KEY (inspectref),
    FOREIGN KEY (inspectref) REFERENCES returns(casenum)
);

First 3 rows:
inspectref    assessment_summary
------------  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RL924605      {'defects': {'defect_type': None, 'defect_severity': 'Minor'}, 'results': {'qa_result': 'Fail', 'aesthetic_score': 5, 'tech_review_status': 'Pending', 'functional_test_result': 'Partial'}, 'condition': {'usage_signs': 'Significant', 'completeness': 'Complete', 'item_condition': 'Used', 'package_condition': 'Original'}, 'documentation': {'qa_alert': 'Yes', 'has_photos': 'True', 'needs_investigation': 'No', 'documentation_status': 'Missing'}}
RL382759      {'defects': {'defect_type': None, 'defect_severity': 'Major'}, 'results': {'qa_result': 'Pass', 'aesthetic_score': 2.7, 'tech_review_status': 'Completed', 'functional_test_result': 'Fail'}, 'condition': {'usage_signs': 'Minor', 'completeness': 'Complete', 'item_condition': 'New', 'package_condition': 'Damaged'}, 'documentation': {'qa_alert': 'Yes', 'has_photos': 'Y', 'needs_investigation': 'Yes', 'documentation_status': 'Partial'}}
RL818285      {'defects': {'defect_type': 'Manufacturing', 'defect_severity': 'Critical'}, 'results': {'qa_result': 'Pass', 'aesthetic_score': 1, 'tech_review_status': 'Completed', 'functional_test_result': 'Pass'}, 'condition': {'usage_signs': 'Significant', 'completeness': 'Accessories Missing', 'item_condition': 'Damaged', 'package_condition': 'Original'}, 'documentation': {'qa_alert': 'No', 'has_photos': '1', 'needs_investigation': 'Yes', 'documentation_status': 'Complete'}}
...


CREATE TABLE "return_processing" (
loccode character varying NOT NULL,
procprio character varying NULL,
procstate USER-DEFINED NULL,
proctime real NULL,
handreq USER-DEFINED NULL,
needsquar character varying NULL,
quardays bigint NULL,
handling_notes text NULL,
dispaction text NULL,
dispreason USER-DEFINED NULL,
needsrelabel text NULL,
repairfeas USER-DEFINED NULL,
estrepairhrs real NULL,
partsavail USER-DEFINED NULL,
policycomp text NULL,
exceptmade character varying NULL,
excepttype USER-DEFINED NULL,
apprlevel USER-DEFINED NULL,
    PRIMARY KEY (loccode)
);

First 3 rows:
loccode    procprio    procstate      proctime  handreq    needsquar      quardays  handling_notes                 dispaction    dispreason    needsrelabel    repairfeas      estrepairhrs  partsavail    policycomp     exceptmade    excepttype    apprlevel
---------  ----------  -----------  ----------  ---------  -----------  ----------  -----------------------------  ------------  ------------  --------------  ------------  --------------  ------------  -------------  ------------  ------------  -----------
LOC008     Bulk        Received           15    Hazardous  No                   14  Kind he you let.               Repair        Repairable    Y               High                    39.8  Partial       Non-compliant  Yes           Error         Supervisor
LOC026     Express     Processing         24.9  Fragile    Yes                   4  Employee now star size out.    Resell        Repairable    True            High                    19.8  Available     Non-compliant  No            Goodwill      Automatic
LOC013     Standard    Received           38    Special    Yes                  13  Away course challenge spring.  Repair                      0               Not Feasible            14.1  Available     Compliant      No            Error         Manager
...


CREATE TABLE "financial_management" (
creditref text NOT NULL,
casetag character varying NULL,
dispcost real NULL,
cost_breakdown jsonb NULL,
    PRIMARY KEY (creditref),
    FOREIGN KEY (casetag) REFERENCES returns(casenum)
);

First 3 rows:
creditref    casetag      dispcost  cost_breakdown
-----------  ---------  ----------   
CM78914      RL924605            0  {'fees': {'qa_fee': 12.33, 'restocking_fee': 89.34, 'relabeling_cost': 10.26, 'repackaging_cost': 0}, 'refund': {'method': 'Store Credit', 'status': 'Completed', 'refund_amount': 0, 'processing_days': 12.8}, 'disposal': {'disposal_cost': 83.49, 'disposal_method': 'Recycle', 'recycling_category': 'Plastic', 'environmental_impact': 'High'}, 'valuation': {'recovery_value': 19.18, 'value_loss_pct': 72.3}, 'repair_costs': {'labor_fee': 85.38, 'parts_fee': 136.63, 'repair_estimate': 490.99}, 'sustainability': {'cost_efficiency': 45.4, 'carbon_footprint': 32.28, 'efficiency_score': 98.1, 'sustainability_score': 0}}
CM98655      RL818285            0  {'fees': {'qa_fee': 26.53, 'restocking_fee': 50.98, 'relabeling_cost': 16.87, 'repackaging_cost': 0}, 'refund': {'method': 'Store Credit', 'status': 'Pending', 'refund_amount': 0, 'processing_days': 6.4}, 'disposal': {'disposal_cost': 78.35, 'disposal_method': 'Recycle', 'recycling_category': 'Mixed', 'environmental_impact': 'Low'}, 'valuation': {'recovery_value': 554.38, 'value_loss_pct': 82.4}, 'repair_costs': {'labor_fee': 118.58, 'parts_fee': 19.29, 'repair_estimate': 387.6}, 'sustainability': {'cost_efficiency': 1.4, 'carbon_footprint': 76.05, 'efficiency_score': 39, 'sustainability_score': 0}}
CM36391      RL381491            0  {'fees': {'qa_fee': 46, 'restocking_fee': 35.36, 'relabeling_cost': 18.95, 'repackaging_cost': 0}, 'refund': {'method': 'Bank Transfer', 'status': 'Completed', 'refund_amount': 0, 'processing_days': 9.2}, 'disposal': {'disposal_cost': 127.9, 'disposal_method': 'Hazardous Waste', 'recycling_category': 'Metal', 'environmental_impact': 'Low'}, 'valuation': {'recovery_value': 963.61, 'value_loss_pct': 85.3}, 'repair_costs': {'labor_fee': 129.57, 'parts_fee': 31.74, 'repair_estimate': 156.98}, 'sustainability': {'cost_efficiency': 99.6, 'carbon_footprint': 97.66, 'efficiency_score': 3.9, 'sustainability_score': 0}}
...


CREATE TABLE "case_management" (
casetie character varying NOT NULL,
satisfscore bigint NULL,
commstate USER-DEFINED NULL,
resptime real NULL,
resolsatis USER-DEFINED NULL,
hasfeedback USER-DEFINED NULL,
feedbacktype USER-DEFINED NULL,
vendornotice USER-DEFINED NULL,
vendoraction USER-DEFINED NULL,
preventopp USER-DEFINED NULL,
actionident USER-DEFINED NULL,
actionstate USER-DEFINED NULL,
kbupdated USER-DEFINED NULL,
trainident text NULL,
needsprocimprove USER-DEFINED NULL,
needsdocupdate USER-DEFINED NULL,
needssysupdate USER-DEFINED NULL,
reportstate USER-DEFINED NULL,
analysisstate USER-DEFINED NULL,
hastrendanalysis USER-DEFINED NULL,
hascostanalysis USER-DEFINED NULL,
recstate USER-DEFINED NULL,
actioncount bigint NULL,
needsfollowup USER-DEFINED NULL,
nextreview text NULL,
closestate USER-DEFINED NULL,
closedate text NULL,
closenotes text NULL,
    PRIMARY KEY (casetie),
    FOREIGN KEY (casetie) REFERENCES returns(casenum)
);

First 3 rows:
casetie      satisfscore  commstate      resptime  resolsatis    hasfeedback    feedbacktype    vendornotice    vendoraction    preventopp    actionident    actionstate    kbupdated    trainident    needsprocimprove    needsdocupdate    needssysupdate    reportstate    analysisstate    hastrendanalysis    hascostanalysis    recstate      actioncount  needsfollowup    nextreview    closestate    closedate    closenotes
---------  -------------  -----------  ----------  ------------  -------------  --------------  --------------  --------------  ------------  -------------  -------------  -----------  ------------  ------------------  ----------------  ----------------  -------------  ---------------  ------------------  -----------------  ----------  -------------  ---------------  ------------  ------------  -----------  -------------------------------------
RL924605               2  In Progress        14.8  Dissatisfied  Yes            Process         Yes             Initiated       Medium        Yes            Completed      No           True          No                  No                Yes               Reviewed       Completed        No                  Yes                Draft                   0  No               2025-04-28    Closed        2025-02-19   Above suggest statement likely sound.
RL818285               5  Resolved           67.6  Neutral       No             Process         Yes             Initiated       Medium        No             Completed      Yes          N             Yes                 Yes               Yes               Generated      In Progress      Yes                 Yes                Draft                   7  Yes              2025-04-25    Open          2025-03-18   Kid week half.
RL381491               5  In Progress        59.3  Dissatisfied  No             Product         No              Initiated       High          Yes            Completed      Yes          1             No                  Yes               Yes               Reviewed       In Progress      No                  Yes                Approved                9  No               2025-02-21    Closed        2025-03-12   Experience near front opportunity.
...
