Nephila RiskStore

<back to all web services

FindEventSetRequest

General
Requires Authentication
The following routes are available for this service:
GET/api/riskstore/eventset/searchSearch for event sets
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QueryBase:
    skip: Optional[int] = None
    take: Optional[int] = None
    order_by: Optional[str] = None
    order_by_desc: Optional[str] = None
    include: Optional[str] = None
    fields: Optional[str] = None
    meta: Optional[Dict[str, str]] = None


T = TypeVar('T')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QueryDb(Generic[T], QueryBase, IReturn[QueryResponse[T]]):
    @staticmethod
    def response_type(): return QueryResponse[T]


class ProcessingStatus(IntEnum):
    NEW = 0
    PROCESSING = 1
    FAILED = 10
    SUCCESSFUL = 20


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EventSetTelemetry:
    event_set_id: int = 0
    started_date_time_utc: Optional[datetime.datetime] = None
    ended_date_time_uct: Optional[datetime.datetime] = None
    event_loss_count: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class EventSet:
    event_set_id: int = 0
    processing_status: Optional[ProcessingStatus] = None
    source_model_system: Optional[str] = None
    source_event_set_id: Optional[str] = None
    model_id: Optional[str] = None
    perspective_id: int = 0
    simulation_count: int = 0
    program_calculation_id: Optional[str] = None
    description: Optional[str] = None
    limit: float = 0.0
    reinstatements: int = 0
    event_source_type: Optional[str] = None
    event_set_origin_id: Optional[str] = None
    event_set_origin_name: Optional[str] = None
    event_set_origin_type: Optional[str] = None
    source_event_set_loss_container: Optional[str] = None
    source_event_set_loss_path: Optional[str] = None
    resolution: Optional[str] = None
    results_hash: Optional[str] = None
    expected_loss_aggregate: float = 0.0
    expected_loss_occurrence: float = 0.0
    probability_of_attachment: float = 0.0
    probability_of_exhaustion: float = 0.0
    approved_date_time_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    approved_by: Optional[str] = None
    event_source_id: int = 0
    valid_from_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    valid_to_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    container: Optional[str] = None
    blob_name: Optional[str] = None
    updated_date_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    is_archived: bool = False
    archived_loss_data_blob_path: Optional[str] = None
    archived_loss_data_hash: Optional[str] = None
    event_set_telemetry: Optional[EventSetTelemetry] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FindEventSetRequest(QueryDb[EventSet]):
    # @ApiMember(DataType="string", Description="Source Model System")
    source_model_system: Optional[str] = None
    """
    Source Model System
    """


    # @ApiMember(DataType="string", Description="Model Id")
    model_id: Optional[str] = None
    """
    Model Id
    """


    # @ApiMember(DataType="integer", Description="The perspective id for the event set", Format="int32")
    perspective_id: Optional[int] = None
    """
    The perspective id for the event set
    """


    # @ApiMember(DataType="string", Description="Source Event Set Id", Format="uuid")
    source_event_set_id: Optional[str] = None
    """
    Source Event Set Id
    """


class ResultOutputLevel(str, Enum):
    NOT_SET = 'NotSet'
    PORTFOLIO_METRICS = 'PortfolioMetrics'
    CURVE = 'Curve'
    YLT = 'YLT'
    TAIL_INTENSITY = 'TailIntensity'
    DEAL_YLT = 'DealYlt'
    DEAL_ELT = 'DealElt'
    DEAL_ELT_WITH_INDUSTRY_LOSS = 'DealEltWithIndustryLoss'
    PORTFOLIO_ELT = 'PortfolioElt'
    PORTFOLIO_ELT_WITH_INDUSTRY_LOSS = 'PortfolioEltWithIndustryLoss'
    EVENT_SET_GENERATION = 'EventSetGeneration'
    PORTFOLIO_RAPS = 'PortfolioRaps'
    DEAL_RAPS = 'DealRaps'
    PORTFOLIO_SEPY_INDUSTRY_LOSS = 'PortfolioSepyIndustryLoss'
    DEAL_SEPY_INDUSTRY_LOSS = 'DealSepyIndustryLoss'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AnalysisPortfolioEventSetConfiguration(IObjectWithId, IHasAnalysisId):
    id: int = 0
    analysis_id: int = 0
    analysis_configuration_id: int = 0
    portfolio_name: Optional[str] = None
    model_id: Optional[str] = None
    row_identifier: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AnalysisConfiguration(IObjectWithId, IHasAnalysisId):
    id: int = 0
    analysis_id: int = 0
    window_start_date: Optional[datetime.datetime] = None
    window_end_date: Optional[datetime.datetime] = None
    standard_enabled: bool = False
    run_off_enabled: bool = False
    aggregate_enabled: bool = False
    occurrence_enabled: bool = False
    nett_enabled: bool = False
    gross_enabled: bool = False
    tail_intensity_percentage_start: Optional[Decimal] = None
    tail_intensity_percentage_end: Optional[Decimal] = None
    meta_risk_id: int = 0
    output_level: Optional[ResultOutputLevel] = None
    processing_status: Optional[ProcessingStatus] = None
    event_loss_floor_start_range: Optional[Decimal] = None
    event_loss_floor_end_range: Optional[Decimal] = None
    analysis_portfolio_event_set_configurations: Optional[List[AnalysisPortfolioEventSetConfiguration]] = None
    row_identifier: Optional[str] = None


