dataconv-client-sdk-ts 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/README.md +40 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -50,23 +50,35 @@ const client = new DataConvClient({
50
50
  client.setIdToken('<id_token>');
51
51
  client.setVpToken('<vp_token>');
52
52
 
53
- // 1. Create the tenant/software configuration.
53
+ // 1. Discover frontend field descriptors from the API.
54
+ const apiConfig = await client.getWellKnownApiConfig();
55
+
56
+ // Example UI options:
57
+ const fieldOptions = apiConfig.fields;
58
+ // [
59
+ // { code: 'section', display: 'Departamento o sección: ...' },
60
+ // { code: 'family', display: 'Categoría de este registro...' },
61
+ // ...
62
+ // ]
63
+
64
+ // 2. Create the tenant/software configuration using the current API field keys.
54
65
  const createResult = await client.createConfig({
55
66
  entries: [
56
67
  {
57
- softwareId: 'qvet-v1.0',
68
+ softwareId: 'api-config',
58
69
  config: {
59
70
  mappingConfig: {
60
- headerRowIndex: 1,
71
+ headerRowIndex: 3,
61
72
  fieldMap: {
62
- section: 'SECCION',
63
- family: 'FAMILIA',
64
- subfamily: 'SUBFAMILIA',
65
- concept: 'CONCEPTO',
66
- subjectId: 'HISTORIA_ID',
67
- species: 'ESPECIE',
73
+ section: 'DEPARTAMENTO',
74
+ family: 'CATEGORIA',
75
+ subfamily: 'SUBCATEGORIA',
76
+ concept: 'DESCRIPCION',
77
+ subject_id: 'ID_INTERNO',
78
+ subject_animal-species: 'ESPECIE',
68
79
  date: 'FECHA',
69
- time: 'HORA'
80
+ observation_weight: 'PESO',
81
+ coverage_insurer: 'ASEGURADORA'
70
82
  }
71
83
  }
72
84
  }
@@ -74,42 +86,43 @@ const createResult = await client.createConfig({
74
86
  ]
75
87
  });
76
88
 
77
- // 2. Wait until the configuration job completes.
89
+ // 3. Wait until the configuration job completes.
78
90
  const configResponse = await client.pollConfig({
79
- thid: createResult.thid
91
+ thid: createResult.thid,
92
+ softwareId: 'api-config'
80
93
  });
81
94
 
82
- // 3. Upload the Excel or XLSX file for pre-conversion.
95
+ // 4. Upload the Excel or XLSX file for pre-conversion.
83
96
  const uploadResult = await client.uploadWithLink(
84
97
  'https://example.com/exampleQvetES.xlsx?dl=1',
85
98
  {
86
- softwareId: 'qvet-v1.0',
99
+ softwareId: 'api-config',
87
100
  fileName: 'exampleQvetES.xlsx'
88
101
  }
89
102
  );
90
103
 
91
- // 4. Wait for the pre-conversion result.
104
+ // 5. Wait for the pre-conversion result.
92
105
  const conversionResponse = await client.pollUploadResponse({
93
106
  thid: uploadResult.thid,
94
- softwareId: 'qvet-v1.0'
107
+ softwareId: 'api-config'
95
108
  });
96
109
 
97
110
  const convertedBundle = client.getConvertedBundle(conversionResponse);
98
111
  const storedConfigs = client.getSuccessfulTenantConfigs(configResponse);
99
112
 
100
- // 5. Confirm promotion of the reviewed thread.
113
+ // 6. Confirm promotion of the reviewed thread.
101
114
  const patchResponse = await client.patchConversion({
102
115
  thid: uploadResult.thid,
103
- softwareId: 'qvet-v1.0'
116
+ softwareId: 'api-config'
104
117
  });
105
118
 
106
- // 6. Publish aggregated resources in batch if your flow needs it.
119
+ // 7. Publish aggregated resources in batch if your flow needs it.
107
120
  const publicationResponse = await client.batchPromotion({
108
121
  thid: uploadResult.thid,
109
- softwareId: 'qvet-v1.0'
122
+ softwareId: 'api-config'
110
123
  });
111
124
 
112
- // 7. Search promoted resources using lowercase FHIR parameters.
125
+ // 8. Search promoted resources using lowercase FHIR parameters.
113
126
  const searchResponse = await client.searchResources({
114
127
  resourceType: 'DocumentReference',
115
128
  searchParams: {
@@ -153,6 +166,12 @@ The returned object includes:
153
166
  - `fields` as `{ code, display }[]`
154
167
  - `endpoints` for `create`, `createResponse`, `upload`, and `uploadResponse`
155
168
 
169
+ The recommended frontend flow is:
170
+
171
+ 1. Read `fields` from `/.well-known/api-config.json`.
172
+ 2. Let the user map spreadsheet columns to those field codes.
173
+ 3. Submit `mappingConfig.fieldMap` using those same codes.
174
+
156
175
  ## Backend initialization
157
176
 
158
177
  If the backend instantiates the SDK after `Organization/_activate`, it can inject `axios` or `fetch` just like `ica-client-sdk-ts`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataconv-client-sdk-ts",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript SDK for adapter-ingestion-py preconversion APIs via DIDComm and multipart upload.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",