Skip to content

Commit

Permalink
update: append new field in occurrence_detail api
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJHANG committed Feb 22, 2024
1 parent 9d14a01 commit 82e6336
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 6 additions & 2 deletions apps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,14 +1002,17 @@ def occurrence_api(request):
taicolTaxonID = i['taibif_accepted_namecode'] if 'taibif_accepted_namecode' in i else (i['taibif_taicolTaxonID'] if 'taibif_taicolTaxonID' in i else None)
gbifAcceptedID = i['taxonKey'] if 'taxonKey' in i else None
scientificName = i['taibif_scientificname'] if 'taibif_scientificname' in i else (i['taibif_scientificName'] if 'taibif_scientificName' in i else None)
originalScientificName = i['scientificName'] if 'scientificName' in i else None
taxonRank = i['taibif_taxonRank'] if 'taibif_taxonRank' in i else None
elif backbone == 'GBIF':
gbifAcceptedID = int(float(i['taibif_accepted_namecode'])) if 'taibif_accepted_namecode' in i else None
scientificName = i['taibif_scientificname'] if 'taibif_scientificname' in i else None
originalScientificName = i['scientificName'] if 'scientificName' in i else None
taxonRank = i['taibif_taxonRank'] if 'taibif_taxonRank' in i else None
elif backbone == None:
gbifAcceptedID = i['taxonKey'] if 'taxonKey' in i else None
scientificName = i['scientificName'] if 'scientificName' in i else None
scientificName = ''
originalScientificName = i['scientificName'] if 'scientificName' in i else None
taxonRank = i['taibif_taxonRank'] if 'taibif_taxonRank' in i else None

issue = None
Expand All @@ -1031,10 +1034,11 @@ def occurrence_api(request):
issues.append('RecordedDateInvalid')

