Havaintojen päivittyminen järjestelmien välillä

Tarkastellaan ensin, miten Vihko tallettaa hierarkian Document-Gatherings-Units:

"document": {
    "id":"JX.5809",
    "collectionID":"HR.1747",
    "creator":"MA.241",
    "dateCreated":"2016-12-21T11:28:42+00:00",
    "dateEdited":"2016-12-21T11:31:28+00:00",
    "editor":"MA.241",
    "publicityRestrictions":"MZ.publicityRestrictionsPrivate",
    "secureLevel":"MX.secureLevelNone",
    "gatheringEvent":{"leg":["MA.241"],"legPublic":true,"dateBegin":"2016-12-21","id":"JX.5809#1","@type":"MZ.gatheringEvent"},
    "formID":"JX.519",
    "@type":"MY.document",
    "@context":"http://schema.laji.fi/context/document.jsonld"    

    "gatherings":[
    { "id":"JX.5809#2",
       "dateBegin":"2016-12-21",
       "@type":"MY.gathering"       
       "geometry":{ 
           "type":"GeometryCollection",
           "geometries":[{"type":"Point","coordinates":[25.522005882497,65.024291711972]}]},
        "locality":"Kotipiha",

        "units":[
            {"id":"JX.5809#4",
             "identifications":[
                 {"id":"JX.5809#5",
                 "det":"Matti Virtala",
                 "detDate":"2016-12-21",
                 "taxon":"tegenaria domestica",
                 "taxonID":"MX.203449",
                 "identificationBasis":["MY.identificationBasisSeen"],
                 "@type":"MY.identification"}],
             "lifeStage":"MY.lifeStageAdult",
             "notes":"Eteisen seinällä",
             "recordBasis":"MY.recordBasisHumanObservation",
             "unitType":["MVL.232","MVL.38"],
             "taxonConfidence":"MY.taxonConfidenceSure",
             "countOfOccurrences":1,
             "@type":"MY.unit",
             "unitGathering":{"habitatDescription":"Asuinhuone","id":"JX.5809#3","@type":"MZ.unitGathering"}},

             ...
             { another unit },
             ...
        ],        
    }],
}

Hyönteishavainnoissa on hyvin usein kyse juuri tuollaisesta hierarkiasta, esimerkiksi tietty valopyynnillä saatu perhosaineisto muodostaa luontevasti yhden Gatherings-yksikön, joka sisältää ko. pyynnin tuottamat havainnot. Ohisessa kuvassa on vastaava tilanne, missä aineisto on saatu tietyltä paikalta seulomalla.

Nuo havainnot on lähetetty ohjelmasta suoraan Hyönteistietokantaan. Hyönteistietokannassa ei kuitenkaan ole Gatherings-Units-tyypistä hierarkiaa, vaan havainto talletetaan yhtenä tietueena seuraavasti:

startDay             
startMonth               
endDay                   
endMonth                 
year 
region                       
county                     
locality         
northCoord               
eastCoord            
northEuref               
eastEuref                 
originalGrid  
habitat                   
collectingMethod
obsID                
personID                 
storingDate                
lastEditingDate        
genus                   
species                
maleCount              
femaleCount              
totalCount          
devStage
collector
det                       
detYear                     
detMethod                 
note
hideExactData  
hideCoord        
hideCollector              

Kun Hyönteistietokannan havaintoja luetaan laji.fi-tietokantaan, tulos on samanlainen. Esimerkiksi kuvan kaksi havainto tallettuvat seuraavasti:

{
  "document": {
    "collectionId": "http://tun.fi/HR.200",
    "secureLevel": "NONE",
    "sourceId": "http://tun.fi/KE.423",
    "documentId": "http://tun.fi/KE.423/3515-7260-7409-8987"
  },
  "gathering": {
    "conversions": {
      "wgs84CenterPoint": {
        "lat": 65.8178733455706,
        "lon": 24.754349045545574
      }
    },
    "gatheringId": "http://tun.fi/KE.423/3515-7260-7409-8987#Gathering",
    "municipality": "Keminmaa",
    "team": [
      "M. Virtala"
    ],
    "eventDate": {
      "begin": "1983-05-15",
      "end": "1983-05-15"
    },
    "interpretations": {
      "sourceOfCoordinates": "REPORTED_VALUE",
      "coordinateAccuracy": 1000
    },
    "locality": "Hyypiö",
    "country": "Finland"
  },
  "unit": {
    "abundanceString": "2",
    "unitId": "http://tun.fi/KE.423/3515-7260-7409-8987#Unit",
    "taxonVerbatim": "Tachinus laticollis",
    "recordBasis": "HUMAN_OBSERVATION_UNSPECIFIED",
    "mediaCount": 0,
    "linkings": {
      "taxon": {
        "species": true,
        "scientificName": "Tachinus laticollis",
        "qname": "http://tun.fi/MX.190554"
      }
    },
    "notes": "coll. M. Virtala"
  },
},

