Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building and Testing Fern Definitions #1217

Merged
merged 57 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e3d3964
feat(sdk): java tests move and first test rewritten
jonahkaye Nov 22, 2023
4019e89
feat(sdk): create facility
jonahkaye Nov 22, 2023
a017b8f
feat(sdk): waiting on contacts definition release
jonahkaye Nov 22, 2023
cd178b0
Merge branch 'develop' into 1212-test-migration-python-sdk-tests
jonahkaye Nov 22, 2023
e080497
feat(sdk): yaml def changes and get,post working
jonahkaye Nov 22, 2023
d1caa48
feat(sdk): yaml def changes and get,post working
jonahkaye Nov 22, 2023
5dde81d
feat(sdk): updating defiitions
jonahkaye Nov 23, 2023
b0e540d
feat(sdk): updating defiitions
jonahkaye Nov 23, 2023
609f3a4
feat(sdks): requestdd for documentquery in fern
jonahkaye Nov 23, 2023
c725147
feat(sdks): list document request update fern
jonahkaye Nov 23, 2023
cb88978
feat(sdks): update document reference, createDocumentReference endpoint
jonahkaye Nov 24, 2023
ff95013
feat(sdks): compiling
jonahkaye Nov 24, 2023
46d8f9c
feat(sdks): testing changes complete. waiting on bug resolution and f…
jonahkaye Nov 24, 2023
4652dc3
🌿 Metriport Fern Definition exports FHIR schemas (#1188)
dsinghvi Nov 27, 2023
cb117bd
feat(sdks): merged deeps changes
jonahkaye Nov 27, 2023
e227774
feat(sdks): update reqs
jonahkaye Nov 27, 2023
39fd99e
Merge branch 'develop' into 1212-test-migration-python-sdk-tests
jonahkaye Nov 30, 2023
df2433b
🌿 Setup Local Java Project to setup Java SDK Testing (#1220)
dsinghvi Nov 30, 2023
eb51d87
feat(sdks): organizing things properly
jonahkaye Nov 30, 2023
d6d92d7
feat(sdks): removing fhir
jonahkaye Nov 30, 2023
2fd0655
feat(sdks): merging w/ develop
jonahkaye Dec 4, 2023
f833366
feat(sdk): java code
jonahkaye Dec 4, 2023
e5463b1
feat(sdk): java bug I cant solv. I think fern issue
jonahkaye Dec 5, 2023
86ed8bd
feat(sdk): java bug I cant solv. I think fern issue
jonahkaye Dec 5, 2023
2556a8b
add back in fern deps and bump generator versions
armandobelardo Dec 13, 2023
8d6598c
Merge pull request #1326 from armandobelardo/fern/fhir-confirm
jonahkaye Dec 18, 2023
3b3591d
feat(fern): adding fhir and updating java fern version
jonahkaye Dec 18, 2023
d7dc2cd
feat(sdks): merging develop to branch
jonahkaye Dec 18, 2023
3ed246e
bump FHIR and Java Fern versions to actually compile
armandobelardo Dec 20, 2023
604a1a6
testing ts as well
armandobelardo Dec 20, 2023
89d6450
Merge pull request #1359 from armandobelardo/ab/compile
jonahkaye Dec 21, 2023
b9f4673
feat(sdks): updating get consolidated status response type
jonahkaye Dec 21, 2023
9b3d7e4
feat(sdks): python and java work. ts wip
jonahkaye Dec 21, 2023
7603f5d
feat(sdks): ts working
jonahkaye Dec 21, 2023
1b18922
feat(sdks): python tests passing and modifications to fern def
jonahkaye Dec 22, 2023
3d904b6
feat(sdks): pushing java code for deep
jonahkaye Dec 22, 2023
165e02d
feat(sdks): states lowercased in typescript
jonahkaye Dec 22, 2023
e3da22e
feat(sdks): typescript tests passing
jonahkaye Dec 22, 2023
c31a203
feat(sdks): merging to develop
jonahkaye Dec 22, 2023
5fad20a
feat(sdks): nits
jonahkaye Dec 22, 2023
7cb53c9
feat(sdks): scripts for easy running
jonahkaye Dec 22, 2023
6cbfb97
feat(sdks): fern gen in script
jonahkaye Dec 22, 2023
fb4ac8d
feat(sdks): rebasing
jonahkaye Dec 22, 2023
d532230
feat(sdks): webhook types
jonahkaye Jan 4, 2024
d134716
feat(sdks): validating first webhook def
jonahkaye Jan 4, 2024
3792b1a
feat(sdks): readme
jonahkaye Jan 4, 2024
6576526
feat(sdks): bundle extension deep pls take a look
jonahkaye Jan 4, 2024
13299bf
feat(sdks): resource not defined error
jonahkaye Jan 4, 2024
4e538e6
feat(sdk): debugging with deep and handoff
jonahkaye Jan 4, 2024
fa8e6ac
Revert "feat(sdk): debugging with deep and handoff"
jonahkaye Jan 10, 2024
e89bf68
feat(sdks): fixed node webhook types
jonahkaye Jan 10, 2024
92be8cd
Merge branch 'develop' into 1212-test-migration-python-sdk-tests
jonahkaye Jan 10, 2024
84b6d07
Merge branch 'develop' into 1212-test-migration-python-sdk-tests
jonahkaye Jan 14, 2024
99e288e
feat(sdks): pairing with ramil for his pr for fern
jonahkaye Jan 29, 2024
9f4a0ac
feat(sdks): merging develop to branch
jonahkaye Feb 7, 2024
ec5c1c4
feat(sdks): responding to nits
jonahkaye Feb 13, 2024
90dd1eb
Merge branch 'develop' into 1212-test-migration-python-sdk-tests
jonahkaye Feb 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion fern/definition/medical/document.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,22 @@ service:
facilityId:
docs: The ID of the Facility where the patient is receiving care.
type: string
body:
docs: |
Metadata holds a record of up to 50 custom string key-value pairs. Key names can be up to 40 characters long and values up to 500 characters long.
This metadata will be returned in the webhook response.
type: optional<map<string, string>>
response: DocumentQuery
examples:
- name: Example1
query-parameters:
patientId: "12345678"
facilityId: "12345678"
request: {"youCan": "putAny", "stringKeyValue": "pairsHere"}
response:
body: $DocumentQuery.Example1

getQueryStatus:
getQueryStatus:
display-name: Get Document Query Status
docs: |
Returns the document query status for the specified patient.
Expand Down
50 changes: 50 additions & 0 deletions fern/definition/medical/fhir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ service:
formatted `YYYY-MM-DD` as per ISO 8601. If not provided,
no end date filter will be applied.
type: optional<string>
conversionType:
docs: |
The doc type to convert to. Either html or pdf.
jonahkaye marked this conversation as resolved.
Show resolved Hide resolved
type: optional<string>
body:
docs: |
Metadata holds a record of up to 50 custom string key-value pairs. Key names can be up to 40 characters long and values up to 500 characters long.
This metadata will be returned in the webhook response.
type: optional<map<string, string>>

response:
type: StartConsolidatedQueryResponse
docs: Returns a Bundle that contains a property entry which is simply an array of FHIR resources.
Expand Down Expand Up @@ -63,6 +73,24 @@ service:
response:
body: $GetConsolidatedQueryStatusResponse.Example0

createPatientConsolidated:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added missing endpoint

display-name: Create Patient's Consolidated Data
docs: Create Patient's Consolidated Data with a FHIR Bundle.
method: PUT
path: /patient/{id}/consolidated
path-parameters:
id:
type: string
docs: The ID of the Patient
response:
type: TransactionResponse
examples:
- name: Example1
path-parameters:
id: "12345678"
response:
body: $TransactionResponse.Example0

countPatientData:
display-name: Count Patient Data
docs: Get a count of a Patient's data per resource.
Expand Down Expand Up @@ -150,6 +178,28 @@ types:
no end date filter will be applied.
type: optional<string>

TransactionResponse:
properties:
resourceType:
type: string
docs: The type of the FHIR resource. For a transaction response, this is always "Bundle".
id:
type: string
docs: A unique identifier for this transaction response.
type:
type: string
docs: The type of the bundle, which is "transaction-response" in this case.
entry:
type: list<map<string, unknown>>
docs: An array of responses for each transaction in the bundle. Each entry can be any arbitrary JSON object.
examples:
- name: Example0
value:
resourceType: "Bundle"
id: "12345"
type: "transaction-response"
entry: [{ "resourceId": "abc123", "status": "created", "details": "Resource created successfully" }]

ResourcesSearchableByPatient:
enum:
- Account
Expand Down
21 changes: 11 additions & 10 deletions fern/definition/medical/patient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,12 @@ types:
Addresses:
discriminated: false
union:
- commons.Address
- list<commons.Address>

Contacts:
discriminated: false
union:
- Contact
- list<Contact>

PersonalIdentifier:
union:
Expand Down Expand Up @@ -150,17 +149,11 @@ types:
email:
type: optional<string>
docs: The Patient's email address.
facilityIds:
type: list<FacilityId>
docs: Array of the IDs of the Facilities where the Patient is receiving care.
examples:
- name: Example1
value:
phone: "1234567899"
email: karen@cvspharmacy.com
facilityIds:
- $FacilityId.Example1
- $FacilityId.Example2

FacilityId:
type: string
Expand Down Expand Up @@ -196,8 +189,11 @@ types:
address:
type: optional<Addresses>
contact:
type: optional<list<Contact>>

type: optional<Contacts>
jonahkaye marked this conversation as resolved.
Show resolved Hide resolved
externalID:
type: optional<string>
docs: An external Patient ID to associate to a Patient in Metriport.

Patient:
extends: BasePatient
properties:
Expand All @@ -206,6 +202,9 @@ types:
docs: |
The ID assigned to this Patient. This ID will be used to uniquely
identify this Patient in medical documents.
facilityIds:
type: list<FacilityId>
docs: Array of the IDs of the Facilities where the Patient is receiving care.
examples:
- name: Example1
value:
Expand All @@ -216,6 +215,8 @@ types:
genderAtBirth: F
personalIdentifiers:
- $PersonalIdentifier.Example1
facilityIds:
- $FacilityId.Example1

ListPatientsResponse:
properties:
Expand Down
3 changes: 2 additions & 1 deletion packages/sdks/java/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
generated/
tester-local
generated
3 changes: 3 additions & 0 deletions packages/sdks/java/tester-java/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
API_KEY=foo
BASE_URL=http://localhost:8080
FACILITY_ID=bar
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@

# Maven
target/
.env
generated/
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ under "Developers".

## Building

Run `./mvn clean package` and check the `target` folder.
Run `./mvnw clean package` and check the `target` folder.

## Running

Expand All @@ -29,3 +29,4 @@ Run `java -Dapi_key=YOUR-KEY -jar target/metriport-test-1.0.jar` and:
- replace `YOUR-KEY` with the vale of your API key
- replace the version with whatever version defined on `pom.xml` (the default one is `1.0`, which doesn't
require any changes)
- note that Dapi_key is not related to DAPI (devices API). It is java syntax to add the -D with no space
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
<dependency>
<groupId>com.metriport</groupId>
<artifactId>metriport-java</artifactId>
<version>0.1.8</version>
<version>8.0.0-alpha1</version>
</dependency>
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>java-dotenv</artifactId>
<version>5.2.2</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.metriport.test;

import io.github.cdimascio.dotenv.Dotenv;
import com.metriport.api.Metriport;
import com.metriport.api.resources.medical.facility.types.BaseFacility;
import com.metriport.api.resources.commons.types.UsState;
import com.metriport.api.resources.commons.types.Address;

public class CreateFacility {
public static void main(String[] args) {
Dotenv dotenv = Dotenv.load();

Metriport metriport = Metriport.builder()
.apiKey(dotenv.get("API_KEY"))
.url(dotenv.get("BASE_URL"))
.build();

Address address = Address.builder()
.addressLine1("2261 Market Street")
.city("San Francisco")
.state(UsState.CA)
.zip("12345")
.country("USA")
.addressLine2("#4818")
.build();

BaseFacility newFacility = BaseFacility.builder()
.name("New Facility")
.npi("1234567893")
.address(address)
.build();

var response = metriport.medical().facility().create(newFacility);
System.out.println("Created new facility!" + response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.metriport.test;

import io.github.cdimascio.dotenv.Dotenv;
import com.metriport.api.Metriport;
public class GetFacility {
public static void main(String[] args) {
Dotenv dotenv = Dotenv.load();

Metriport metriport = Metriport.builder()
.apiKey(dotenv.get("API_KEY"))
.url(dotenv.get("BASE_URL"))
.build();

var response_all = metriport.medical().facility().list();
System.out.println("All facilities:" + response_all);

var response = metriport.medical().facility().get(dotenv.get("FACILITY_ID"));
System.out.println("Specific facility" + response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.metriport.test;

import io.github.cdimascio.dotenv.Dotenv;
import com.metriport.api.Metriport;

public class GetOrg {
public static void main(String[] args) {
Dotenv dotenv = Dotenv.load();

Metriport metriport = Metriport.builder()
.apiKey(dotenv.get("API_KEY"))
.url(dotenv.get("BASE_URL"))
.build();

var response = metriport.medical().facility().list();
System.out.println("Received response!" + response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.metriport.test;

import io.github.cdimascio.dotenv.Dotenv;
import com.metriport.api.Metriport;

public class GetPatient {
public static void getAllPatients(String[] args) {
Dotenv dotenv = Dotenv.load();

Metriport metriport = Metriport.builder()
.apiKey(dotenv.get("API_KEY"))
.url(dotenv.get("BASE_URL"))
.build();

var response = metriport.medical().patient().list();
System.out.println("Received response!" + response);
}
public static void getSpecificPatient(String[] args) {
Dotenv dotenv = Dotenv.load();

Metriport metriport = Metriport.builder()
.apiKey(dotenv.get("API_KEY"))
.url(dotenv.get("BASE_URL"))
.build();

var response = metriport.medical().patient().get();
System.out.println("Received response!" + response);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.metriport.test;
import io.github.cdimascio.dotenv.Dotenv;
import com.metriport.api.Metriport;
import com.metriport.api.resources.commons.types.Address;
import com.metriport.api.resources.commons.types.UsState;
import com.metriport.api.resources.medical.organization.types.OrganizationCreate;
import com.metriport.api.resources.medical.organization.types.OrgType;


public class Main {
public static void main(String[] args) {
// GetOrg.main(args);
// GetFacility.main(args);
//CreateFacility.main(args);
GetPatient.getAllPatients(args);
//GetPatient.getSpecificPatient(args);
}
}
3 changes: 2 additions & 1 deletion packages/sdks/python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
generated/
**/__pycache__/
*.env
*.env
*.pytest_cache/
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
from generated.client import Metriport
from generated import commons
from generated.resources import medical

import os
from dotenv import load_dotenv

load_dotenv()

api_key = os.environ.get("METRIPORT_API_KEY")
base_url = os.environ.get("BASE_URL")

def test_client() -> None:
client = Metriport(api_key=get_api_key(), base_url="http://localhost:8080")
client = Metriport(api_key=api_key, base_url=base_url)
response = client.medical.organization.create(request=medical.OrganizationCreate(
name="my-org",
type=medical.OrgType.ACUTE_CARE,
Expand All @@ -23,11 +26,4 @@ def test_client() -> None:
)
)
)
print(f"Received response with {response.id}")


def get_api_key() -> str:
api_key = os.environ.get("METRIPORT_API_KEY")
if api_key is None:
raise Exception("METRIPORT_API_KEY not found")
return api_key
print(f"Received response with {response.id}")
Loading
Loading