res_list.append({
# 轉譯資料
# 轉釋資料
'taibifOccurrenceID':i['taibif_occ_id'],
'basisOfRecord':i['taibif_basisOfRecord'] if 'taibif_basisOfRecord' in i else None,
'scientificName': scientificName,
'originalScientificName': originalScientificName,
'taxonGroup':group,
'taxonRank': taxonRank,
'scientificNameID':i['taibif_namecode'] if 'taibif_namecode' in i else None,
Expand Down
2 changes: 1 addition & 1 deletion templates/occurrence.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ <h1 style="margin-top:0px">
</dd>

{% if taxon.vernacularName.value.1 %}
<dt>物種 - 轉譯資料</dt>
<dt>物種 - 轉釋資料</dt>
<dd>
{{ taxon.vernacularName.value.1 }}
{{ taxon.scientificName.value.1}}
Expand Down
9 changes: 5 additions & 4 deletions templates/taibif-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h4>回傳格式說明:</h4>
<li>{version}:API 版本,此版本為 v2 。</li>
<li>{type}:查詢資料種類,目前提供 occurrence、dataset 與 publisher 。</li>

<li>{mode}:<strong>限出現紀錄 (occurrence) 資料類型查詢</strong>,目前提供 detail_occ(轉譯欄位 + 基本欄位 + 常用欄位資料回傳)與 raw_occ(原始資料回傳)。
<li>{mode}:<strong>限出現紀錄 (occurrence) 資料類型查詢</strong>,目前提供 detail_occ(轉釋欄位 + 基本欄位 + 常用欄位資料回傳)與 raw_occ(原始資料回傳)。
<br>各自的差別請看<a href="#" data-cat="occurrence_api" class="pub-data-nav-item">出現紀錄查詢類型</a>說明。</li>

<li>{parameter}:查詢參數</li>
Expand Down Expand Up @@ -120,8 +120,8 @@ <h3 class="heading-lg-ul">出現紀錄查詢類型</h3>
<table class="table table-striped table-bordered">
<thead><tr><th>定義名稱</th><th>描述</th><th>欄位名稱</th></tr></thead>
<tbody>
<tr><td>轉譯資料</td><td>TaiBIF 針對特定欄位資料做清理 (例如統一格式等)</td><td>共 33 個欄位:taibifOccurrenceID、basisOfRecord、scientificName、taxonGroup、taxonRank、scientificNameID、isPreferredName、taxonBackbone、taicolTaxonID、gbifAcceptedID、kingdom、phylum、class、order、family、genus、eventDate、year、month、day、geodeticDatum、verbatimSRS、decimalLongitude、decimalLatitude、coordinateUncertaintyInMeters、countryCode、country、county、habitatReserve、wildlifeReserve、occurrenceStatus、selfProduced、license</td></tr>
<tr><td>基本資料</td><td>出現紀錄相關的重要欄位</td><td>17 個欄位:occurrenceID、dataGeneralizations、coordinatePrecision、locality、organismQuantity、organismQuantityType、datasetName、datasetShortName、typeStatus、recordedBy、recordNumber、preservation、catalogNumber、taibifCreatedDate、taibifModifiedDate、associatedMedia、mediaLicense</td></tr>
<tr><td>轉釋資料</td><td>TaiBIF 針對特定欄位資料做清理 (例如統一格式等)</td><td>共 33 個欄位:taibifOccurrenceID、basisOfRecord、scientificName、taxonGroup、taxonRank、scientificNameID、isPreferredName、taxonBackbone、taicolTaxonID、gbifAcceptedID、kingdom、phylum、class、order、family、genus、eventDate、year、month、day、geodeticDatum、verbatimSRS、decimalLongitude、decimalLatitude、coordinateUncertaintyInMeters、countryCode、country、county、habitatReserve、wildlifeReserve、occurrenceStatus、selfProduced、license</td></tr>
<tr><td>基本資料</td><td>出現紀錄相關的重要欄位</td><td>18 個欄位:originalScientificName、occurrenceID、dataGeneralizations、coordinatePrecision、locality、organismQuantity、organismQuantityType、datasetName、datasetShortName、typeStatus、recordedBy、recordNumber、preservation、catalogNumber、taibifCreatedDate、taibifModifiedDate、associatedMedia、mediaLicense</td></tr>
<tr><td>常用資料</td><td>出現紀錄相關的次要欄位</td><td>共 5 個欄位:
{% comment %} modifiedDate、 {% endcomment %}
gbifID、taibifDatasetID、gbifDatasetID、establishmentMeans、issue</td></tr>
Expand All @@ -132,7 +132,7 @@ <h3 class="heading-lg-ul">出現紀錄查詢類型</h3>
<table class="table table-striped table-bordered">
<thead><tr><th>類型 {mode}</th><th>回傳內容</th><th>回傳欄位</th></tr></thead>
<tbody>
<tr><td>detail_occ</td><td>轉譯資料 + 基本資料 + 常用資料</td><td>共回傳 55 個欄位</td></tr>
<tr><td>detail_occ</td><td>轉釋資料 + 基本資料 + 常用資料</td><td>共回傳 56 個欄位</td></tr>
<tr><td>raw_occ</td><td>原始資料</td><td>資料上傳者所提供的所有資料</td></tr>
</tbody>
</table>
Expand Down Expand Up @@ -194,6 +194,7 @@ <h3 class="heading-lg-ul">其他回傳欄位說明:</h3>
<thead><tr><th>回傳欄位</th><th>說明</th><th>型態</th></tr></thead>
<tbody>
<tr><td colspan="3">基本資訊</td></tr>
<tr><td>originalScientificName</td><td>原始紀錄物種</td><td>String</td></tr>
<tr><td>taibifCreatedDate</td><td>資料建立日期</td><td>String</td></tr>
<tr><td>datasetShortName</td><td>資料集名稱</td><td>String</td></tr>
<tr><td colspan="3">物種資訊</td></tr>
Expand Down

0 comments on commit 82e6336

Please sign in to comment.