{
  "document": {
    "collectionId": "http://tun.fi/HR.200",
    "secureLevel": "NONE",
    "sourceId": "http://tun.fi/KE.423",
    "documentId": "http://tun.fi/KE.423/0335-1417-2230-0986"
  },
  "gathering": {
    "conversions": {
      "wgs84CenterPoint": {
        "lat": 65.8178733455706,
        "lon": 24.754349045545574
      }
    },
    "gatheringId": "http://tun.fi/KE.423/0335-1417-2230-0986#Gathering",
    "municipality": "Keminmaa",
    "team": [
      "M. Virtala"
    ],
    "eventDate": {
      "begin": "1983-05-15",
      "end": "1983-05-15"
    },
    "interpretations": {
      "sourceOfCoordinates": "REPORTED_VALUE",
      "coordinateAccuracy": 1000
    },
    "locality": "Hyypiö",
    "country": "Finland"
  },
  "unit": {
    "abundanceString": "1",
    "unitId": "http://tun.fi/KE.423/0335-1417-2230-0986#Unit",
    "taxonVerbatim": "Euryporus picipes",
    "recordBasis": "HUMAN_OBSERVATION_UNSPECIFIED",
    "mediaCount": 0,
    "linkings": {
      "taxon": {
        "species": true,
        "scientificName": "Euryporus picipes",
        "qname": "http://tun.fi/MX.192090"
      }
    },
    "notes": "coll. M. Virtala"
  },
}

Ehdottaisin nyt seuraavanlaista menettelyä: Hyönteistietokannasta luettu havaintotietue jaetaan kahteen osaan seuraavalla tavalla:

Näytetiedot (Gathering)

startDay             
startMonth               
endDay                   
endMonth                 
year 
region                       
county                     
locality         
northCoord               
eastCoord            
northEuref               
eastEuref                 
originalGrid  
habitat                   
collectingMethod

Havaintotiedot (Unit)

obsID                
personID                 
storingDate                
lastEditingDate        
genus                   
species                
maleCount              
femaleCount              
totalCount          
devStage
collector
det                       
detYear                     
detMethod                 
note
hideExactData  
hideCoord        
hideCollector 

Luodaan uusi dokumentti, jolle annetaan oma tunnus, esim. “JX.12345”

 "document": {
     "id": "JX.12345"
     "collectionId": "http://tun.fi/HR.200",
     "secureLevel": "NONE",
     "sourceId": "http://tun.fi/KE.423",

}

Näytetietoja varten luodaan gatherings-objekti, joka liitetään dokumenttiin:

"document": {
    "id": "JX.12345"
    "collectionId": "http://tun.fi/HR.200",
    "secureLevel": "NONE",
    "sourceId": "http://tun.fi/KE.423",

    "gatherings":[
    { 
        "id":"JX.12345#1",
        "conversions": {
          "wgs84CenterPoint": {
            "lat": 65.8178733455706,
            "lon": 24.754349045545574
          }
        },
        "municipality": "Keminmaa",
        "team": [
          "M. Virtala"
        ],
        "eventDate": {
          "begin": "1983-05-15",
          "end": "1983-05-15"
        },
        "interpretations": {
          "sourceOfCoordinates": "REPORTED_VALUE",
          "coordinateAccuracy": 1000
        },
        "locality": "Hyypiö",
        "country": "Finland"
    }]
}

Luotuun gatherings-objektiin lisätään sen jälkeen havainnot:

"document": {
    "collectionId": "http://tun.fi/HR.200",
    "secureLevel": "NONE",
    "sourceId": "http://tun.fi/KE.423",
    "documentId": "JX.12345"

    "gatherings":[
    { 
        "id":"JX.12345#1",
        "conversions": {
          "wgs84CenterPoint": {
            "lat": 65.8178733455706,
            "lon": 24.754349045545574
          }
        },
        "municipality": "Keminmaa",
        "team": [
          "M. Virtala"
        ],
        "eventDate": {
          "begin": "1983-05-15",
          "end": "1983-05-15"
        },
        "interpretations": {
          "sourceOfCoordinates": "REPORTED_VALUE",
          "coordinateAccuracy": 1000
        },
        "locality": "Hyypiö",
        "country": "Finland".

        "units":[
        {
            "id": "JX.12345#2",                
            "abundanceString": "2",
            "taxonVerbatim": "Tachinus laticollis",
            "recordBasis": "HUMAN_OBSERVATION_UNSPECIFIED",
            "mediaCount": 0,
            "linkings": {
                "taxon": {
                    "species": true,
                    "scientificName": "Tachinus laticollis",
                    "qname": "http://tun.fi/MX.190554"
                }
            },
            "notes": "coll. M. Virtala"
        },
        { 
            "id": "JX.12345#3",                 
            "abundanceString": "1",
            "taxonVerbatim": "Euryporus picipes",
            "recordBasis": "HUMAN_OBSERVATION_UNSPECIFIED",
            "mediaCount": 0,
            "linkings": {
                "taxon": {
                    "species": true,
                    "scientificName": "Euryporus picipes",
                    "qname": "http://tun.fi/MX.192090"
                }
            },
            "notes": "coll. M. Virtala"
        }],
    }]
}

Tällä tavalla saataisiin uudelleen rekonstruoitua näytteiden ja havaintojen välinen hierarkia, joka menetettiin talletettaessa havainto Hyönteistietokantaan. Etuna olisi myös se, että talletettua laji.fi-havaintoa voisi olla mahdollista muokata myöhemmin Vihkon kautta.