class TransactionType(str, Enum):
    NOT_SET = 'NotSet'
    S = 'S'
    B = 'B'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AnalysisPortfolioAllocation(IObjectWithId):
    id: int = 0
    analysis_deal_id: int = 0
    # @Validate(Validator="NotEmpty", Message="PortfolioName is mandatory")
    portfolio_name: Optional[str] = None

    allocation_percentage: float = 0.0
    row_identifier: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AnalysisDeal(IObjectWithId, IHasAnalysisId):
    id: int = 0
    analysis_id: int = 0
    source_deal_id: Optional[str] = None
    deal_ref: Optional[str] = None
    source_deal_system: Optional[str] = None
    event_set_id: int = 0
    rol: float = 0.0
    limit: float = 0.0
    inception_date: datetime.datetime = datetime.datetime(1, 1, 1)
    expiry_date: datetime.datetime = datetime.datetime(1, 1, 1)
    transaction_type: Optional[TransactionType] = None
    allocations: Optional[List[AnalysisPortfolioAllocation]] = None
    perspective_id_override: Optional[int] = None
    event_set_id_override: Optional[int] = None
    model_as_of_date_override: Optional[datetime.datetime] = None
    source_model_system_override: Optional[str] = None
    source_model_id_override: Optional[str] = None
    source_event_set_id_override: Optional[str] = None
    event_source_system_override: Optional[str] = None
    row_identifier: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AnalysisEventIdFilter(IObjectWithId, IHasAnalysisId):
    id: int = 0
    analysis_id: int = 0
    event_source_id: int = 0
    event_id: int = 0
    row_identifier: Optional[str] = None


class MessageType(str, Enum):
    NOT_SET = 'NotSet'
    PERSISTENCE = 'Persistence'
    ARCHIVAL = 'Archival'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MessageTracking:
    id: Optional[str] = None
    analysis_id: Optional[int] = None
    processing_status: Optional[ProcessingStatus] = None
    message_type: Optional[MessageType] = None
    created_date_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    updated_date_utc: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Analysis(IObjectWithId):
    id: int = 0
    name: Optional[str] = None
    model_as_of_date: Optional[datetime.datetime] = None
    perspective_id: int = 0
    configurations: Optional[List[AnalysisConfiguration]] = None
    deals: Optional[List[AnalysisDeal]] = None
    event_id_filters: Optional[List[AnalysisEventIdFilter]] = None
    created_by: Optional[str] = None
    created_date_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    completed_date_utc: Optional[datetime.datetime] = None
    legacy_analysis_id: Optional[int] = None
    result_persistence_tracking: Optional[List[MessageTracking]] = None
    processing_status: Optional[ProcessingStatus] = None
    save_results: bool = False
    event_source_system: Optional[str] = None
    updated_date_utc: datetime.datetime = datetime.datetime(1, 1, 1)
    is_expired: bool = False
    row_identifier: Optional[str] = None
    error_message: Optional[str] = None
    # @ApiMember(DataType="boolean", Description="Take the minimum simulation count when we have different simulations between event sets")
    ignore_simulation_count_mismatch: bool = False
    """
    Take the minimum simulation count when we have different simulations between event sets
    """


    # @Ignore()
    final_status: Optional[ProcessingStatus] = None


