@fin.cx/opendata 1.1.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/classes.businessrecord.d.ts +7 -3
- package/dist_ts/classes.businessrecord.js +3 -2
- package/dist_ts/classes.handelsregister.d.ts +90 -0
- package/dist_ts/classes.handelsregister.js +271 -0
- package/dist_ts/classes.jsonldata.d.ts +7 -0
- package/dist_ts/classes.jsonldata.js +77 -0
- package/dist_ts/classes.main.opendata.d.ts +5 -2
- package/dist_ts/classes.main.opendata.js +13 -5
- package/dist_ts/paths.d.ts +1 -0
- package/dist_ts/paths.js +3 -1
- package/dist_ts/plugins.d.ts +6 -1
- package/dist_ts/plugins.js +8 -2
- package/license +19 -0
- package/npmextra.json +7 -3
- package/package.json +26 -18
- package/readme.md +118 -153
- package/ts/00_commitinfo_data.ts +2 -2
- package/ts/classes.businessrecord.ts +37 -24
- package/ts/classes.handelsregister.ts +339 -0
- package/ts/{classes.germanbusinessdata.ts → classes.jsonldata.ts} +8 -10
- package/ts/classes.main.opendata.ts +18 -6
- package/ts/paths.ts +4 -0
- package/ts/plugins.ts +14 -1
package/license
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2022 Task Venture Capital GmbH (hello@task.vc)
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/npmextra.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"githost": "gitlab.com",
|
|
6
6
|
"gitscope": "fin.cx",
|
|
7
7
|
"gitrepo": "opendata",
|
|
8
|
-
"description": "A TypeScript
|
|
8
|
+
"description": "A TypeScript library for accessing, managing, and updating open business data, focused on German companies and integrating with MongoDB.",
|
|
9
9
|
"npmPackagename": "@fin.cx/opendata",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"projectDomain": "fin.cx",
|
|
@@ -17,9 +17,13 @@
|
|
|
17
17
|
"data management",
|
|
18
18
|
"business registry",
|
|
19
19
|
"npm package",
|
|
20
|
-
"database",
|
|
21
20
|
"MongoDB",
|
|
22
|
-
"automation"
|
|
21
|
+
"automation",
|
|
22
|
+
"data integration",
|
|
23
|
+
"database",
|
|
24
|
+
"data processing",
|
|
25
|
+
"data retrieval",
|
|
26
|
+
"data update"
|
|
23
27
|
]
|
|
24
28
|
}
|
|
25
29
|
},
|
package/package.json
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fin.cx/opendata",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "A TypeScript
|
|
5
|
+
"description": "A TypeScript library for accessing, managing, and updating open business data, focused on German companies and integrating with MongoDB.",
|
|
6
6
|
"main": "dist_ts/index.js",
|
|
7
7
|
"typings": "dist_ts/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"author": "Task Venture Capital GmbH",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@git.zone/tsbuild": "^2.
|
|
13
|
-
"@git.zone/tsbundle": "^2.0
|
|
14
|
-
"@git.zone/tsrun": "^1.
|
|
15
|
-
"@git.zone/tstest": "^1.0.
|
|
16
|
-
"@push.rocks/tapbundle": "^5.
|
|
17
|
-
"@types/node": "^
|
|
12
|
+
"@git.zone/tsbuild": "^2.2.0",
|
|
13
|
+
"@git.zone/tsbundle": "^2.1.0",
|
|
14
|
+
"@git.zone/tsrun": "^1.3.3",
|
|
15
|
+
"@git.zone/tstest": "^1.0.90",
|
|
16
|
+
"@push.rocks/tapbundle": "^5.5.4",
|
|
17
|
+
"@types/node": "^22.10.4"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@push.rocks/
|
|
21
|
-
"@push.rocks/
|
|
22
|
-
"@push.rocks/
|
|
20
|
+
"@push.rocks/lik": "^6.1.0",
|
|
21
|
+
"@push.rocks/qenv": "^6.1.0",
|
|
22
|
+
"@push.rocks/smartarchive": "^4.0.39",
|
|
23
|
+
"@push.rocks/smartbrowser": "^2.0.8",
|
|
24
|
+
"@push.rocks/smartdata": "^5.2.10",
|
|
23
25
|
"@push.rocks/smartdelay": "^3.0.5",
|
|
24
|
-
"@push.rocks/smartfile": "^11.0.
|
|
25
|
-
"@push.rocks/smartpath": "^5.0.
|
|
26
|
-
"@push.rocks/smartpromise": "^4.0.
|
|
27
|
-
"@push.rocks/smartrequest": "^2.0.
|
|
28
|
-
"@push.rocks/smartstream": "^3.
|
|
26
|
+
"@push.rocks/smartfile": "^11.0.23",
|
|
27
|
+
"@push.rocks/smartpath": "^5.0.18",
|
|
28
|
+
"@push.rocks/smartpromise": "^4.0.4",
|
|
29
|
+
"@push.rocks/smartrequest": "^2.0.23",
|
|
30
|
+
"@push.rocks/smartstream": "^3.2.5",
|
|
31
|
+
"@push.rocks/smartunique": "^3.0.9",
|
|
32
|
+
"@tsclass/tsclass": "^4.2.0"
|
|
29
33
|
},
|
|
30
34
|
"repository": {
|
|
31
35
|
"type": "git",
|
|
@@ -58,9 +62,13 @@
|
|
|
58
62
|
"data management",
|
|
59
63
|
"business registry",
|
|
60
64
|
"npm package",
|
|
61
|
-
"database",
|
|
62
65
|
"MongoDB",
|
|
63
|
-
"automation"
|
|
66
|
+
"automation",
|
|
67
|
+
"data integration",
|
|
68
|
+
"database",
|
|
69
|
+
"data processing",
|
|
70
|
+
"data retrieval",
|
|
71
|
+
"data update"
|
|
64
72
|
],
|
|
65
73
|
"scripts": {
|
|
66
74
|
"test": "(tstest test/ --web)",
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
```markdown
|
|
2
1
|
# @fin.cx/opendata
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
A TypeScript-based library for accessing and managing open business data, specifically for German companies.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -20,234 +20,199 @@ yarn add @fin.cx/opendata
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
The `@fin.cx/opendata` package
|
|
23
|
+
The `@fin.cx/opendata` package provides a comprehensive set of functionalities for handling open business data, focusing on German business data. Let's explore the detailed capabilities of this library through extensive examples and instructions.
|
|
24
|
+
|
|
25
|
+
### Setting Up the Environment
|
|
26
|
+
|
|
27
|
+
First, make sure you've set up the necessary environment variables for MongoDB. You will need the following environment variables:
|
|
28
|
+
- `MONGODB_URL`: The URL for your MongoDB instance.
|
|
29
|
+
- `MONGODB_NAME`: The name of the database to use.
|
|
30
|
+
- `MONGODB_USER`: A valid username for accessing the database.
|
|
31
|
+
- `MONGODB_PASS`: The password associated with the MongoDB user.
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
These variables can be configured in a `.env` file or managed through a specific service used for secure environment variables handling.
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
### Importing and Initializing the Library
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
To start working with the library, import the necessary classes and initialize the `OpenData` class.
|
|
30
38
|
|
|
31
39
|
```typescript
|
|
32
40
|
import { OpenData } from '@fin.cx/opendata';
|
|
33
41
|
|
|
34
|
-
const
|
|
42
|
+
const initializeOpenData = async () => {
|
|
35
43
|
const openData = new OpenData();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
await openData.start();
|
|
47
|
+
console.log('OpenData instance has started successfully.');
|
|
48
|
+
|
|
49
|
+
// Example usage:
|
|
50
|
+
await createAndManageBusinessRecords(openData);
|
|
51
|
+
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('Error starting OpenData:', error);
|
|
54
|
+
} finally {
|
|
55
|
+
await openData.stop();
|
|
56
|
+
console.log('OpenData instance has stopped.');
|
|
57
|
+
}
|
|
44
58
|
};
|
|
45
59
|
|
|
46
|
-
|
|
60
|
+
initializeOpenData();
|
|
47
61
|
```
|
|
48
62
|
|
|
49
|
-
###
|
|
63
|
+
### Managing Business Records
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
The `BusinessRecord` class represents a company's data. Let's explore how you can create, retrieve, update, and manage these records.
|
|
52
66
|
|
|
53
67
|
#### Creating a New BusinessRecord
|
|
54
68
|
|
|
69
|
+
Creating a new business record involves instantiating the `BusinessRecord` class and setting the relevant properties.
|
|
70
|
+
|
|
55
71
|
```typescript
|
|
56
72
|
import { BusinessRecord } from '@fin.cx/opendata';
|
|
57
73
|
|
|
58
74
|
const createBusinessRecord = async (openData: OpenData) => {
|
|
59
75
|
const businessRecord = new openData.CBusinessRecord();
|
|
60
|
-
|
|
61
|
-
businessRecord.data
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
businessRecord.data = {
|
|
78
|
+
name: "Tech Innovations GmbH",
|
|
79
|
+
address: "Tech Park 42",
|
|
80
|
+
postalCode: "80333",
|
|
81
|
+
city: "Munich",
|
|
82
|
+
country: "Germany",
|
|
83
|
+
phone: "+49 89 123456",
|
|
84
|
+
email: "info@techinnovations.de",
|
|
85
|
+
website: "https://techinnovations.de",
|
|
86
|
+
businessType: "GmbH",
|
|
87
|
+
registrationNumber: "HRB 654321",
|
|
88
|
+
registrationCourt: "Munich",
|
|
89
|
+
legalForm: "GmbH",
|
|
90
|
+
managingDirectors: ["Alice Müller", "Bob Schmidt"],
|
|
91
|
+
foundingDate: new Date("2020-01-01").toISOString(),
|
|
92
|
+
capital: "100,000 EUR",
|
|
93
|
+
purpose: "Developing innovative tech solutions",
|
|
94
|
+
lastUpdate: new Date().toISOString()
|
|
95
|
+
};
|
|
77
96
|
|
|
78
97
|
await businessRecord.save();
|
|
79
98
|
console.log('BusinessRecord saved:', businessRecord);
|
|
80
99
|
};
|
|
81
100
|
```
|
|
82
101
|
|
|
83
|
-
#### Retrieving
|
|
102
|
+
#### Retrieving Business Records
|
|
84
103
|
|
|
85
|
-
|
|
104
|
+
You can retrieve existing business records by querying the database using various data fields.
|
|
86
105
|
|
|
87
106
|
```typescript
|
|
88
|
-
|
|
107
|
+
const retrieveBusinessRecords = async (openData: OpenData) => {
|
|
108
|
+
const records = await openData.db
|
|
109
|
+
.collection<BusinessRecord>('businessrecords')
|
|
110
|
+
.find({ city: "Munich" })
|
|
111
|
+
.toArray();
|
|
89
112
|
|
|
90
|
-
|
|
91
|
-
const businessRecords = await openData.db.collection<BusinessRecord>('businessrecords').find().toArray();
|
|
92
|
-
console.log('Retrieved Business Records:', businessRecords);
|
|
113
|
+
console.log('Found Business Records:', records);
|
|
93
114
|
};
|
|
94
115
|
```
|
|
95
116
|
|
|
96
|
-
|
|
117
|
+
#### Updating Existing Records
|
|
97
118
|
|
|
98
|
-
|
|
119
|
+
To update an existing `BusinessRecord`, you retrieve the record, modify its data, and save it again.
|
|
99
120
|
|
|
100
|
-
|
|
121
|
+
```typescript
|
|
122
|
+
const updateBusinessRecord = async (openData: OpenData, recordId: string) => {
|
|
123
|
+
const businessRecord = await openData.CBusinessRecord.getInstance(recordId);
|
|
124
|
+
if (businessRecord) {
|
|
125
|
+
businessRecord.data.phone = "+49 89 987654";
|
|
126
|
+
businessRecord.data.lastUpdate = new Date().toISOString();
|
|
127
|
+
|
|
128
|
+
await businessRecord.save();
|
|
129
|
+
console.log('BusinessRecord updated:', businessRecord);
|
|
130
|
+
} else {
|
|
131
|
+
console.log('BusinessRecord not found for id:', recordId);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Deleting a Business Record
|
|
137
|
+
|
|
138
|
+
You can delete a business record using its unique identifier.
|
|
101
139
|
|
|
102
140
|
```typescript
|
|
103
|
-
|
|
141
|
+
const deleteBusinessRecord = async (openData: OpenData, recordId: string) => {
|
|
142
|
+
const businessRecord = await openData.CBusinessRecord.getInstance(recordId);
|
|
143
|
+
if (businessRecord) {
|
|
144
|
+
await businessRecord.delete();
|
|
145
|
+
console.log(`BusinessRecord with id ${recordId} deleted successfully.`);
|
|
146
|
+
} else {
|
|
147
|
+
console.log('No record found for the provided id:', recordId);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Updating German Business Data
|
|
104
153
|
|
|
154
|
+
The package includes functionalities to keep your business data up-to-date by downloading from official German open data repositories.
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
105
157
|
const updateGermanBusinessData = async (openData: OpenData) => {
|
|
106
|
-
|
|
107
|
-
|
|
158
|
+
try {
|
|
159
|
+
await openData.germanBusinesses.update();
|
|
160
|
+
console.log('German business data has been updated successfully.');
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.error('Error updating German business data:', error);
|
|
163
|
+
}
|
|
108
164
|
};
|
|
109
|
-
|
|
110
|
-
startOpenDataInstance()
|
|
111
|
-
.then((openData) => {
|
|
112
|
-
// Use the instance
|
|
113
|
-
return updateGermanBusinessData(openData);
|
|
114
|
-
})
|
|
115
|
-
.catch(console.error);
|
|
116
165
|
```
|
|
117
166
|
|
|
118
|
-
This function
|
|
167
|
+
This function fetches the latest open data regarding German companies, processes it, and updates your local database.
|
|
119
168
|
|
|
120
|
-
### Detailed Class
|
|
169
|
+
### Detailed Class Insights
|
|
121
170
|
|
|
122
171
|
#### OpenData Class
|
|
123
172
|
|
|
124
|
-
The `OpenData` class
|
|
173
|
+
The `OpenData` class serves as the core of the library, initializing necessary components and controlling data flows:
|
|
125
174
|
|
|
126
|
-
|
|
127
|
-
|
|
175
|
+
- **db**: Represents the connection to your MongoDB database.
|
|
176
|
+
- **germanBusinesses**: An instance handling specific operations related to German business data updates.
|
|
128
177
|
|
|
178
|
+
```typescript
|
|
129
179
|
class OpenData {
|
|
130
180
|
db: plugins.smartdata.SmartdataDb;
|
|
131
181
|
germanBusinesses: GermanBusinessData;
|
|
132
182
|
|
|
133
183
|
private serviceQenv = new plugins.qenv.Qenv(paths.packageDir, paths.nogitDir);
|
|
134
184
|
|
|
135
|
-
public CBusinessRecord = plugins.smartdata.setDefaultManagerForDoc(this, BusinessRecord);
|
|
136
|
-
|
|
137
185
|
public async start() {
|
|
138
|
-
//
|
|
139
|
-
this.db = new plugins.smartdata.SmartdataDb({
|
|
140
|
-
mongoDbUrl: await this.serviceQenv.getEnvVarOnDemand('MONGODB_URL'),
|
|
141
|
-
mongoDbName: await this.serviceQenv.getEnvVarOnDemand('MONGODB_NAME'),
|
|
142
|
-
mongoDbUser: await this.serviceQenv.getEnvVarOnDemand('MONGODB_USER'),
|
|
143
|
-
mongoDbPass: await this.serviceQenv.getEnvVarOnDemand('MONGODB_PASS'),
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
await this.db.init();
|
|
147
|
-
this.germanBusinesses = new GermanBusinessData(this);
|
|
148
|
-
await this.germanBusinesses.start();
|
|
186
|
+
// Database initialization logic
|
|
149
187
|
}
|
|
150
188
|
|
|
151
189
|
public async stop() {
|
|
152
|
-
//
|
|
190
|
+
// Cleanup logic
|
|
153
191
|
}
|
|
154
192
|
}
|
|
155
193
|
```
|
|
156
194
|
|
|
157
195
|
#### GermanBusinessData Class
|
|
158
196
|
|
|
159
|
-
|
|
197
|
+
This class deals specifically with German company data — fetching, processing, and updating local databases consistently with official German data sources.
|
|
160
198
|
|
|
161
199
|
```typescript
|
|
162
|
-
import { OpenData } from '@fin.cx/opendata';
|
|
163
|
-
import * as plugins from './plugins';
|
|
164
|
-
import * as paths from './paths';
|
|
165
|
-
|
|
166
200
|
class GermanBusinessData {
|
|
167
|
-
public openDataRef: OpenData;
|
|
168
|
-
|
|
169
|
-
constructor(openDataRef: OpenData) {
|
|
170
|
-
this.openDataRef = openDataRef;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
201
|
public async start() {
|
|
174
202
|
await this.update();
|
|
175
203
|
}
|
|
176
204
|
|
|
177
|
-
public async stop() {
|
|
178
|
-
// Stop any ongoing processing
|
|
179
|
-
}
|
|
180
|
-
|
|
181
205
|
public async update() {
|
|
182
|
-
|
|
183
|
-
const dataExists = await plugins.smartfile.fs.isDirectory(paths.germanBusinessDataDir);
|
|
184
|
-
|
|
185
|
-
if (!dataExists) {
|
|
186
|
-
await plugins.smartfile.fs.ensureDir(paths.germanBusinessDataDir);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const smartarchive = await plugins.smartarchive.SmartArchive.fromArchiveUrl(dataUrl);
|
|
190
|
-
const jsonlDataStream = await smartarchive.exportToStreamOfStreamFiles();
|
|
191
|
-
|
|
192
|
-
let totalRecordsCounter = 0;
|
|
193
|
-
let nextRest: string = '';
|
|
194
|
-
|
|
195
|
-
jsonlDataStream.pipe(
|
|
196
|
-
new plugins.smartstream.SmartDuplex({
|
|
197
|
-
objectMode: true,
|
|
198
|
-
writeFunction: async (chunkArg: plugins.smartfile.StreamFile, streamToolsArg) => {
|
|
199
|
-
const readStream = await chunkArg.createReadStream();
|
|
200
|
-
readStream.pipe(
|
|
201
|
-
new plugins.smartstream.SmartDuplex({
|
|
202
|
-
objectMode: true,
|
|
203
|
-
writeFunction: async (chunkArg: Buffer, streamToolsArg) => {
|
|
204
|
-
const currentString = nextRest + chunkArg.toString();
|
|
205
|
-
|
|
206
|
-
const lines = currentString.split('\n');
|
|
207
|
-
nextRest = lines.pop();
|
|
208
|
-
|
|
209
|
-
for (const line of lines) {
|
|
210
|
-
let entry: any;
|
|
211
|
-
try {
|
|
212
|
-
entry = JSON.parse(line);
|
|
213
|
-
} catch (err) {
|
|
214
|
-
console.error('Error parsing line:', err);
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
totalRecordsCounter++;
|
|
219
|
-
if (totalRecordsCounter % 10000 === 0) {
|
|
220
|
-
console.log(`${totalRecordsCounter} total records.`);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const businessRecord = new this.openDataRef.CBusinessRecord();
|
|
224
|
-
businessRecord.data.name = entry?.name;
|
|
225
|
-
|
|
226
|
-
await businessRecord.save();
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
finalFunction: async (streamToolsArg) => {
|
|
230
|
-
if (nextRest) {
|
|
231
|
-
try {
|
|
232
|
-
JSON.parse(nextRest);
|
|
233
|
-
} catch (err) {
|
|
234
|
-
console.error('Error parsing final chunk:', err);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
})
|
|
239
|
-
);
|
|
240
|
-
},
|
|
241
|
-
})
|
|
242
|
-
);
|
|
206
|
+
// Logic for updating business data using import streams and parsing JSON lines.
|
|
243
207
|
}
|
|
244
208
|
}
|
|
245
209
|
```
|
|
246
210
|
|
|
247
|
-
###
|
|
211
|
+
### Ensuring Data Accuracy and Integrity
|
|
248
212
|
|
|
249
|
-
|
|
213
|
+
When working with business data, ensuring integrity and accuracy is crucial. Each record should be checked for validity before being saved or updated, minimizing inconsistencies. Moreover, robust error handling is essential in every step, from data retrieval to database operations, particularly when dealing with external data sources.
|
|
250
214
|
|
|
251
|
-
|
|
252
|
-
|
|
215
|
+
The `@fin.cx/opendata` module provides an extensive toolset for accessing and managing business data, particularly for companies based in Germany. Its functionalities include creating, updating, retrieving, and deleting business records, as well as keeping them current with the latest open data releases. This makes it an invaluable asset for developers aiming to integrate open data seamlessly into their systems, ensuring robust data management capabilities within their applications.
|
|
216
|
+
|
|
217
|
+
Happy exploring and integrating open data into your projects!
|
|
253
218
|
undefined
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@fin.cx/opendata',
|
|
6
|
-
version: '1.
|
|
7
|
-
description: 'A TypeScript
|
|
6
|
+
version: '1.4.0',
|
|
7
|
+
description: 'A TypeScript library for accessing, managing, and updating open business data, focused on German companies and integrating with MongoDB.'
|
|
8
8
|
}
|
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
|
|
3
3
|
@plugins.smartdata.Manager()
|
|
4
|
-
export class BusinessRecord extends plugins.smartdata.SmartDataDbDoc<
|
|
5
|
-
|
|
4
|
+
export class BusinessRecord extends plugins.smartdata.SmartDataDbDoc<
|
|
5
|
+
BusinessRecord,
|
|
6
|
+
BusinessRecord
|
|
7
|
+
> {
|
|
6
8
|
@plugins.smartdata.unI()
|
|
7
9
|
id: string;
|
|
8
|
-
|
|
10
|
+
|
|
9
11
|
@plugins.smartdata.svDb()
|
|
10
12
|
data: {
|
|
11
|
-
name?: string
|
|
12
|
-
address?: string
|
|
13
|
-
postalCode?: string
|
|
14
|
-
city?: string
|
|
15
|
-
country?: string
|
|
16
|
-
phone?: string
|
|
17
|
-
fax?: string
|
|
18
|
-
email?: string
|
|
19
|
-
website?: string
|
|
20
|
-
businessType?: string
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
name?: string;
|
|
14
|
+
address?: string;
|
|
15
|
+
postalCode?: string;
|
|
16
|
+
city?: string;
|
|
17
|
+
country?: string;
|
|
18
|
+
phone?: string;
|
|
19
|
+
fax?: string;
|
|
20
|
+
email?: string;
|
|
21
|
+
website?: string;
|
|
22
|
+
businessType?: string;
|
|
23
|
+
registrationId?: string;
|
|
24
|
+
germanParsedRegistration?: {
|
|
25
|
+
court?: string;
|
|
26
|
+
type?: 'HRA' | 'HRB' | 'GnR' | 'PR' | 'VR' | 'GsR';
|
|
27
|
+
number?: string;
|
|
28
|
+
};
|
|
29
|
+
legalForm?:
|
|
30
|
+
| 'GmbH'
|
|
31
|
+
| 'GmbH & Co. KG'
|
|
32
|
+
| 'AG'
|
|
33
|
+
| 'LLC'
|
|
34
|
+
| 'LLP'
|
|
35
|
+
| 'GmbH & Co. KGaA'
|
|
36
|
+
| 'GmbH & Co. KGaA, LLC';
|
|
37
|
+
managingDirectors?: string[];
|
|
38
|
+
boardOfDirectors?: string[];
|
|
39
|
+
supervisoryBoard?: string[];
|
|
40
|
+
foundingDate?: string;
|
|
41
|
+
capital?: string;
|
|
42
|
+
purpose?: string;
|
|
43
|
+
lastUpdate?: string;
|
|
31
44
|
} = {};
|
|
32
|
-
}
|
|
45
|
+
}
|