sarpy icon indicating copy to clipboard operation
sarpy copied to clipboard

Bugfix: Incorrect SIDD ISM.compliesWith definition

Open pressler-vsc opened this issue 5 months ago • 1 comments

Description

Someone reported that SARPy's handling of SIDD's ISM compliesWith attribute is currently incorrect. SARPy is treating the attribute as a scalar enum, when the various SIDD schemas in SARPy all have it as an xsd:list:

The issue can be demonstrated by running the new test in integration/1.3.59-rc:

SARPY_TEST_PATH=/data/sarpy_test/ pytest tests/io/product/test_sidd.py::test_product_creation_classification
============================================================================================================================================================================== test session starts ==============================================================================================================================================================================
platform linux -- Python 3.10.14, pytest-7.4.4, pluggy-1.0.0
rootdir: /home/vscuser/git/glweb/software/third-party/sarpy
plugins: anyio-4.2.0, cov-4.1.0
collected 3 items                                                                                                                                                                                                                                                                                                                                                               

tests/io/product/test_sidd.py FFF                                                                                                                                                                                                                                                                                                                                         [100%]

============================================================================================================================================================================ short test summary info ============================================================================================================================================================================
FAILED tests/io/product/test_sidd.py::test_product_creation_classification[1] - assert not ["Attribute compliesWith of class ProductClassificationType received ,\n\tbut values ARE REQUIRED to be one of ('ICD-710', 'DoD5230.24')"]
FAILED tests/io/product/test_sidd.py::test_product_creation_classification[2] - assert not ["Attribute compliesWith of class ProductClassificationType received ,\n\tbut values ARE REQUIRED to be one of ('USGov', 'USIC', 'USDOD', 'OtherAuthority')"]
FAILED tests/io/product/test_sidd.py::test_product_creation_classification[3] - assert not ["Attribute compliesWith of class ProductClassificationType received ,\n\tbut values ARE REQUIRED to be one of ('USGov', 'USIC', 'USDOD', 'OtherAuthority')"]
=============================================================================================================================================================================== 3 failed in 2.44s ===============================================================================================================================================================================

What is the fix?

Instead of StringEnumDescriptor, encode as StringDescriptor, as is done for all of the other ISM lists already:

$ grep -rIin --colour "xsd:list" sarpy/io/product/sidd_schema/version1/
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMCompliesWith.xsd:39:            <xsd:list itemType="CVEnumISMCompliesWithValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMDissem.xsd:127:            <xsd:list itemType="CVEnumISMDissemValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMFGIOpen.xsd:1380:            <xsd:list itemType="CVEnumISMFGIOpenValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMFGIProtected.xsd:1380:            <xsd:list itemType="CVEnumISMFGIProtectedValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMNonIC.xsd:74:            <xsd:list itemType="CVEnumISMNonICValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMNonUSControls.xsd:44:            <xsd:list itemType="CVEnumISMNonUSControlsValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMNotice.xsd:99:            <xsd:list itemType="CVEnumISMNoticeValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMOwnerProducer.xsd:1385:            <xsd:list itemType="CVEnumISMOwnerProducerValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMRelTo.xsd:1380:            <xsd:list itemType="CVEnumISMRelToValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMSAR.xsd:41:            <xsd:list itemType="CVEnumISMSARValues"/>
sarpy/io/product/sidd_schema/version1/external/ISM/Schema/CVEGenerated/CVEnumISMSCIControls.xsd:72:            <xsd:list itemType="CVEnumISMSCIControlsValues"/>

I also added/changed the description to correct for grammar using a description from the ISM documentation:

image

pressler-vsc avatar Aug 27 '24 14:08 pressler-vsc