Present financial institutions with professional investor-facing descriptions and products
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
type PublicFunding = {
|
||||
title: string;
|
||||
kind: string;
|
||||
summary: string;
|
||||
institution_types?: string[];
|
||||
institution_services?: string[];
|
||||
products?: {
|
||||
title: string;
|
||||
instrument?: string | null;
|
||||
availability?: string;
|
||||
}[];
|
||||
};
|
||||
const descriptions: Record<string, string> = {
|
||||
commercial_bank: 'Instituição de banca comercial.',
|
||||
investment_bank: 'Instituição especializada em banca de investimento.',
|
||||
bank: 'Instituição bancária.',
|
||||
microbank: 'Instituição de microfinanças.',
|
||||
cooperative: 'Cooperativa de crédito.',
|
||||
savings: 'Organização de poupança e empréstimo.',
|
||||
investment_manager:
|
||||
'Sociedade especializada na gestão de fundos de investimento.',
|
||||
investment_company: 'Sociedade de investimento.',
|
||||
pension_manager: 'Entidade gestora de fundos de pensões.',
|
||||
insurer: 'Instituição do sector segurador.',
|
||||
reinsurer: 'Instituição especializada em resseguros.',
|
||||
microinsurer: 'Instituição de microsseguros.',
|
||||
broker: 'Entidade de corretagem de seguros.',
|
||||
agent: 'Entidade de mediação de seguros.',
|
||||
reinsurance_broker: 'Entidade de corretagem de resseguros.',
|
||||
exchange_house: 'Instituição de serviços cambiais.',
|
||||
electronic_money: 'Instituição de moeda electrónica.',
|
||||
interbank: 'Entidade de serviços interbancários.',
|
||||
supervisor: 'Entidade de supervisão do sistema financeiro.',
|
||||
};
|
||||
const services: Record<string, string> = {
|
||||
equity: 'Capital e participação no investimento',
|
||||
foreign_exchange: 'Câmbio',
|
||||
guarantee: 'Garantias',
|
||||
insurance: 'Seguros',
|
||||
investment: 'Financiamento do investimento',
|
||||
investment_management: 'Gestão de investimentos',
|
||||
payments: 'Serviços de pagamento',
|
||||
pension: 'Pensões',
|
||||
working_capital: 'Financiamento de tesouraria',
|
||||
};
|
||||
export function fundingPublicPresentation(p: PublicFunding) {
|
||||
const generic =
|
||||
p.summary.trim() ===
|
||||
'Instituição identificada no documento fornecido. Categoria, localização e contactos são informativos; produtos, disponibilidade e condições não documentados permanecem por confirmar.';
|
||||
const description = generic
|
||||
? (descriptions[p.institution_types?.[0] ?? ''] ??
|
||||
'Entidade do sector financeiro.')
|
||||
: p.summary
|
||||
.replace(
|
||||
/\s*Referência informativa, não concessão de financiamento\.?$/,
|
||||
'',
|
||||
)
|
||||
.replace(/Público\/finalidade:/g, 'Soluções para')
|
||||
.replace(/\.\./g, '.')
|
||||
.trim();
|
||||
const products = (p.products ?? [])
|
||||
.filter((x) => x.availability !== 'closed')
|
||||
.map((x) => ({ title: x.title, detail: x.instrument?.trim() ?? '' }));
|
||||
return {
|
||||
description,
|
||||
products,
|
||||
services: [
|
||||
...new Set(
|
||||
(p.institution_services ?? [])
|
||||
.map((s) => services[s])
|
||||
.filter(Boolean),
|
||||
),
|
||||
],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user