Project

General

Profile

« Previous | Next » 

Revision 9929

schemas/vegbien.sql: split geoscrub_input_view's new-row-only filtering into separate view geoscrub_input_new, so that the full geoscrub_input rows are still available. the reduction in geoscrub_input from eliminating the already-scrubbed rows was only 280,000 (5076500 - 4799173) out of a possible 1.7 million (1707970), so it makes sense to just run geoscrubbing on the full input. (the lower-than-expected reduction is most likely due to rows from pre-refresh data being present in the original geoscrub_output table, which have been replaced by different, post-refresh input rows.)

View differences:

vegbien.sql
1496 1496

  
1497 1497

  
1498 1498
--
1499
-- Name: analytical_stem; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1500
--
1501

  
1502
CREATE TABLE analytical_stem (
1503
    datasource text NOT NULL,
1504
    "institutionCode" text,
1505
    "collectionCode" text,
1506
    "catalogNumber" text,
1507
    "occurrenceID" text,
1508
    country text,
1509
    "stateProvince" text,
1510
    county text,
1511
    locality text,
1512
    "decimalLatitude" double precision,
1513
    "decimalLongitude" double precision,
1514
    "coordinateUncertaintyInMeters" double precision,
1515
    "coordinateSource_bien" coordinatesource,
1516
    "georeferenceProtocol_bien" text,
1517
    geovalid_bien integer,
1518
    "isNewWorld_bien" integer,
1519
    "projectID" text,
1520
    "locationID" text NOT NULL,
1521
    "locationName" text,
1522
    subplot text,
1523
    "individualCode" text,
1524
    "elevationInMeters" double precision,
1525
    "plotArea_ha" double precision,
1526
    "samplingProtocol" text,
1527
    "temperature_C" double precision,
1528
    precipitation_m double precision,
1529
    "recordedBy" text,
1530
    "recordNumber" text,
1531
    "dateCollected" date,
1532
    family_verbatim text,
1533
    "scientificName_verbatim" text,
1534
    "identifiedBy" text,
1535
    "dateIdentified" date,
1536
    "identificationRemarks" text,
1537
    family_matched text,
1538
    "taxonName_matched" text,
1539
    "scientificNameAuthorship_matched" text,
1540
    "higherPlantGroup_bien" higher_plant_group,
1541
    family text,
1542
    genus text,
1543
    "speciesBinomialWithMorphospecies" text,
1544
    "taxonName" text,
1545
    "scientificNameAuthorship" text,
1546
    "growthForm" growthform,
1547
    "reproductiveCondition" text,
1548
    threatened_bien integer,
1549
    cultivated_bien integer,
1550
    "cultivatedBasis_bien" text,
1551
    "occurrenceRemarks" text,
1552
    "coverPercent" double precision,
1553
    "diameterBreastHeight_cm" double precision,
1554
    height_m double precision,
1555
    tag text,
1556
    "organismX_m" double precision,
1557
    "organismY_m" double precision,
1558
    "taxonOccurrenceID" text,
1559
    "authorTaxonCode" text,
1560
    "individualObservationID" text,
1561
    "authorStemCode" text
1562
);
1563

  
1564

  
1565
--
1566
-- Name: provider_count; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1567
--
1568

  
1569
CREATE TABLE provider_count (
1570
    dataprovider text NOT NULL,
1571
    dataset text NOT NULL,
1572
    records bigint,
1573
    sourcetype sourcetype,
1574
    observationtype observationtype
1575
);
1576

  
1577

  
1578
--
1579
-- Name: taxon_trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1580
--
1581

  
1582
CREATE TABLE taxon_trait (
1583
    "scientificName" text NOT NULL,
1584
    "measurementType" text NOT NULL,
1585
    "measurementValue" text,
1586
    "measurementUnit" text
1587
);
1588

  
1589

  
1590
--
1499 1591
-- Name: address; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1500 1592
--
1501 1593

  
......
1613 1705

  
1614 1706

  
1615 1707
--
1616
-- Name: analytical_stem; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1617
--
1618

  
1619
CREATE TABLE analytical_stem (
1620
    datasource text NOT NULL,
1621
    "institutionCode" text,
1622
    "collectionCode" text,
1623
    "catalogNumber" text,
1624
    "occurrenceID" text,
1625
    country text,
1626
    "stateProvince" text,
1627
    county text,
1628
    locality text,
1629
    "decimalLatitude" double precision,
1630
    "decimalLongitude" double precision,
1631
    "coordinateUncertaintyInMeters" double precision,
1632
    "coordinateSource_bien" coordinatesource,
1633
    "georeferenceProtocol_bien" text,
1634
    geovalid_bien integer,
1635
    "isNewWorld_bien" integer,
1636
    "projectID" text,
1637
    "locationID" text NOT NULL,
1638
    "locationName" text,
1639
    subplot text,
1640
    "individualCode" text,
1641
    "elevationInMeters" double precision,
1642
    "plotArea_ha" double precision,
1643
    "samplingProtocol" text,
1644
    "temperature_C" double precision,
1645
    precipitation_m double precision,
1646
    "recordedBy" text,
1647
    "recordNumber" text,
1648
    "dateCollected" date,
1649
    family_verbatim text,
1650
    "scientificName_verbatim" text,
1651
    "identifiedBy" text,
1652
    "dateIdentified" date,
1653
    "identificationRemarks" text,
1654
    family_matched text,
1655
    "taxonName_matched" text,
1656
    "scientificNameAuthorship_matched" text,
1657
    "higherPlantGroup_bien" higher_plant_group,
1658
    family text,
1659
    genus text,
1660
    "speciesBinomialWithMorphospecies" text,
1661
    "taxonName" text,
1662
    "scientificNameAuthorship" text,
1663
    "growthForm" growthform,
1664
    "reproductiveCondition" text,
1665
    threatened_bien integer,
1666
    cultivated_bien integer,
1667
    "cultivatedBasis_bien" text,
1668
    "occurrenceRemarks" text,
1669
    "coverPercent" double precision,
1670
    "diameterBreastHeight_cm" double precision,
1671
    height_m double precision,
1672
    tag text,
1673
    "organismX_m" double precision,
1674
    "organismY_m" double precision,
1675
    "taxonOccurrenceID" text,
1676
    "authorTaxonCode" text,
1677
    "individualObservationID" text,
1678
    "authorStemCode" text
1679
);
1680

  
1681

  
1682
--
1683 1708
-- Name: analytical_plot; Type: VIEW; Schema: public; Owner: -
1684 1709
--
1685 1710

  
......
3076 3101

  
3077 3102

  
3078 3103
--
3104
-- Name: geoscrub_input_new; Type: VIEW; Schema: public; Owner: -
3105
--
3106

  
3107
CREATE VIEW geoscrub_input_new AS
3108
    SELECT geoscrub_input.country, geoscrub_input."stateProvince", geoscrub_input.county, geoscrub_input."decimalLatitude", geoscrub_input."decimalLongitude" FROM (geoscrub_input LEFT JOIN geoscrub.geoscrub_output ON ((((((geoscrub_output.decimallatitude = geoscrub_input."decimalLatitude") AND (geoscrub_output.decimallongitude = geoscrub_input."decimalLongitude")) AND (geoscrub_output.country = geoscrub_input.country)) AND (geoscrub_output.stateprovince = geoscrub_input."stateProvince")) AND (geoscrub_output.county = geoscrub_input.county)))) WHERE (geoscrub_output.row_num IS NULL);