T = TypeVar('T')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QueryResponse(Generic[T]):
    offset: int = 0
    total: int = 0
    results: Optional[List[Analysis]] = None
    meta: Optional[Dict[str, str]] = None
    response_status: Optional[ResponseStatus] = None

Python FindEventSetRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /api/riskstore/eventset/search HTTP/1.1 
Host: riskstoreng-dev.nephila.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfEventSete3Twhsvh xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Offset>0</Offset>
  <Total>0</Total>
  <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/Nephila.RiskStore.ServiceModel.Types">
    <d2p1:EventSet>
      <d2p1:ApprovedBy>String</d2p1:ApprovedBy>
      <d2p1:ApprovedDateTimeUtc>0001-01-01T00:00:00</d2p1:ApprovedDateTimeUtc>
      <d2p1:ArchivedLossDataBlobPath>String</d2p1:ArchivedLossDataBlobPath>
      <d2p1:ArchivedLossDataHash>String</d2p1:ArchivedLossDataHash>
      <d2p1:BlobName>String</d2p1:BlobName>
      <d2p1:Container>String</d2p1:Container>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:EventSetId>0</d2p1:EventSetId>
      <d2p1:EventSetOriginId>String</d2p1:EventSetOriginId>
      <d2p1:EventSetOriginName>String</d2p1:EventSetOriginName>
      <d2p1:EventSetOriginType>String</d2p1:EventSetOriginType>
      <d2p1:EventSetTelemetry>
        <d2p1:EndedDateTimeUct>0001-01-01T00:00:00</d2p1:EndedDateTimeUct>
        <d2p1:EventLossCount>0</d2p1:EventLossCount>
        <d2p1:EventSetId>0</d2p1:EventSetId>
        <d2p1:StartedDateTimeUtc>0001-01-01T00:00:00</d2p1:StartedDateTimeUtc>
      </d2p1:EventSetTelemetry>
      <d2p1:EventSourceId>0</d2p1:EventSourceId>
      <d2p1:EventSourceType>String</d2p1:EventSourceType>
      <d2p1:ExpectedLossAggregate>0</d2p1:ExpectedLossAggregate>
      <d2p1:ExpectedLossOccurrence>0</d2p1:ExpectedLossOccurrence>
      <d2p1:IsArchived>false</d2p1:IsArchived>
      <d2p1:Limit>0</d2p1:Limit>
      <d2p1:ModelId>String</d2p1:ModelId>
      <d2p1:PerspectiveId>0</d2p1:PerspectiveId>
      <d2p1:ProbabilityOfAttachment>0</d2p1:ProbabilityOfAttachment>
      <d2p1:ProbabilityOfExhaustion>0</d2p1:ProbabilityOfExhaustion>
      <d2p1:ProcessingStatus>New</d2p1:ProcessingStatus>
      <d2p1:ProgramCalculationId>String</d2p1:ProgramCalculationId>
      <d2p1:Reinstatements>0</d2p1:Reinstatements>
      <d2p1:Resolution>String</d2p1:Resolution>
      <d2p1:ResultsHash>String</d2p1:ResultsHash>
      <d2p1:SimulationCount>0</d2p1:SimulationCount>
      <d2p1:SourceEventSetId>String</d2p1:SourceEventSetId>
      <d2p1:SourceEventSetLossContainer>String</d2p1:SourceEventSetLossContainer>
      <d2p1:SourceEventSetLossPath>String</d2p1:SourceEventSetLossPath>
      <d2p1:SourceModelSystem>String</d2p1:SourceModelSystem>
      <d2p1:UpdatedDateUtc>0001-01-01T00:00:00</d2p1:UpdatedDateUtc>
      <d2p1:ValidFromUtc>0001-01-01T00:00:00</d2p1:ValidFromUtc>
      <d2p1:ValidToUtc>0001-01-01T00:00:00</d2p1:ValidToUtc>
    </d2p1:EventSet>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Meta>
      </ResponseError>
    </Errors>
    <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Meta>
  </ResponseStatus>
</QueryResponseOfEventSete3Twhsvh>