1
我想構建一個Django服務,用戶可以在其中爲某些人口定義某些策略。在Postgres中表示策略人口數據的最佳方式
政策樣本:
default policy:
{
"field1":{
"rule1":"somerule",
"rule2":"somerule",
"rule3":"somerule"
},
"filed2":{
"rule1":"somerule",
"rule2":"somerule",
"moredata":[
{"one":1,"two":2,"three":3},
{"one":1,"two":2,"three":3}]
},
"filed3":{}
}
人口抽樣:
default population:
{
"field1":[{"1":"some1"},
{"2":"some2"},
{"3":"some3"}],
"filed2":[{"1":"some1"},
{"2":"some2"},
{"3":"some3"}],
"filed3":[{"1":"some1"},
{"2":"some2"},
{"3":"some3"}]
}
我想找到代表PostgresDB該數據的最好的方法,我想過2分貝關係:
1 :
population to policy: field to population:
population policyId field value population
pop1 56 field2 (lat,lon,rad) pop1
pop2 999 field3 (lat,lon,rad) pop2
pop3 3 field4 456 pop3
2:
population to policy: expression to population:
population policyId expression population
pop1 56 "filed1 AND filed4 OR filed2" pop1
pop2 999 "filed1 OR filed4 " pop2
pop3 3
有什麼更好的,有沒有更好的方法來表示這種數據?