Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce hard coding and make dev experience better #5

Merged
merged 4 commits into from
Aug 26, 2024
Merged

Conversation

C-Loftus
Copy link
Member

@C-Loftus C-Loftus commented Aug 26, 2024

  • Removes any hard coding I missed previously in the USGS location oriented template
    • There are still a few things like the url to the doi, dc/dcat, measurementTechnique, and sameAs that I cannot get in the USGS json output (to my understanding)
    • I commented those out so we are not adding data that isn't useful. Not sure if there is a better way to handle this
  • Adds a test mechanism.
    • We can put the name of the template we want to test as a folder and then all the associated json files to template inside of it
    • These will be ran on every push to make sure the template is valid as a sanity check. It also prints out to the github actions log if we want to quickly get without the template response looks like without needing to spin up locally
  • Added a volume mount but commented it out for time being since not sure if it interferes with Ben's workflow

@C-Loftus C-Loftus marked this pull request as draft August 26, 2024 16:29
@C-Loftus C-Loftus marked this pull request as ready for review August 26, 2024 16:45
@C-Loftus C-Loftus requested a review from webb-ben August 26, 2024 16:46
@C-Loftus
Copy link
Member Author

Example:

Raw json

{
    "type":"Feature",
    "id":"'AR008-331856091114601'",
    "properties":{
        "@iot.selfLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Things('AR008-331856091114601')",
        "name":"AR008-331856091114601",
        "description":"Well",
        "Locations":[
            {
                "@iot.selfLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Locations('8416841e-2d1b-11ec-ac1b-a32405a27bb1')",
                "@iot.id":"8416841e-2d1b-11ec-ac1b-a32405a27bb1",
                "name":"AR008-331856091114601",
                "description":"Well",
                "encodingType":"application/vnd.geo+json",
                "location":{
                    "type":"Point",
                    "coordinates":[
                        -91.1969333333333,
                        33.3169611111111
                    ]
                }
            }
        ],
        "Datastreams":[
            {
                "@iot.selfLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Datastreams('177000bd9f6c45e5909c1729e4aab7b0')",
                "@iot.id":"177000bd9f6c45e5909c1729e4aab7b0",
                "name":"177000bd9f6c45e5909c1729e4aab7b0",
                "description":"Flow rate, well / AR008-331856091114601-177000bd9f6c45e5909c1729e4aab7b0",
                "observationType":"Instantaneous",
                "unitOfMeasurement":{
                    "name":"UNKNOWN",
                    "symbol":"US Gal/min",
                    "definition":""
                },
                "observedArea":{
                    "type":"Point",
                    "coordinates":[
                        -91.1969333,
                        33.3169611
                    ]
                },
                "phenomenonTime":"2024-08-16T09:15:00Z/2024-08-26T16:00:00Z",
                "properties":{
                    "Thresholds":[
                        {
                            "Name":"Operational limit (minimum)",
                            "Type":"ThresholdBelow",
                            "Periods":[
                                {
                                    "EndTime":"9999-12-31T23:59:59.9999999+00:00",
                                    "StartTime":"0001-01-01T00:00:00.0000000+00:00",
                                    "SuppressData":true,
                                    "ReferenceValue":-0.01,
                                    "ReferenceValueToTriggerDisplay":null
                                }
                            ],
                            "ReferenceCode":"Operational limit - low-Public"
                        },
                        {
                            "Name":"Operational limit (maximum)",
                            "Type":"ThresholdAbove",
                            "Periods":[
                                {
                                    "EndTime":"9999-12-31T23:59:59.9999999+00:00",
                                    "StartTime":"0001-01-01T00:00:00.0000000+00:00",
                                    "SuppressData":true,
                                    "ReferenceValue":20000,
                                    "ReferenceValueToTriggerDisplay":15000
                                }
                            ],
                            "ReferenceCode":"Operational limit - high-Public"
                        }
                    ],
                    "ParameterCode":"00058",
                    "StatisticCode":"00011"
                }
            },
            {
                "@iot.selfLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Datastreams('9aa77f35cea344a4a0e5715e05d057c3')",
                "@iot.id":"9aa77f35cea344a4a0e5715e05d057c3",
                "name":"9aa77f35cea344a4a0e5715e05d057c3",
                "description":"Precipitation, total, inches / AR008-331856091114601-9aa77f35cea344a4a0e5715e05d057c3",
                "observationType":"Instantaneous",
                "unitOfMeasurement":{
                    "name":"in",
                    "symbol":"in",
                    "definition":""
                },
                "observedArea":{
                    "type":"Point",
                    "coordinates":[
                        -91.1969333,
                        33.3169611
                    ]
                },
                "phenomenonTime":"2024-08-16T09:15:00Z/2024-08-26T16:00:00Z",
                "properties":{
                    "ParameterCode":"00045"
                }
            }
        ],
        "Locations@iot.navigationLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Things('AR008-331856091114601')/Locations",
        "HistoricalLocations@iot.navigationLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Things('AR008-331856091114601')/HistoricalLocations",
        "Datastreams@iot.navigationLink":"https://labs.waterdata.usgs.gov/sta/v1.1/Things('AR008-331856091114601')/Datastreams",
        "state":"Arkansas",
        "county":"Chicot County",
        "country":"United States of America",
        "mapScale":24000,
        "stateCode":"AR",
        "wellDepth":"80.0",
        "agencyCode":"AR008",
        "countryFIPS":"US",
        "hydrologicUnit":"08050002",
        "decimalLatitude":33.3169611111111,
        "decimalLongitude":-91.1969333333333,
        "monitoringLocationUrl":"https://waterdata.usgs.gov/monitoring-location/331856091114601",
        "monitoringLocationName":"16S01W10CC1 CH-32 WU",
        "monitoringLocationType":"Well",
        "monitoringLocationNumber":"331856091114601",
        "locationHUCTwelveDigitCode":"080500020302",
        "decimalLatitudeStandardized":33.3169611111111,
        "decimalLongitudeStandardized":-91.1969333333333
    },
    "geometry":{
        "type":"Point",
        "coordinates":[
            -91.1969333333333,
            33.3169611111111
        ]
    },
    "links":[
        {
            "type":"application/json",
            "rel":"root",
            "title":"The landing page of this server as JSON",
            "href":"http://localhost:5000?f=json"
        },
        {
            "type":"text/html",
            "rel":"root",
            "title":"The landing page of this server as HTML",
            "href":"http://localhost:5000?f=html"
        },
        {
            "rel":"self",
            "type":"application/geo+json",
            "title":"This document as JSON",
            "href":"http://localhost:5000/collections/USGS/Things/items/'AR008-331856091114601'?f=json"
        },
        {
            "rel":"alternate",
            "type":"application/ld+json",
            "title":"This document as RDF (JSON-LD)",
            "href":"http://localhost:5000/collections/USGS/Things/items/'AR008-331856091114601'?f=jsonld"
        },
        {
            "rel":"alternate",
            "type":"text/html",
            "title":"This document as HTML",
            "href":"http://localhost:5000/collections/USGS/Things/items/'AR008-331856091114601'?f=html"
        },
        {
            "rel":"collection",
            "type":"application/json",
            "title":"USGS Things",
            "href":"http://localhost:5000/collections/USGS/Things"
        }
    ]
}

