# Filtering incoming dicom instances using metadata (with python plugin)

**URL:** https://discourse.orthanc-server.org/t/filtering-incoming-dicom-instances-using-metadata-with-python-plugin/2624
**Category:** Google Groups archive
**Created:** [September 13, 2021, 11:06pm UTC](https://discourse.orthanc-server.org/t/filtering-incoming-dicom-instances-using-metadata-with-python-plugin/2624 "2021-09-13T23:06:24Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Alain\_Mazy1](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/839c29/32.png) [@Alain\_Mazy1](https://discourse.orthanc-server.org/u/Alain_Mazy1)
#### Post date: [September 14, 2021, 7:05am UTC](https://discourse.orthanc-server.org/t/filtering-incoming-dicom-instances-using-metadata-with-python-plugin/2624/2 "2021-09-14T07:05:01Z")

</div>

Hi,

Metadata are stored in the DB and attached to the instance. At the time filtering is performed, the instance has not been stored in DB yet and therefore the metadata are not yet available.

Also note that this SDK method is not yet wrapped in python (today, only 70-80% of the SDK is wrapped in python. here is the list of available methods in python: [https://bitbucket.org/osimis/orthanc-setup-samples/src/master/python-samples/python-sdk.txt](https://bitbucket.org/osimis/orthanc-setup-samples/src/master/python-samples/python-sdk.txt))

So today, lua is indeed your only chance to filter incoming instances.

Possible workaround: delete unwanted instances in OnStoredInstance ([https://book.orthanc-server.com/plugins/python.html#accessing-the-content-of-a-new-instance](https://book.orthanc-server.com/plugins/python.html#accessing-the-content-of-a-new-instance))

HTH

Alain

---

_[View the full topic](https://discourse.orthanc-server.org/t/filtering-incoming-dicom-instances-using-metadata-with-python-plugin/2624)._
