Spring Boot 4 / Java 17 / Postgres. Masters and serving (A), Agmarknet and climate ingestion (B), feature store with 14 derivations (C), SpEL rule engine and risk scoring (D). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
49 lines
1.1 KiB
Java
49 lines
1.1 KiB
Java
package com.lincfusion.udyamlinc.master;
|
|
|
|
import jakarta.persistence.*;
|
|
import lombok.*;
|
|
|
|
/**
|
|
* The join key for every external signal. Mandi prices and climate series are
|
|
* pulled per district, never per enterprise — that is what keeps ingestion to
|
|
* roughly forty rows a day instead of one call per enterprise.
|
|
*/
|
|
@Entity
|
|
@Table(name = "district", indexes = @Index(name = "ix_district_code", columnList = "code", unique = true))
|
|
@Getter
|
|
@Setter
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public class District {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
/** SEHORE, VIDISHA… */
|
|
@Column(nullable = false, unique = true, length = 32)
|
|
private String code;
|
|
|
|
@Column(nullable = false, length = 64)
|
|
private String name;
|
|
|
|
@Column(length = 64)
|
|
private String nameHi;
|
|
|
|
@Column(nullable = false, length = 64)
|
|
private String state;
|
|
|
|
/** District centroid — used to pick the climate grid cell. */
|
|
private Double latitude;
|
|
|
|
private Double longitude;
|
|
|
|
private Boolean active;
|
|
|
|
@PrePersist
|
|
void onCreate() {
|
|
if (active == null) active = Boolean.TRUE;
|
|
}
|
|
}
|