3109

  
3110

  
3111
--
3079 3112
-- Name: geoscrub_input_view; Type: VIEW; Schema: public; Owner: -
3080 3113
--
3081 3114

  
3082 3115
CREATE VIEW geoscrub_input_view AS
3083
    SELECT DISTINCT place.country, place.stateprovince AS "stateProvince", place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude" FROM ((place JOIN coordinates USING (coordinates_id)) LEFT JOIN geoscrub.geoscrub_output ON ((((((geoscrub_output.decimallatitude = coordinates.latitude_deg) AND (geoscrub_output.decimallongitude = coordinates.longitude_deg)) AND (geoscrub_output.country = place.country)) AND (geoscrub_output.stateprovince = place.stateprovince)) AND (geoscrub_output.county = place.county)))) WHERE ((place.country IS NOT NULL) AND (geoscrub_output.row_num IS NULL));
3116
    SELECT DISTINCT place.country, place.stateprovince AS "stateProvince", place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude" FROM (place JOIN coordinates USING (coordinates_id)) WHERE (place.country IS NOT NULL);
3084 3117

  
3085 3118

  
3086 3119
--
......
3762 3795

  
3763 3796

  
3764 3797
--
3765
-- Name: provider_count; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3766
--
3767

  
3768
CREATE TABLE provider_count (
3769
    dataprovider text NOT NULL,
3770
    dataset text NOT NULL,
3771
    records bigint,
3772
    sourcetype sourcetype,
3773
    observationtype observationtype
3774
);
3775

  
3776

  
3777
--
3778 3798
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3779 3799
--
3780 3800

  
......
4159 4179

  
4160 4180

  
4161 4181
--
4162
-- Name: taxon_trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
4163
--
4164

  
4165
CREATE TABLE taxon_trait (
4166
    "scientificName" text NOT NULL,
4167
    "measurementType" text NOT NULL,
4168
    "measurementValue" text,
4169
    "measurementUnit" text
4170
);
4171

  
4172

  
4173
--
4174 4182
-- Name: trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
4175 4183
--
4176 4184

  
......
8423 8431

  
8424 8432

  
8425 8433
--
8434
-- Name: analytical_stem; Type: ACL; Schema: public; Owner: -
8435
--
8436

  
8437
REVOKE ALL ON TABLE analytical_stem FROM PUBLIC;
8438
REVOKE ALL ON TABLE analytical_stem FROM bien;
8439
GRANT ALL ON TABLE analytical_stem TO bien;
8440
GRANT SELECT ON TABLE analytical_stem TO bien_read;
8441

  
8442

  
8443
--
8444
-- Name: provider_count; Type: ACL; Schema: public; Owner: -
8445
--
8446

  
8447
REVOKE ALL ON TABLE provider_count FROM PUBLIC;
8448
REVOKE ALL ON TABLE provider_count FROM bien;
8449
GRANT ALL ON TABLE provider_count TO bien;
8450
GRANT SELECT ON TABLE provider_count TO bien_read;
8451
GRANT SELECT ON TABLE provider_count TO public_;
8452

  
8453

  
8454
--
8455
-- Name: taxon_trait; Type: ACL; Schema: public; Owner: -
8456
--
8457

  
8458
REVOKE ALL ON TABLE taxon_trait FROM PUBLIC;
8459
REVOKE ALL ON TABLE taxon_trait FROM bien;
8460
GRANT ALL ON TABLE taxon_trait TO bien;
8461
GRANT SELECT ON TABLE taxon_trait TO bien_read;
8462

  
8463

  
8464
--
8426 8465
-- Name: address; Type: ACL; Schema: public; Owner: -
8427 8466
--
8428 8467

  
......
8443 8482

  
8444 8483

  
8445 8484
--
8446
-- Name: analytical_stem; Type: ACL; Schema: public; Owner: -
8447
--
8448

  
8449
REVOKE ALL ON TABLE analytical_stem FROM PUBLIC;
8450
REVOKE ALL ON TABLE analytical_stem FROM bien;
8451
GRANT ALL ON TABLE analytical_stem TO bien;
8452
GRANT SELECT ON TABLE analytical_stem TO bien_read;
8453

  
8454

  
8455
--
8456 8485
-- Name: analytical_plot; Type: ACL; Schema: public; Owner: -
8457 8486
--
8458 8487

  
......
8805 8834

  
8806 8835

  
8807 8836
--
8837
-- Name: geoscrub_input_new; Type: ACL; Schema: public; Owner: -
8838
--
8839

  
8840
REVOKE ALL ON TABLE geoscrub_input_new FROM PUBLIC;
8841
REVOKE ALL ON TABLE geoscrub_input_new FROM bien;
8842
GRANT ALL ON TABLE geoscrub_input_new TO bien;
8843
GRANT SELECT ON TABLE geoscrub_input_new TO bien_read;
8844

  
8845

  
8846
--
8808 8847
-- Name: geoscrub_input_view; Type: ACL; Schema: public; Owner: -
8809 8848
--
8810 8849

  
......
8946 8985

  
8947 8986

  
8948 8987
--
8949
-- Name: provider_count; Type: ACL; Schema: public; Owner: -
8950
--
8951

  
8952
REVOKE ALL ON TABLE provider_count FROM PUBLIC;
8953
REVOKE ALL ON TABLE provider_count FROM bien;
8954
GRANT ALL ON TABLE provider_count TO bien;
8955
GRANT SELECT ON TABLE provider_count TO bien_read;
8956
GRANT SELECT ON TABLE provider_count TO public_;
8957

  
8958

  
8959
--
8960 8988
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
8961 8989
--
8962 8990

  
......
9049 9077

  
9050 9078

  
9051 9079
--
9052
-- Name: taxon_trait; Type: ACL; Schema: public; Owner: -
9053
--
9054

  
9055
REVOKE ALL ON TABLE taxon_trait FROM PUBLIC;
9056
REVOKE ALL ON TABLE taxon_trait FROM bien;
9057
GRANT ALL ON TABLE taxon_trait TO bien;
9058
GRANT SELECT ON TABLE taxon_trait TO bien_read;
9059

  
9060

  
9061
--
9062 9080
-- Name: trait; Type: ACL; Schema: public; Owner: -
9063 9081
--
9064 9082

  

Also available in: Unified diff