Skip to content

Commit 1eccdec

Browse files
authored
make Sacramento crime sample more friendly to postgres (#66)
* try to make sacramento crime sample more friendly to postgres * modify crime sample to use orchard database
1 parent 63284f2 commit 1eccdec

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

src/Site/Properties/launchSettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"commandName": "Project",
1212
"launchBrowser": true,
1313
"environmentVariables": {
14-
"ASPNETCORE_ENVIRONMENT": "Development"
14+
"ASPNETCORE_ENVIRONMENT": "Development",
15+
"TEST_VAR": "test_val"
1516
},
1617
"applicationUrl": "http://0.0.0.0:5000",
1718
"hotReloadEnabled": true

src/Site/samples/sacramento-crime/change-color.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
<add from="Red" to="#FF0000" />
1313
<add from="Green" to="#00FF00" />
1414
<add from="Blue" to="#0000FF" />
15-
<add from="Orange" to="##FFA500" />
15+
<add from="Orange" to="#FFA500" />
16+
<add from="Purple" to="#800080" />
1617
<add from="Default" to="#48C9B0" />
1718
</items>
1819
</add>
1920
</maps>
2021

2122
<connections>
2223
<add name="input" provider="sqlite" file="App_Data/batches.db" />
23-
<add name="target" provider="sqlserver" database="Junk" />
24+
<add name="orchard" />
2425
</connections>
2526

2627
<entities>
@@ -36,7 +37,7 @@
3637
<add name="Id" type="int" t="copy(BatchValue).convert()" />
3738
<add name="Dml">
3839
<transforms>
39-
<add method="run" connection="target" command="UPDATE SacramentoCrime SET [geojson-color] = @Color WHERE [Id] = @Id;" />
40+
<add method="run" connection="orchard" command="UPDATE sacramento_crime SET geojson_color = @Color WHERE &quot;id&quot; = @Id;" />
4041
</transforms>
4142
</add>
4243
</calculated-fields>

src/Site/samples/sacramento-crime/load.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<cfg name="Sacramento" mode="init">
1+
<cfg name="sacramento_" mode="init" output="orchard">
22
<parameters/>
33
<connections>
44
<add name="input" provider="file" file="samples/sacramento-crime/SacramentoCrimeJanuary2006.csv" delimiter="," start="2" />
5-
<add name="output" provider="sqlserver" database="Junk" />
5+
<add name="orchard" />
66
</connections>
77
<entities>
8-
<add name="Crime">
8+
<add name="crime">
99
<fields>
10-
<add input="false" name="Id" type="int" t="identity(1,1)" primary-key="true" />
10+
<add input="false" name="id" type="int" t="identity(1,1)" primary-key="true" />
1111
<add name="cdatetime" type="datetime" t="specifykind(utc)" />
1212
<add name="address" />
1313
<add name="district" length="2" />
@@ -24,7 +24,7 @@
2424
<add name="day" length="10" t="copy(cdatetime).toString(yyyy-MM-dd)" />
2525
<add name="dayofweek" length="12" t="copy(cdatetime).datepart(dayofweek)" />
2626
<add name="hour" length="2" t="copy(cdatetime).toString(HH)" />
27-
<add name="geojson-color" default="#48C9B0" />
27+
<add name="geojson_color" default="#48C9B0" />
2828
</calculated-fields>
2929
</add>
3030
</entities>

src/Site/samples/sacramento-crime/report.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<cfg name="report">
22

33
<connections>
4-
<add name="input" provider="sqlserver" database="Junk" />
4+
<add name="orchard" />
55
</connections>
66

77
<actions>
88
<add name="change-color" description="Change Color" modal="true" />
99
</actions>
1010

1111
<entities>
12-
<add name="SacramentoCrime">
12+
<add name="sacramento_crime" input="orchard">
1313
<filter>
1414
</filter>
1515
<fields>
16-
<add name="Id" type="int" primary-key="true" geo="id" />
16+
<add name="id" type="int" primary-key="true" geo="id" />
1717
<add name="address" parameter="search" />
1818
<add name="district" length="2" parameter="facet" />
1919
<add name="beat" length="11" parameter="facet" />
@@ -26,19 +26,19 @@
2626
<add name="dayofweek" length="12" output="false" parameter="facet" />
2727
<add name="hour" length="2" output="false" parameter="facet" />
2828
<add name="cdatetime" type="datetime" label="Date" />
29-
<add name="geojson-color" output="false" parameter="facet" />
29+
<add name="geojson_color" output="false" parameter="facet" />
3030
<add name="latitude" type="double" output="false" geo="latitude" />
3131
<add name="longitude" type="double" output="false" geo="longitude" />
3232
</fields>
3333
<calculated-fields>
3434

3535
<!-- bug in geojson provider? you have to use "marker-color" field to affect dots on map -->
3636
<!-- also have to change map color field to marker-color -->
37-
<add name="marker-color" t="copy(geojson-color)" output="false" geo="property" />
37+
<add name="marker-color" t="copy(geojson_color)" output="false" geo="property" />
3838

3939
<add name="Color"
4040
raw="true"
41-
t='format(<span style="height: 15px; width: 15px; background-color: {geojson-color}; border-radius: 50%; display: inline-block; margin-bottom: -2px;"></span> {geojson-color})' />
41+
t='format(<span style="height: 15px; width: 15px; background-color: {geojson_color}; border-radius: 50%; display: inline-block; margin-bottom: -2px;"></span> {geojson_color})' />
4242

4343
<add name="FluidTest"
4444
label="Fluid Test"
@@ -58,7 +58,7 @@
5858
geo="property"
5959
t='razor(Copy that, we got a @Model.ucr_ncic_code in progress at @Model.address)' />
6060

61-
<add name="BatchValue" t="copy(Id)" type="int" />
61+
<add name="BatchValue" t="copy(id)" type="int" />
6262
</calculated-fields>
6363
</add>
6464
</entities>

0 commit comments

Comments
 (0)