JSONLD

{
    "@context":{
        "@vocab":"https://schema.org/",
        "xsd":"https://www.w3.org/TR/xmlschema-2/#",
        "rdfs":"http://www.w3.org/2000/01/rdf-schema#",
        "dc":"http://purl.org/dc/terms/",
        "dcat":"https://www.w3.org/ns/dcat#",
        "freq":"http://purl.org/cld/freq/",
        "qudt":"http://qudt.org/schema/qudt/",
        "qudt-units":"http://qudt.org/vocab/unit/",
        "qudt-quantkinds":"http://qudt.org/vocab/quantitykind/",
        "gsp":"http://www.opengis.net/ont/geosparql#",
        "locType":"http://vocabulary.odm2.org/sitetype",
        "odm2var":"http://vocabulary.odm2.org/variablename/",
        "odm2varType":"http://vocabulary.odm2.org/variabletype/",
        "hyf":"https://www.opengis.net/def/schema/hy_features/hyf/",
        "skos":"https://www.opengis.net/def/schema/hy_features/hyf/HY_HydroLocationType",
        "ssn":"http://www.w3.org/ns/ssn/",
        "ssn-system":"http://www.w3.org/ns/ssn/systems/"
    },
    "@id":"http://localhost:5000/collections/USGS/Things/items/'AR008-331856091114601'",
    "@type":[
        "hyf:HY_HydrometricFeature",
        "hyf:HY_HydroLocation",
        "locType:Well"
    ],
    "hyf:HydroLocationType":"Well",
    "identifier":{
        "@type":"PropertyValue",
        "propertyID":"USGS site number",
        "value":"331856091114601"
    },
    "name":"AR008-331856091114601",
    "provider":{
        "url":"https://waterdata.usgs.gov",
        "@type":"GovernmentOrganization",
        "name":"U.S. Geological Survey Water Data for the Nation"
    },
    "geo":{
        "@type":"schema:GeoCoordinates",
        "schema:longitude":-91.1969333333333,
        "schema:latitude":33.3169611111111
    },
    "gsp:hasGeometry":{
        "@type":"http://www.opengis.net/ont/sf#Point",
        "gsp:asWKT":{
            "@type":"http://www.opengis.net/ont/geosparql#wktLiteral",
            "@value":"POINT (-91.1969333333333 33.3169611111111)"
        },
        "gsp:crs":{
            "@id":"http://www.opengis.net/def/crs/OGC/1.3/CRS84"
        }
    },
    "subjectOf":[
        {
            "@type":"Dataset",
            "name":"AR008-331856091114601",
            "description":"Flow rate, well / AR008-331856091114601-177000bd9f6c45e5909c1729e4aab7b0",
            "provider":{
                "url":"https://waterdata.usgs.gov",
                "@type":"GovernmentOrganization",
                "name":"U.S. Geological Survey Water Data for the Nation"
            },
            "url":"https://waterdata.usgs.gov/monitoring-location/331856091114601/#parameterCode=00058",
            "variableMeasured":{
                "@type":"PropertyValue",
                "name":"Flow rate",
                "description":"Flow rate in US Gal/min",
                "propertyID":"https://www.wikidata.org/w/index.php?search=Flow rate",
                "url":"https://en.wikipedia.org/w/index.php?search=Flow rate",
                "unitText":"US Gal/min",
                "measurementMethod":{
                    "name":"Flow rate Measurements",
                    "publisher":"U.S. Geological Survey"
                }
            },
            "distribution":[
                {
                    "@type":"DataDownload",
                    "name":"USGS Instantaneous Values Service",
                    "contentUrl":"https://waterservices.usgs.gov/nwis/iv/?sites=AR008:331856091114601&parameterCd=00058&format=rdb",
                    "encodingFormat":[
                        "text/tab-separated-values"
                    ],
                    "dc:conformsTo":"https://pubs.usgs.gov/of/2003/ofr03123/6.4rdb_format.pdf"
                },
                {
                    "@type":"DataDownload",
                    "name":"USGS SensorThings API",
                    "contentUrl":"https://labs.waterdata.usgs.gov/sta/v1.1/Datastreams('177000bd9f6c45e5909c1729e4aab7b0')?$expand=Thing,Observations",
                    "encodingFormat":[
                        "application/json"
                    ],
                    "dc:conformsTo":"https://labs.waterdata.usgs.gov/docs/sensorthings/index.html"
                }
            ]
        },
        {
            "@type":"Dataset",
            "name":"AR008-331856091114601",
            "description":"Precipitation, total, inches / AR008-331856091114601-9aa77f35cea344a4a0e5715e05d057c3",
            "provider":{
                "url":"https://waterdata.usgs.gov",
                "@type":"GovernmentOrganization",
                "name":"U.S. Geological Survey Water Data for the Nation"
            },
            "url":"https://waterdata.usgs.gov/monitoring-location/331856091114601/#parameterCode=00045",
            "variableMeasured":{
                "@type":"PropertyValue",
                "name":"Precipitation",
                "description":"Precipitation in in",
                "propertyID":"https://www.wikidata.org/w/index.php?search=Precipitation",
                "url":"https://en.wikipedia.org/w/index.php?search=Precipitation",
                "unitText":"in",
                "measurementMethod":{
                    "name":"Precipitation Measurements",
                    "publisher":"U.S. Geological Survey"
                }
            },
            "distribution":[
                {
                    "@type":"DataDownload",
                    "name":"USGS Instantaneous Values Service",
                    "contentUrl":"https://waterservices.usgs.gov/nwis/iv/?sites=AR008:331856091114601&parameterCd=00045&format=rdb",
                    "encodingFormat":[
                        "text/tab-separated-values"
                    ],
                    "dc:conformsTo":"https://pubs.usgs.gov/of/2003/ofr03123/6.4rdb_format.pdf"
                },
                {
                    "@type":"DataDownload",
                    "name":"USGS SensorThings API",
                    "contentUrl":"https://labs.waterdata.usgs.gov/sta/v1.1/Datastreams('9aa77f35cea344a4a0e5715e05d057c3')?$expand=Thing,Observations",
                    "encodingFormat":[
                        "application/json"
                    ],
                    "dc:conformsTo":"https://labs.waterdata.usgs.gov/docs/sensorthings/index.html"
                }
            ]
        }
    ]
}

@C-Loftus C-Loftus requested a review from ksonda August 26, 2024 16:49
@webb-ben webb-ben merged commit 2c56d82 into main Aug 26, 2024
1 check passed
Copy link
Contributor

@ksonda ksonda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@C-Loftus @webb-ben theres two missing concepts:

schema:temporalCoverage under a schema:Dataset can be imported from the Datastream phenomenonTime

and for USGS STA only,

"measurementTechnique": "observation", can be at the schema:Dataset level as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants