integration layer; merge work on indicators from forks with existing ingestion pipeline
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { DocumentExtraction } from './api.types';
|
||||
|
||||
/** Clinical documents: field extraction and page/image rendering. */
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DocumentSourceApi {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
/** `payload` is the document source payload (files, segmentation, overrides...). */
|
||||
extract(payload: Record<string, unknown>, target: string): Observable<DocumentExtraction> {
|
||||
return this.http.post<DocumentExtraction>('/imports/sources/document/extract', { ...payload, target });
|
||||
}
|
||||
|
||||
/** PNG of a page, or of a normalized region of it (an embedded image). */
|
||||
pageImage(file: File, pageNumber: number, bbox?: [number, number, number, number], dpi = 110): Observable<Blob> {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
form.append('page_number', String(pageNumber));
|
||||
form.append('dpi', String(dpi));
|
||||
if (bbox) form.append('bbox', JSON.stringify(bbox));
|
||||
return this.http.post('/imports/sources/document/page-image', form, { responseType: 'blob' });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user