fix: fixed patent level and mapping status model
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Mats Paul Tončik
2026-07-19 13:02:00 +02:00
parent 5a47d9bb52
commit d1490dceb0
10 changed files with 66 additions and 36 deletions
@@ -1,17 +1,23 @@
from typing import Literal
from enum import StrEnum
from pydantic import BaseModel, Field
from inse.patents.common.model import PatentEntry
KeywordPatentLevel = Literal["broad", "coarse", "fine", "custom"]
KeywordPatentMappingStatus = Literal[
"mapped",
"uncertain",
"no_mapping",
"no_patents_found",
"search_error",
]
class KeywordPatentLevel(StrEnum):
BROAD = "broad"
COARSE = "coarse"
FINE = "fine"
CUSTOM = "custom"
class KeywordPatentMappingStatus(StrEnum):
MAPPED = "mapped"
UNCERTAIN = "uncertain"
NO_MAPPING = "no_mapping"
NO_PATENTS_FOUND = "no_patents_found"
SEARCH_ERROR = "search_error"
class KeywordPatentSearchItem(BaseModel):
@@ -141,6 +141,8 @@ model/ipcClassification.ts
model/keywordEntry.ts
model/keywordEntryWithTopic.ts
model/keywordEvidence.ts
model/keywordPatentLevel.ts
model/keywordPatentMappingStatus.ts
model/keywordPatentMatch.ts
model/keywordPatentSearchDiagnostics.ts
model/keywordPatentSearchItem.ts
@@ -0,0 +1,19 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export const KeywordPatentLevel = {
Broad: 'broad',
Coarse: 'coarse',
Fine: 'fine',
Custom: 'custom'
} as const;
export type KeywordPatentLevel = typeof KeywordPatentLevel[keyof typeof KeywordPatentLevel];
@@ -0,0 +1,20 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export const KeywordPatentMappingStatus = {
Mapped: 'mapped',
Uncertain: 'uncertain',
NoMapping: 'no_mapping',
NoPatentsFound: 'no_patents_found',
SearchError: 'search_error'
} as const;
export type KeywordPatentMappingStatus = typeof KeywordPatentMappingStatus[keyof typeof KeywordPatentMappingStatus];
@@ -7,6 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { KeywordPatentLevel } from './keywordPatentLevel';
export interface KeywordPatentSearchItem {
@@ -14,7 +15,7 @@ export interface KeywordPatentSearchItem {
* Extracted keyword text.
*/
keyword: string;
keyword_level?: KeywordPatentSearchItem.KeywordLevelEnum | null;
keyword_level?: KeywordPatentLevel | null;
topic_id?: string | null;
topic_display_name?: string | null;
subfield_name?: string | null;
@@ -25,13 +26,6 @@ export interface KeywordPatentSearchItem {
relevance_score?: number;
}
export namespace KeywordPatentSearchItem {
export const KeywordLevelEnum = {
Broad: 'broad',
Coarse: 'coarse',
Fine: 'fine',
Custom: 'custom'
} as const;
export type KeywordLevelEnum = typeof KeywordLevelEnum[keyof typeof KeywordLevelEnum];
}
+2
View File
@@ -113,6 +113,8 @@ export * from './ipcClassification';
export * from './keywordEntry';
export * from './keywordEntryWithTopic';
export * from './keywordEvidence';
export * from './keywordPatentLevel';
export * from './keywordPatentMappingStatus';
export * from './keywordPatentMatch';
export * from './keywordPatentSearchDiagnostics';
export * from './keywordPatentSearchItem';
@@ -7,6 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { KeywordPatentMappingStatus } from './keywordPatentMappingStatus';
import { KeywordPatentSearchDiagnostics } from './keywordPatentSearchDiagnostics';
import { KeywordPatentMatch } from './keywordPatentMatch';
@@ -17,18 +18,10 @@ export interface PatentsByKeywordsResponse {
/**
* IPC mapping outcome: mapped (IPC used), uncertain (fragmented evidence; may include text-retrieved patents), no_mapping (no usable IPC evidence; may include text-retrieved patents), no_patents_found (neither IPC nor keyword text search produced relevant patents), or search_error (technical failure talking to the search backend).
*/
mapping_status: PatentsByKeywordsResponse.MappingStatusEnum;
mapping_status: KeywordPatentMappingStatus;
diagnostics?: KeywordPatentSearchDiagnostics | null;
}
export namespace PatentsByKeywordsResponse {
export const MappingStatusEnum = {
Mapped: 'mapped',
Uncertain: 'uncertain',
NoMapping: 'no_mapping',
NoPatentsFound: 'no_patents_found',
SearchError: 'search_error'
} as const;
export type MappingStatusEnum = typeof MappingStatusEnum[keyof typeof MappingStatusEnum];
}
@@ -5,12 +5,12 @@ import { MatIconModule } from '@angular/material/icon';
import { Router } from '@angular/router';
import { PatentEntry } from '../../../api/model/patentEntry';
import { KeywordPatentMatch } from '../../../api/model/keywordPatentMatch';
import { KeywordPatentMappingStatus } from '../../../api/model/patentsByKeywordsResponse';
import { LoadingComponent } from '../../../shared/ui/loading/loading.component';
import {
formatPatentDate,
getPublicationStageLabel,
} from '../../patent-detail/patent-detail.utils';
import { KeywordPatentMappingStatus } from '../../../api';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@@ -1,9 +1,7 @@
import { KeywordPatentMappingStatus } from '../../api';
import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic';
import { KeywordPatentMatch } from '../../api/model/keywordPatentMatch';
import { KeywordPatentSearchItem } from '../../api/model/keywordPatentSearchItem';
import {
KeywordPatentMappingStatus,
} from '../../api/model/patentsByKeywordsResponse';
import {
PatentKeywordEntry,
SearchResultsPayload,
@@ -11,8 +9,6 @@ import {
export const PATENTS_CACHE_KEY = 'keywords-patents-cache';
export type { KeywordPatentMappingStatus };
export interface PatentsCache {
keywords: string[];
matches: KeywordPatentMatch[];
@@ -6,10 +6,7 @@ import { MatIconModule } from '@angular/material/icon';
import { KeywordsService } from '../../../../api/api/keywords.service';
import { KeywordPatentMatch } from '../../../../api/model/keywordPatentMatch';
import {
KeywordPatentMappingStatus,
PatentsByKeywordsResponse,
} from '../../../../api/model/patentsByKeywordsResponse';
import { PatentsByKeywordsResponse } from '../../../../api/model/patentsByKeywordsResponse';
import {
WeightMap,
WeightSliderOption,
@@ -28,6 +25,7 @@ import {
writePatentsCache,
} from '../../patent-search.utils';
import { SearchResultsStateService } from '../search-results-state.service';
import { KeywordPatentMappingStatus } from '../../../../api';
@Component({
selector: 'app-patents-results',